/usr/include/gsmlib/gsm_me_ta.h is in libgsmme-dev 1.10+20120414.gita5e5ae9a-0.3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | // *************************************************************************
// * GSM TA/ME library
// *
// * File: gsm_me_ta.h
// *
// * Purpose: Mobile Equipment/Terminal Adapter and SMS functions
// * (ETSI GSM 07.07 and 07.05)
// *
// * Author: Peter Hofmann (software@pxh.de)
// *
// * Created: 3.5.1999
// *************************************************************************
#ifndef GSM_ME_TA_H
#define GSM_ME_TA_H
#include <gsmlib/gsm_error.h>
#include <gsmlib/gsm_event.h>
#include <gsmlib/gsm_phonebook.h>
#include <gsmlib/gsm_sms_store.h>
#include <gsmlib/gsm_util.h>
#include <gsmlib/gsm_at.h>
#include <gsmlib/gsm_sms.h>
#include <string>
#include <vector>
namespace gsmlib
{
// *** phone capability description (you could also call it phone quirks)
struct Capabilities
{
bool _hasSMSSCAprefix; // SMS have service centre address prefix
int _cpmsParamCount; // number of SMS store parameters to
// CPMS command
bool _omitsColon; // omits trailing ':' in AT responses
bool _veryShortCOPSanswer; // Falcom A2-1
bool _wrongSMSStatusCode; // Motorola Timeport 260
bool _CDSmeansCDSI; // Nokia Cellular Card Phone RPE-1 GSM900
bool _sendAck; // send ack for directly routed SMS
Capabilities(); // constructor, set default behaviours
};
// *** auxiliary structs
// Static ME information (AT command sequences given in brackets)
struct MEInfo
{
std::string _manufacturer; // (+CGMI)
std::string _model; // (+CGMM)
std::string _revision; // (+CGMR)
std::string _serialNumber; // (+CGSN), IMEI
};
// modes for network operation selection
enum OPModes {AutomaticOPMode = 0, ManualOPMode = 1,
DeregisterOPMode = 2, ManualAutomaticOPMode = 4};
// status codes or network operaton selection
enum OPStatus {UnknownOPStatus = 0, AvailableOPStatus = 1,
CurrentOPStatus = 2, ForbiddenOPStatus = 3};
// network operator info
struct OPInfo
{
OPModes _mode;
OPStatus _status;
std::string _longName;
std::string _shortName;
int _numericName; // may be NOT_SET
OPInfo() : _status(UnknownOPStatus), _numericName(NOT_SET) {}
};
// facility classes
enum FacilityClass {VoiceFacility = 1, DataFacility = 2, FaxFacility = 4};
const int ALL_FACILITIES = VoiceFacility | DataFacility | FaxFacility;
// struct to hold password info
struct PWInfo
{
std::string _facility;
int _maxPasswdLen;
};
// call forward reasons
// AllReasons encompasses 0..3
// AllConditionalReasons encompasses 1..3
enum ForwardReason {UnconditionalReason = 0, MobileBusyReason = 1,
NoReplyReason = 2, NotReachableReason = 3,
AllReasons = 4, AllConditionalReasons = 5, NoReason = 6};
// call forward modes
enum ForwardMode {DisableMode = 0, EnableMode = 1,
RegistrationMode = 3, ErasureMode = 4};
// call forward info
struct ForwardInfo
{
bool _active; // status in the network
FacilityClass _cl; // voice, fax, or data
std::string _number; // telephone number
std::string _subAddr; // subaddress
int _time; // time in the range 1..30 (for NoReplyReason)
ForwardReason _reason; // reason for the forwarding
};
// SMS types
typedef Ref<SMSStore> SMSStoreRef;
typedef std::vector<SMSStoreRef> SMSStoreVector;
// this class allows access to all functions of a ME/TA as described
// in sections 5-8 of ETSI GSM 07.07
// Note: If the ME is changed (ie. disconnected an another one connected
// to the TA), a new ME object must be created
// (Mobile equipment = ME, terminal adapter = TA)
class MeTa : public RefBase
{
protected:
Ref<Port> _port; // port the ME/TA is connected to
Ref<GsmAt> _at; // chat object for the port
PhonebookVector _phonebookCache; // cache of all used phonebooks
SMSStoreVector _smsStoreCache; // cache of all used phonebooks
std::string _lastPhonebookName; // remember last phonebook set on ME/TA
std::string _lastSMSStoreName; // remember last SMS store set on ME/TA
Capabilities _capabilities; // ME/TA quirks
GsmEvent _defaultEventHandler; // default event handler
// see comments in MeTa::init()
std::string _lastCharSet; // remember last character set
// init ME/TA to sensible defaults
void init() throw(GsmException);
public:
// initialize a new MeTa object given the port
MeTa(Ref<Port> port) throw(GsmException);
// initialize a new MeTa object given the AT handler
//MeTa(Ref<GsmAt> at) throw(GsmException);
// set the current phonebook in the ME
// remember the last phonebook set for optimisation
void setPhonebook(std::string phonebookName) throw(GsmException);
// set the current SMS store in the ME
// set storeTypes to
// 1 to set store for reading and deleting
// 2 to set store for writing and sending (includes type 1)
// 3 to preferred store for receiving SMS (includes types 1 and 2)
// remember the last SMS store set for optimisation
// if needResultCode is set this optimisation is not done
std::string setSMSStore(std::string smsStore, int storeTypes,
bool needResultCode = false)
throw(GsmException);
// get current SMS store settings
void getSMSStore(std::string &readDeleteStore,
std::string &writeSendStore,
std::string &receiveStore) throw(GsmException);
// get capabilities of this ME/TA
Capabilities getCapabilities() const {return _capabilities;}
// return my port
Ref<Port> getPort() {return _port;}
// return my at handler
Ref<GsmAt> getAt() {return _at;}
// set event handler for unsolicited result codes
GsmEvent *setEventHandler(GsmEvent *newHandler)
{return _at->setEventHandler(newHandler);}
// wait for an event
void waitEvent(GsmTime timeout) throw(GsmException);
// *** ETSI GSM 07.07 Section 5: "General Commands"
// return ME information
MEInfo getMEInfo() throw(GsmException);
// return available character sets
std::vector<std::string> getSupportedCharSets() throw(GsmException);// (+CSCS=?)
// return current character set (default: GSM)
std::string getCurrentCharSet() throw(GsmException);// (+CSCS?)
// set character set to use
void setCharSet(std::string charSetName) throw(GsmException);// (+CSCS=)
// *** ETSI GSM 07.07 Section 6: "Call control commands and methods"
// get extended error report
std::string getExtendedErrorReport() throw(GsmException);// (+CEER)
// dial a number, CLI presentation as defined in network
void dial(std::string number) throw(GsmException);// (ATD)
// answer
void answer() throw(GsmException); // (ATA)
// hangup
void hangup() throw(GsmException); // (ATH)
// set Personal Identification Number
void setPIN(std::string number) throw(GsmException);// (+CPIN)
// get PIN Status
std::string getPINStatus() throw(GsmException);// (+CPIN?)
// *** ETSI GSM 07.07 Section 7: "Network service related commands"
// return available network operators
// this fills in all fields of OPInfo with the exception of _mode
std::vector<OPInfo> getAvailableOPInfo() throw(GsmException); // (+COPS=?)
// return current network operators
// this fills in all the fields of OPInfo with the exception of _status
OPInfo getCurrentOPInfo() throw(GsmException);
// set network operator
// caller must fill in ALL names it has read from previous calls
// of getCurrentOPInfo() or getAvailableOPInfo()
// (because ME/TA might not implement all names)
void setCurrentOPInfo(OPModes mode,
std::string longName = "",
std::string shortName = "",
int numericName = NOT_SET) throw(GsmException);
// get facility lock capabilities (+CLCK)
std::vector<std::string> getFacilityLockCapabilities() throw(GsmException);
// query facility lock status for named facility
bool getFacilityLockStatus(std::string facility, FacilityClass cl)
throw(GsmException);
// lock facility
void lockFacility(std::string facility, FacilityClass cl, std::string passwd = "")
throw(GsmException);
// unlock facility
void unlockFacility(std::string facility, FacilityClass cl, std::string passwd = "")
throw(GsmException);
// return names of facility for which a password can be set
// and the maximum length of the respective password
std::vector<PWInfo> getPasswords() throw(GsmException);// (+CPWD=?)
// set password for the given facility
void setPassword(std::string facility, std::string oldPasswd, std::string newPasswd)
throw(GsmException);
// (+CPWD=)
// get CLIP (caller line identification presentation) in the network
bool getNetworkCLIP() throw(GsmException);// (+CLIP?)
// set CLIP presentation on or off
// enables GsmEvent::callerLineID
void setCLIPPresentation(bool enable) throw(GsmException);// (+CLIP=)
// returns if the above is enable
bool getCLIPPresentation() throw(GsmException);// (+CLIP?)
// set call forwarding
void setCallForwarding(ForwardReason reason,
ForwardMode mode,
std::string number,
std::string subaddr,
FacilityClass cl = (FacilityClass)ALL_FACILITIES,
int forwardTime = NOT_SET)
throw(GsmException); // (+CCFC=)
// get Information of currently set CF in the network
// the caller must give the reason to query
void getCallForwardInfo(ForwardReason reason,
ForwardInfo &voice,
ForwardInfo &fax,
ForwardInfo &data)
throw(GsmException); // (+CCFC=)
// *** ETSI GSM 07.07 Section 8: "Mobile Equipment control
// and status commands"
// return/set ME functionality level (+CFUN):
// 0 Minimum functionality
// 1 full functionality
// 2 disable phone transmit RF circuits only
// 3 disable phone receive RF circuits only
// 4 disable phone both transmit and receive RF circuits
// 5...127 implementation-defined
int getFunctionalityLevel() throw(GsmException);
void setFunctionalityLevel(int level) throw(GsmException);
// return battery charge status (+CBC):
// 0 ME is powered by the battery
// 1 ME has a battery connected, but is not powered by it
// 2 ME does not have a battery connected
// 3 Recognized power fault, calls inhibited
int getBatteryChargeStatus() throw(GsmException);
// return battery charge (range 0..100) (+CBC)
int getBatteryCharge() throw(GsmException);
// get signal strength indication (+CSQ):
// 0 -113 dBm or less
// 1 -111 dBm
// 2...30 -109... -53 dBm
// 31 -51 dBm or greater
// 99 not known or not detectable
int getSignalStrength() throw(GsmException);
// get channel bit error rate (+CSQ):
// 0...7 as RXQUAL values in the table in GSM 05.08 [20] subclause 8.2.4
// 99 not known or not detectable
int getBitErrorRate() throw(GsmException);
// get available phone book memory storage strings (+CPBS=?)
std::vector<std::string> getPhoneBookStrings() throw(GsmException);
// get phone book given the phone book memory storage string
PhonebookRef getPhonebook(std::string phonebookString,
bool preload = false) throw(GsmException);
// *** ETSI GSM 07.05 SMS functions
// return service centre address (+CSCA?)
std::string getServiceCentreAddress() throw(GsmException);
// set service centre address (+CSCA=)
void setServiceCentreAddress(std::string sca) throw(GsmException);
// return names of available message stores (<mem1>, +CPMS=?)
std::vector<std::string> getSMSStoreNames() throw(GsmException);
// return SMS store given the name
SMSStoreRef getSMSStore(std::string storeName) throw(GsmException);
// send a single SMS message
void sendSMS(Ref<SMSSubmitMessage> smsMessage) throw(GsmException);
// send one or several (concatenated) SMS messages
// The SUBMIT message template must have all options set, only
// the userData and the userDataHeader are changed.
// If oneSMS is true, only one SMS is sent. Otherwise several SMSs
// are sent. If concatenatedMessageId is != -1 this is used as the message
// ID for concatenated SMS (for this a user data header as defined in
// GSM GTS 3.40 is used, the old UDH in the template is overwritten).
void sendSMSs(Ref<SMSSubmitMessage> smsTemplate, std::string text,
bool oneSMS = false,
int concatenatedMessageId = -1)
throw(GsmException);
// set SMS service level
// if set to 1 send commands return ACK PDU, 0 is the default
void setMessageService(int serviceLevel) throw(GsmException);
// return SMS service level
unsigned int getMessageService() throw(GsmException);
// return true if any of the thre message types GsmEvent::SMSMessageType
// is routed directly to the TA and not stored in the ME
void getSMSRoutingToTA(bool &smsRouted, // (+CNMI?)
bool &cbsRouted,
bool &statusReportsRouted) throw(GsmException);
// sets routing of SMS to TA to true for all supported SMSMessageTypes
// if onlyReceptionIndication is set to true
// only GsmEvent::SMSReceptionIndication is called
// this has two reasons: GSM 07.05 section 3.4.1 does not recommend
// direct routing of new SMS to the TA
// I cannot test direct routing of SMS because it does not work with
// my hardware
void setSMSRoutingToTA(bool enableSMS, bool enableCBS,
bool enableStatReport,
bool onlyReceptionIndication = true)
throw(GsmException);
// (+CNMI=)
bool getCallWaitingLockStatus(FacilityClass cl)
throw(GsmException);
void setCallWaitingLockStatus(FacilityClass cl,
bool lock)throw(GsmException);
void setCLIRPresentation(bool enable) throw(GsmException);
//(+CLIR)
// 0:according to the subscription of the CLIR service
// 1:CLIR invocation
// 2:CLIR suppression
int getCLIRPresentation() throw(GsmException);
friend class Phonebook;
friend class SMSStore;
};
};
#endif // GSM_ME_TA_H
|