Loading...
Searching...
No Matches
serial::GsmModem Interface Reference

Interface for communication with a GSM modem attached to a serial port. More...

## Classes

struct | Information
| Structure holding information about the modem and the SIM card. More...
struct | Settings
| Structure for holding settings of the GSM modem and its SIM card. More...
struct | SimPinUpdatedEvent
| Sim pin updated event. More...
struct | SimSecurityStatusChangedEvent
| Sim card security status changed event. More...

## Public Types

enum | SimSecurityStatus { UNLOCKED , WAITFORPIN , WAITFORPUK , UNKNOWN }
| Possible security states the sim card can be in at a given time. More...

## Public Member Functions

Settings | getSettings ()
| Get modem settings.
int | setSettings (in Settings settings)
| Set modem settings.
int | sendSms (in string recipient, in string text)
| Send out a SMS message.
int | sendTestSms (in string recipient, in Settings testSettings)
| Send out a test SMS message.
int | getInformation (out Information info)
| Retrieve low-level information about the modem and the SIM card.
int | getInformationWithPin (in string pin, out Information info)
| Retrieve low-level information about the modem and the SIM card.
int | getSimSecurityStatus (out SimSecurityStatus simStatus)
| Retrieve security status of the SIM card.
int | unlockSimCard (in string puk, in string newPin)
| Unlock SIM card with PUK and set new PIN if the SIM card is in security status WAITFORPUK.

## Public Attributes

constant int | SUCCESS = 0
| Error codes.
constant int | ERR_INVALID_VALUE = 1
| Invalid argument.
constant int | ERR_WRONG_PIN = 2
| The PIN is incorrect or missing.
constant int | ERR_SMS_SEND_FAILED = 3
| SMS delivery failed.
constant int | ERR_COMMUNICATION_FAILURE = 4
| Communication with the modem failed.
constant int | ERR_SIM_LOCKED = 5
| The SIM card is locked and waits for the PUK.
constant int | ERR_WRONG_SIM_STATUS = 6
| The SIM card doesn't wait for the PUK.
constant int | ERR_WRONG_PUK = 7
| The PUK is incorrect or missing.
constant int | ERR_SIM_PROBLEM = 8
| There is a problem with the SIM or service subscription.

## Detailed Description

Interface for communication with a GSM modem attached to a serial port.

Definition at line 18 of file GsmModem.idl.

## Member Enumeration Documentation

## SimSecurityStatus

enum serial::GsmModem::SimSecurityStatus

Possible security states the sim card can be in at a given time.

Enumerator
UNLOCKED | SIM card is unlocked.
WAITFORPIN | PIN must be entered to unlock the SIM card.
WAITFORPUK | PUK and new PIN must be entered to unlock the SIM card.
UNKNOWN | Unkown security status.

Definition at line 35 of file GsmModem.idl.

## Member Function Documentation

## getInformation()

int serial::GsmModem::getInformation | ( | out Information | info | ) |

Retrieve low-level information about the modem and the SIM card.

Parameters

  info | – structure holding the returned information

Returns
  SUCCESS – on success
  ERR_WRONG_PIN – if the used PIN is incorrect or missing
  ERR_SIM_LOCKED – if the SIM card is locked and waits for the PUK
  ERR_COMMUNICATION_FAILURE – if communication with the modem failed

## getInformationWithPin()

int serial::GsmModem::getInformationWithPin | ( | in string | pin,
|  | out Information | info
| ) |  |

Retrieve low-level information about the modem and the SIM card.

Like getInformation, but allows providing a PIN not stored in the settings

Parameters

  pin | – PIN to use for authentication
  info | – structure holding the returned information

Returns
  SUCCESS – on success
  ERR_WRONG_PIN – if the used PIN is incorrect or missing
  ERR_SIM_LOCKED – if the SIM card is locked and waits for the PUK
  ERR_COMMUNICATION_FAILURE – if communication with the modem failed

## getSettings()

Settings serial::GsmModem::getSettings | ( |  | ) |

Get modem settings.

Returns
  – Current modem settings

## getSimSecurityStatus()

int serial::GsmModem::getSimSecurityStatus | ( | out SimSecurityStatus | simStatus | ) |

Retrieve security status of the SIM card.

Parameters

  simStatus | – SIM card security status

Returns
  SUCCESS – on success
  ERR_COMMUNICATION_FAILURE – if communication with the modem failed

## sendSms()

int serial::GsmModem::sendSms | ( | in string | recipient,
|  | in string | text
| ) |  |

Send out a SMS message.

Parameters

  recipient | – Phone number of the message recipient in ITU-T E.164 format
  text | – Message text (will be sent in multiple messages if longer than 160 characters)

Returns
  SUCCESS – on success
  ERR_WRONG_PIN – if the PIN currently stored in the settings is incorrect or missing
  ERR_SMS_SEND_FAILED – if the delivery of the SMS to the network failed
  ERR_SIM_LOCKED – if the SIM card is locked and waits for the PUK
  ERR_COMMUNICATION_FAILURE – if communication with the modem failed

## sendTestSms()

int serial::GsmModem::sendTestSms | ( | in string | recipient,
|  | in Settings | testSettings
| ) |  |

Send out a test SMS message.

The message will be sent to the selected recipient with the text 'SMS Test'.

Parameters

  recipient | – Phone number of the message recipient in ITU-T E.164 format
  testSettings | – Modem settings to be used temporarily during testing

Returns
  SUCCESS – on success
  ERR_WRONG_PIN – if the PIN currently stored in the settings is incorrect or missing
  ERR_SMS_SEND_FAILED – if the delivery of the SMS to the network failed
  ERR_SIM_LOCKED – if the SIM card is locked and waits for the PUK
  ERR_COMMUNICATION_FAILURE – if communication with the modem failed

## setSettings()

int serial::GsmModem::setSettings | ( | in Settings | settings | ) |

Set modem settings.

Parameters

  settings | – New settings

Returns
  SUCCESS – on success
  ERR_INVALID_VALUE – if any passed value was invalid

## unlockSimCard()

int serial::GsmModem::unlockSimCard | ( | in string | puk,
|  | in string | newPin
| ) |  |

Unlock SIM card with PUK and set new PIN if the SIM card is in security status WAITFORPUK.

The new PIN is automatically saved in the settings.

Parameters

  puk | – PUK to use for authentication
  newPin | – new PIN to use for future authentication

Returns
  SUCCESS – on success
  ERR_WRONG_SIM_STATUS – if the SIM card doesn't wait for the PUK
  ERR_WRONG_PUK – if the used PUK is incorrect or missing
  ERR_COMMUNICATION_FAILURE – if communication with the modem failed

## Member Data Documentation

## ERR_COMMUNICATION_FAILURE

constant int serial::GsmModem::ERR_COMMUNICATION_FAILURE = 4

Communication with the modem failed.

Definition at line 26 of file GsmModem.idl.

## ERR_INVALID_VALUE

constant int serial::GsmModem::ERR_INVALID_VALUE = 1

Invalid argument.

Definition at line 23 of file GsmModem.idl.

## ERR_SIM_LOCKED

constant int serial::GsmModem::ERR_SIM_LOCKED = 5

The SIM card is locked and waits for the PUK.

Definition at line 27 of file GsmModem.idl.

## ERR_SIM_PROBLEM

constant int serial::GsmModem::ERR_SIM_PROBLEM = 8

There is a problem with the SIM or service subscription.

Definition at line 30 of file GsmModem.idl.

## ERR_SMS_SEND_FAILED

constant int serial::GsmModem::ERR_SMS_SEND_FAILED = 3

SMS delivery failed.

Definition at line 25 of file GsmModem.idl.

## ERR_WRONG_PIN

constant int serial::GsmModem::ERR_WRONG_PIN = 2

The PIN is incorrect or missing.

Definition at line 24 of file GsmModem.idl.

## ERR_WRONG_PUK

constant int serial::GsmModem::ERR_WRONG_PUK = 7

The PUK is incorrect or missing.

Definition at line 29 of file GsmModem.idl.

## ERR_WRONG_SIM_STATUS

constant int serial::GsmModem::ERR_WRONG_SIM_STATUS = 6

The SIM card doesn't wait for the PUK.

Definition at line 28 of file GsmModem.idl.

## SUCCESS

constant int serial::GsmModem::SUCCESS = 0

Error codes.

No error

Definition at line 22 of file GsmModem.idl.

The documentation for this interface was generated from the following file:

- GsmModem.idl