Knight KE / Mbed OS Game_Master
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         zero on success, on failure negative error code
00046      */
00047     virtual nsapi_error_t get_manufacturer(char *buf, size_t buf_size) = 0;
00048 
00049     /** Request model identification of cellular device
00050      *
00051      *  @param buf      model identification as zero terminated string
00052      *  @param buf_size max length of model identification is 2048 characters
00053      *  @return         zero on success, on failure negative error code
00054      */
00055     virtual nsapi_error_t get_model(char *buf, size_t buf_size) = 0;
00056 
00057     /** Request revision identification of cellular device
00058      *
00059      *  @param buf      revision identification as zero terminated string
00060      *  @param buf_size max length of revision identification is 2048 characters
00061      *  @return         zero on success, on failure negative error code
00062      */
00063     virtual nsapi_error_t get_revision(char *buf, size_t buf_size) = 0;
00064 
00065     /** Request serial number identification of cellular device
00066      *
00067      *  @param buf      serial number as zero terminated string
00068      *  @param buf_size max length of serial number is 2048 characters
00069      *  @param type     serial number type to read
00070      *  @return         zero on success, on failure negative error code
00071      */
00072     enum SerialNumberType {
00073         SN = 0, // Serial Number
00074         IMEI = 1, // International Mobile station Equipment Identity
00075         IMEISV = 2, // IMEI and Software Version number
00076         SVN  = 3 // Software Version Number
00077     };
00078     virtual nsapi_size_or_error_t get_serial_number(char *buf, size_t buf_size, SerialNumberType type = SN) = 0;
00079 };
00080 
00081 } // namespace mbed
00082 
00083 #endif // CELLULAR_INFORMATION_H_