⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gsm_sms.h

📁 对各种手机进行编程的工具包源码gsmlib 1.9版本。
💻 H
📖 第 1 页 / 共 2 页
字号:
// *************************************************************************// * GSM TA/ME library// *// * File:    gsm_sms.h// *// * Purpose: SMS functions// *          (ETSI GSM 07.05)// *// * Author:  Peter Hofmann (software@pxh.de)// *// * Created: 16.5.1999// *************************************************************************#ifndef GSM_SMS_H#define GSM_SMS_H#include <gsmlib/gsm_sms_codec.h>#include <gsmlib/gsm_error.h>#include <gsmlib/gsm_util.h>#include <gsmlib/gsm_at.h>#include <string>#include <vector>using namespace std;namespace gsmlib{  // forward declarations  class SMSStore;  class SMSMessage;  // this class represents a single SMS message  class SMSMessage : public RefBase  {  private:    Ref<GsmAt> _at;             // connection to the device  public:    // possible values for message type indicator    enum MessageType {SMS_DELIVER = 0, SMS_DELIVER_REPORT = 0,                      SMS_STATUS_REPORT = 2, SMS_COMMAND = 2,                      SMS_SUBMIT = 1, SMS_SUBMIT_REPORT = 1};  protected:    // fields of the different TPDUs    // all PDUs    string _userData;    UserDataHeader _userDataHeader;    Address _serviceCentreAddress;    MessageType _messageTypeIndicator;// 2 bits    DataCodingScheme _dataCodingScheme;  public:    // decode hexadecimal pdu string    // return SMSMessage of the appropriate type    // differentiate between SMS transfer directions SC to ME, ME to SC    // also give GsmAt object for send()    static Ref<SMSMessage> decode(string pdu,                                  bool SCtoMEdirection = true,                                  GsmAt *at = NULL)      throw(GsmException);    static Ref<SMSMessage> decode(istream& s) throw(GsmException);    // encode pdu, return hexadecimal pdu string    virtual string encode() = 0;    // send this PDU    // returns message reference and ACK-PDU (if requested)    // only applicate to SMS-SUBMIT and SMS-COMMAND    unsigned char send(Ref<SMSMessage> &ackPdu) throw(GsmException);        // same as above, but ACK-PDU is discarded    unsigned char send() throw(GsmException);    // create textual representation of SMS    virtual string toString() const = 0;    // return deep copy of this message    virtual Ref<SMSMessage> clone() = 0;    // return length of SC address when encoded    unsigned int getSCAddressLen();    // accessor functions    MessageType messageType() const {return _messageTypeIndicator;}    Address serviceCentreAddress() const {return _serviceCentreAddress;}    // provided for sorting messages by timestamp    virtual Timestamp serviceCentreTimestamp() const {return Timestamp();}        // return recipient, destination etc. address (for sorting by address)    virtual Address address() const = 0;    virtual void setUserData(string x) {_userData = x;}    virtual string userData() const {return _userData;}        // return the size of user data (including user data header)    unsigned char userDataLength() const;    // accessor functions    virtual void setUserDataHeader(UserDataHeader x) {_userDataHeader = x;}    virtual UserDataHeader userDataHeader() const {return _userDataHeader;}        virtual DataCodingScheme dataCodingScheme() const      {return _dataCodingScheme;}    virtual void setDataCodingScheme(DataCodingScheme x)      {_dataCodingScheme = x;}    void setServiceCentreAddress(Address &x) {_serviceCentreAddress = x;}    void setAt(Ref<GsmAt> at) {_at = at;}    virtual ~SMSMessage();    // print ASCII hex representation of message    ostream& operator<<(ostream& s);    // copy constructor and assignment//     SMSMessage(SMSMessage &m);//     SMSMessage &operator=(SMSMessage &m);    friend class SMSStore;  };  // SMS-DELIVER TPDU  class SMSDeliverMessage : public SMSMessage  {  private:    // SMS-DELIVER PDU members (see GSM 03.40 section 9.2.2.1)    bool _moreMessagesToSend;    bool _replyPath;    bool _statusReportIndication;    Address _originatingAddress;    unsigned char _protocolIdentifier; // octet    Timestamp _serviceCentreTimestamp;    // initialize members to sensible values    void init();      public:    // constructor, sets sensible default values    SMSDeliverMessage();    // constructor with given pdu    SMSDeliverMessage(string pdu) throw(GsmException);    // encode pdu, return hexadecimal pdu string    virtual string encode();    // create textual representation of SMS    virtual string toString() const;    // inherited from SMSMessage    Address address() const;    Ref<SMSMessage> clone();    // accessor functions    bool moreMessagesToSend() const {return _moreMessagesToSend;}    bool replyPath() const {return _replyPath;}    bool statusReportIndication() const {return _statusReportIndication;}    Address originatingAddress() const {return _originatingAddress;}    unsigned char protocolIdentifier() const {return _protocolIdentifier;}    Timestamp serviceCentreTimestamp() const {return _serviceCentreTimestamp;}    void setMoreMessagesToSend(bool x) {_moreMessagesToSend = x;}    void setReplyPath(bool x) {_replyPath = x;}    void setStatusReportIndication(bool x) {_statusReportIndication = x;}    void setOriginatingAddress(Address &x) {_originatingAddress = x;}    void setProtocolIdentifier(unsigned char x) {_protocolIdentifier = x;}    void setServiceCentreTimestamp(Timestamp &x) {_serviceCentreTimestamp = x;}    virtual ~SMSDeliverMessage() {}  };  // SMS-SUBMIT TPDU  class SMSSubmitMessage : public SMSMessage  {  private:    // SMS-SUBMIT PDU (see GSM 03.40 section 9.2.2.2)    bool _rejectDuplicates;    TimePeriod::Format _validityPeriodFormat; // 2 bits    bool _replyPath;    bool _statusReportRequest;    unsigned char _messageReference; // integer    Address _destinationAddress;    unsigned char _protocolIdentifier;    TimePeriod _validityPeriod;    // initialize members to sensible values    void init();      public:    // constructor, sets sensible default values    SMSSubmitMessage();    // constructor with given pdu    SMSSubmitMessage(string pdu) throw(GsmException);    // convenience constructor    // given the text and recipient telephone number    SMSSubmitMessage(string text, string number);    // encode pdu, return hexadecimal pdu string    virtual string encode();    // create textual representation of SMS    virtual string toString() const;    // inherited from SMSMessage    Address address() const;    Ref<SMSMessage> clone();    // accessor functions    bool rejectDuplicates() const {return _rejectDuplicates;}    TimePeriod::Format validityPeriodFormat() const      {return _validityPeriodFormat;}    bool replyPath() const {return _replyPath;}    bool statusReportRequest() const {return _statusReportRequest;}    unsigned char messageReference() const {return _messageReference;}    Address destinationAddress() const {return _destinationAddress;}    unsigned char protocolIdentifier() const {return _protocolIdentifier;}    TimePeriod validityPeriod() const {return _validityPeriod;}    void setRejectDuplicates(bool x) {_rejectDuplicates = x;}    void setValidityPeriodFormat(TimePeriod::Format &x)      {_validityPeriodFormat = x;}    void setReplyPath(bool x) {_replyPath = x;}    void setStatusReportRequest(bool x) {_statusReportRequest = x;}    void setMessageReference(unsigned char x) {_messageReference = x;}    void setDestinationAddress(Address &x) {_destinationAddress = x;}    void setProtocolIdentifier(unsigned char x) {_protocolIdentifier = x;}    void setValidityPeriod(TimePeriod &x) {_validityPeriod = x;}        virtual ~SMSSubmitMessage() {}  };  // SMS-STATUS-REPORT TPDU  class SMSStatusReportMessage : public SMSMessage  {  private:    // SMS-STATUS-REPORT PDU (see GSM 03.40 section 9.2.2.3)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -