~ubuntu-branches/debian/jessie/gsmlib/jessie

« back to all changes in this revision

Viewing changes to gsmlib/gsm_me_ta.h

  • Committer: Package Import Robot
  • Author(s): Andrew Shadura
  • Date: 2013-10-15 13:29:27 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20131015132927-1i5iwvj21wue3uvu
Tags: 1.10+20120414.gita5e5ae9a-0.1
* Non-maintainer upload.
* Update to the latest Git version by Vianney Bouchaud.
* Use 3.0 (quilt) source package format.
* Own the run subdirectory (Closes: #689891).
* Don't remove the system user on package remove.
* Fix init script (LP: #30228).

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <string>
25
25
#include <vector>
26
26
 
27
 
using namespace std;
28
 
 
29
27
namespace gsmlib
30
28
{
31
29
  // *** phone capability description (you could also call it phone quirks)
48
46
  // Static ME information (AT command sequences given in brackets)
49
47
  struct MEInfo
50
48
  {
51
 
    string _manufacturer;       // (+CGMI)
52
 
    string _model;              // (+CGMM)
53
 
    string _revision;           // (+CGMR)
54
 
    string _serialNumber;       // (+CGSN), IMEI
 
49
    std::string _manufacturer;       // (+CGMI)
 
50
    std::string _model;              // (+CGMM)
 
51
    std::string _revision;           // (+CGMR)
 
52
    std::string _serialNumber;       // (+CGSN), IMEI
55
53
  };
56
54
 
57
55
  // modes for network operation selection
67
65
  {
68
66
    OPModes _mode;
69
67
    OPStatus _status;
70
 
    string _longName;
71
 
    string _shortName;
 
68
    std::string _longName;
 
69
    std::string _shortName;
72
70
    int _numericName;           // may be NOT_SET
73
71
 
74
72
    OPInfo() : _status(UnknownOPStatus), _numericName(NOT_SET) {}
81
79
  // struct to hold password info
82
80
  struct PWInfo
83
81
  {
84
 
    string _facility;
 
82
    std::string _facility;
85
83
    int _maxPasswdLen;
86
84
  };
87
85
 
101
99
  {
102
100
    bool _active;               // status in the network
103
101
    FacilityClass _cl;          // voice, fax, or data
104
 
    string _number;             // telephone number
105
 
    string _subAddr;            // subaddress
 
102
    std::string _number;             // telephone number
 
103
    std::string _subAddr;            // subaddress
106
104
    int _time;                  // time in the range 1..30 (for NoReplyReason)
107
105
    ForwardReason _reason;      // reason for the forwarding
108
106
  };
109
107
 
110
108
  // SMS types
111
109
  typedef Ref<SMSStore> SMSStoreRef;
112
 
  typedef vector<SMSStoreRef> SMSStoreVector;
 
110
  typedef std::vector<SMSStoreRef> SMSStoreVector;
113
111
 
114
112
  // this class allows access to all functions of a ME/TA as described
115
113
  // in sections 5-8 of ETSI GSM 07.07
123
121
    Ref<GsmAt> _at;             // chat object for the port
124
122
    PhonebookVector _phonebookCache; // cache of all used phonebooks
125
123
    SMSStoreVector _smsStoreCache; // cache of all used phonebooks
126
 
    string _lastPhonebookName;  // remember last phonebook set on ME/TA
127
 
    string _lastSMSStoreName;   // remember last SMS store set on ME/TA
 
124
    std::string _lastPhonebookName;  // remember last phonebook set on ME/TA
 
125
    std::string _lastSMSStoreName;   // remember last SMS store set on ME/TA
128
126
    Capabilities _capabilities; // ME/TA quirks
129
127
    GsmEvent _defaultEventHandler; // default event handler
130
128
                                // see comments in MeTa::init()
131
 
    string _lastCharSet;        // remember last character set
 
129
    std::string _lastCharSet;        // remember last character set
132
130
 
133
131
    // init ME/TA to sensible defaults
134
132
    void init() throw(GsmException);
142
140
 
143
141
    // set the current phonebook in the ME
144
142
    // remember the last phonebook set for optimisation
145
 
    void setPhonebook(string phonebookName) throw(GsmException);
 
143
    void setPhonebook(std::string phonebookName) throw(GsmException);
146
144
 
147
145
    // set the current SMS store in the ME
148
146
    // set storeTypes to
151
149
    //   3 to preferred store for receiving SMS (includes types 1 and 2)
152
150
    // remember the last SMS store set for optimisation
153
151
    // if needResultCode is set this optimisation is not done
154
 
    string setSMSStore(string smsStore, int storeTypes,
 
152
    std::string setSMSStore(std::string smsStore, int storeTypes,
155
153
                       bool needResultCode = false)
156
154
      throw(GsmException);
157
155
 
158
156
    // get current SMS store settings
159
 
    void getSMSStore(string &readDeleteStore,
160
 
                     string &writeSendStore,
161
 
                     string &receiveStore) throw(GsmException);
 
157
    void getSMSStore(std::string &readDeleteStore,
 
158
                     std::string &writeSendStore,
 
159
                     std::string &receiveStore) throw(GsmException);
162
160
 
163
161
    // get capabilities of this ME/TA
164
162
    Capabilities getCapabilities() const {return _capabilities;}
182
180
    MEInfo getMEInfo() throw(GsmException);
183
181
 
184
182
    // return available character sets
185
 
    vector<string> getSupportedCharSets() throw(GsmException);// (+CSCS=?)
 
183
    std::vector<std::string> getSupportedCharSets() throw(GsmException);// (+CSCS=?)
186
184
    
187
185
    // return current character set (default: GSM)
188
 
    string getCurrentCharSet() throw(GsmException);// (+CSCS?)
 
186
    std::string getCurrentCharSet() throw(GsmException);// (+CSCS?)
189
187
 
190
188
    // set character set to use
191
 
    void setCharSet(string charSetName) throw(GsmException);// (+CSCS=)
 
189
    void setCharSet(std::string charSetName) throw(GsmException);// (+CSCS=)
192
190
    
193
191
    // *** ETSI GSM 07.07 Section 6: "Call control commands and methods"
194
192
    
195
193
    // get extended error report
196
 
    string getExtendedErrorReport() throw(GsmException);// (+CEER)
 
194
    std::string getExtendedErrorReport() throw(GsmException);// (+CEER)
197
195
 
198
196
    // dial a number, CLI presentation as defined in network
199
 
    void dial(string number) throw(GsmException);// (ATD)
 
197
    void dial(std::string number) throw(GsmException);// (ATD)
200
198
 
201
199
    // answer
202
200
    void answer() throw(GsmException); // (ATA)
205
203
    void hangup() throw(GsmException); // (ATH)
206
204
    
207
205
    // set Personal Identification Number
208
 
    void setPIN(string number) throw(GsmException);// (+CPIN)
 
206
    void setPIN(std::string number) throw(GsmException);// (+CPIN)
209
207
 
210
208
    // get PIN Status
211
 
    string getPINStatus() throw(GsmException);// (+CPIN?)
 
209
    std::string getPINStatus() throw(GsmException);// (+CPIN?)
212
210
 
213
211
    // *** ETSI GSM 07.07 Section 7: "Network service related commands"
214
212
    
215
213
    // return available network operators
216
214
    // this fills in all fields of OPInfo with the exception of _mode
217
 
    vector<OPInfo> getAvailableOPInfo() throw(GsmException); // (+COPS=?)
 
215
    std::vector<OPInfo> getAvailableOPInfo() throw(GsmException); // (+COPS=?)
218
216
 
219
217
    // return current network operators
220
218
    // this fills in all the fields of OPInfo with the exception of _status
225
223
    // of getCurrentOPInfo() or getAvailableOPInfo()
226
224
    // (because ME/TA might not implement all names)
227
225
    void setCurrentOPInfo(OPModes mode,
228
 
                          string longName = "",
229
 
                          string shortName = "",
 
226
                          std::string longName = "",
 
227
                          std::string shortName = "",
230
228
                          int numericName = NOT_SET) throw(GsmException);
231
229
 
232
230
    // get facility lock capabilities (+CLCK)
233
 
    vector<string> getFacilityLockCapabilities() throw(GsmException);
 
231
    std::vector<std::string> getFacilityLockCapabilities() throw(GsmException);
234
232
 
235
233
    // query facility lock status for named facility
236
 
    bool getFacilityLockStatus(string facility, FacilityClass cl)
 
234
    bool getFacilityLockStatus(std::string facility, FacilityClass cl)
237
235
      throw(GsmException);
238
236
 
239
237
    // lock facility
240
 
    void lockFacility(string facility, FacilityClass cl, string passwd = "")
 
238
    void lockFacility(std::string facility, FacilityClass cl, std::string passwd = "")
241
239
      throw(GsmException);
242
240
 
243
241
    // unlock facility
244
 
    void unlockFacility(string facility, FacilityClass cl, string passwd = "")
 
242
    void unlockFacility(std::string facility, FacilityClass cl, std::string passwd = "")
245
243
      throw(GsmException);
246
244
 
247
245
    // return names of facility for which a password can be set
248
246
    // and the maximum length of the respective password
249
 
    vector<PWInfo> getPasswords() throw(GsmException);// (+CPWD=?)
 
247
    std::vector<PWInfo> getPasswords() throw(GsmException);// (+CPWD=?)
250
248
 
251
249
    // set password for the given facility
252
 
    void setPassword(string facility, string oldPasswd, string newPasswd)
 
250
    void setPassword(std::string facility, std::string oldPasswd, std::string newPasswd)
253
251
      throw(GsmException);
254
252
    // (+CPWD=)
255
253
 
266
264
    // set call forwarding
267
265
    void setCallForwarding(ForwardReason reason,
268
266
                           ForwardMode mode,
269
 
                           string number,
270
 
                           string subaddr,
 
267
                           std::string number,
 
268
                           std::string subaddr,
271
269
                           FacilityClass cl = (FacilityClass)ALL_FACILITIES,
272
270
                           int forwardTime = NOT_SET)
273
271
      throw(GsmException); // (+CCFC=)
318
316
    int getBitErrorRate() throw(GsmException);
319
317
 
320
318
    // get available phone book memory storage strings (+CPBS=?)
321
 
    vector<string> getPhoneBookStrings() throw(GsmException);
 
319
    std::vector<std::string> getPhoneBookStrings() throw(GsmException);
322
320
 
323
321
    // get phone book given the phone book memory storage string
324
 
    PhonebookRef getPhonebook(string phonebookString,
 
322
    PhonebookRef getPhonebook(std::string phonebookString,
325
323
                              bool preload = false) throw(GsmException);
326
324
 
327
325
 
328
326
    // *** ETSI GSM 07.05 SMS functions
329
327
 
330
328
    // return service centre address (+CSCA?)
331
 
    string getServiceCentreAddress() throw(GsmException);
 
329
    std::string getServiceCentreAddress() throw(GsmException);
332
330
 
333
331
    // set service centre address (+CSCA=)
334
 
    void setServiceCentreAddress(string sca) throw(GsmException);
 
332
    void setServiceCentreAddress(std::string sca) throw(GsmException);
335
333
    
336
334
    // return names of available message stores (<mem1>, +CPMS=?)
337
 
    vector<string> getSMSStoreNames() throw(GsmException);
 
335
    std::vector<std::string> getSMSStoreNames() throw(GsmException);
338
336
 
339
337
    // return SMS store given the name
340
 
    SMSStoreRef getSMSStore(string storeName) throw(GsmException);
 
338
    SMSStoreRef getSMSStore(std::string storeName) throw(GsmException);
341
339
 
342
340
    // send a single SMS message
343
341
    void sendSMS(Ref<SMSSubmitMessage> smsMessage) throw(GsmException);
349
347
    // are sent. If concatenatedMessageId is != -1 this is used as the message
350
348
    // ID for concatenated SMS (for this a user data header as defined in
351
349
    // GSM GTS 3.40 is used, the old UDH in the template is overwritten).
352
 
    void sendSMSs(Ref<SMSSubmitMessage> smsTemplate, string text,
 
350
    void sendSMSs(Ref<SMSSubmitMessage> smsTemplate, std::string text,
353
351
                  bool oneSMS = false,
354
352
                  int concatenatedMessageId = -1)
355
353
      throw(GsmException);