takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CellularInformation.h Source File

CellularInformation.h

00001 /*
00002  * Copyright (c) 2018, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef CELLULAR_INFORMATION_H_
00019 #define CELLULAR_INFORMATION_H_
00020 
00021 #include <stddef.h>
00022 #include "nsapi_types.h"
00023 
00024 namespace mbed {
00025 
00026 /**
00027  *  Class CellularInformation
00028  *
00029  *  An abstract interface that provides information about cellular device.
00030  */
00031 class CellularInformation {
00032 protected:
00033     // friend of CellularDevice so that it's the only way to close/delete this class.
00034     friend class CellularDevice;
00035 
00036     /** virtual Destructor
00037      */
00038     virtual ~CellularInformation() {};
00039 
00040 public:
00041     /** Request manufacturer identification of cellular device
00042      *
00043      *  @param buf      manufacturer identification as zero terminated string
00044      *  @param buf_size max length of manufacturer identification is 2048 characters
00045      *  @return         NSAPI_ERROR_OK on success
00046      *                  NSAPI_ERROR_DEVICE_ERROR on failure
00047      */
00048     virtual nsapi_error_t get_manufacturer(char *buf, size_t buf_size) = 0;
00049 
00050     /** Request model identification of cellular device
00051      *
00052      *  @param buf      model identification as zero terminated string
00053      *  @param buf_size max length of model identification is 2048 characters
00054      *  @return         NSAPI_ERROR_OK on success
00055      *                  NSAPI_ERROR_DEVICE_ERROR on failure
00056      */
00057     virtual nsapi_error_t get_model(char *buf, size_t buf_size) = 0;
00058 
00059     /** Request revision identification of cellular device
00060      *
00061      *  @param buf      revision identification as zero terminated string
00062      *  @param buf_size max length of revision identification is 2048 characters
00063      *  @return         NSAPI_ERROR_OK on success
00064      *                  NSAPI_ERROR_DEVICE_ERROR on failure
00065      */
00066     virtual nsapi_error_t get_revision(char *buf, size_t buf_size) = 0;
00067 
00068     /** Request serial number identification of cellular device
00069      *
00070      *  @param buf      serial number as zero terminated string
00071      *  @param buf_size max length of serial number is 2048 characters
00072      *  @param type     serial number type to read
00073      *  @return         NSAPI_ERROR_OK on success
00074      *                  NSAPI_ERROR_UNSUPPORTED if the modem does not support SerialNumberType
00075      *                  NSAPI_ERROR_DEVICE_ERROR on other failures
00076      */
00077     enum SerialNumberType {
00078         SN = 0, // Serial Number
00079         IMEI = 1, // International Mobile station Equipment Identity
00080         IMEISV = 2, // IMEI and Software Version number
00081         SVN  = 3 // Software Version Number
00082     };
00083     virtual nsapi_size_or_error_t get_serial_number(char *buf, size_t buf_size, SerialNumberType type = SN) = 0;
00084 };
00085 
00086 } // namespace mbed
00087 
00088 #endif // CELLULAR_INFORMATION_H_