Integrating the ublox LISA C200 modem
Fork of SprintUSBModemHTTPClientTest by
SprintUSBModem/sms/SMSInterface.h@5:3f93dd1d4cb3, 2013-09-26 (annotated)
- Committer:
- sam_grove
- Date:
- Thu Sep 26 00:44:20 2013 -0500
- Revision:
- 5:3f93dd1d4cb3
Exported program and replaced contents of the repo with the source
to build and debug using keil mdk. Libs NOT upto date are lwip, lwip-sys
and socket. these have newer versions under mbed_official but were starting
from a know working point
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove | 5:3f93dd1d4cb3 | 1 | /* SMSInterface.h */ |
sam_grove | 5:3f93dd1d4cb3 | 2 | /* Copyright (C) 2012 mbed.org, MIT License |
sam_grove | 5:3f93dd1d4cb3 | 3 | * |
sam_grove | 5:3f93dd1d4cb3 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
sam_grove | 5:3f93dd1d4cb3 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
sam_grove | 5:3f93dd1d4cb3 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
sam_grove | 5:3f93dd1d4cb3 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
sam_grove | 5:3f93dd1d4cb3 | 8 | * furnished to do so, subject to the following conditions: |
sam_grove | 5:3f93dd1d4cb3 | 9 | * |
sam_grove | 5:3f93dd1d4cb3 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
sam_grove | 5:3f93dd1d4cb3 | 11 | * substantial portions of the Software. |
sam_grove | 5:3f93dd1d4cb3 | 12 | * |
sam_grove | 5:3f93dd1d4cb3 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
sam_grove | 5:3f93dd1d4cb3 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
sam_grove | 5:3f93dd1d4cb3 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
sam_grove | 5:3f93dd1d4cb3 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
sam_grove | 5:3f93dd1d4cb3 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
sam_grove | 5:3f93dd1d4cb3 | 18 | */ |
sam_grove | 5:3f93dd1d4cb3 | 19 | |
sam_grove | 5:3f93dd1d4cb3 | 20 | #ifndef SMSINTERFACE_H_ |
sam_grove | 5:3f93dd1d4cb3 | 21 | #define SMSINTERFACE_H_ |
sam_grove | 5:3f93dd1d4cb3 | 22 | |
sam_grove | 5:3f93dd1d4cb3 | 23 | #include "core/fwk.h" |
sam_grove | 5:3f93dd1d4cb3 | 24 | |
sam_grove | 5:3f93dd1d4cb3 | 25 | #include "rtos.h" |
sam_grove | 5:3f93dd1d4cb3 | 26 | |
sam_grove | 5:3f93dd1d4cb3 | 27 | #include "at/ATCommandsInterface.h" |
sam_grove | 5:3f93dd1d4cb3 | 28 | |
sam_grove | 5:3f93dd1d4cb3 | 29 | #define MAX_SM 8 |
sam_grove | 5:3f93dd1d4cb3 | 30 | |
sam_grove | 5:3f93dd1d4cb3 | 31 | /** Component to use the Short Messages Service (SMS) |
sam_grove | 5:3f93dd1d4cb3 | 32 | * |
sam_grove | 5:3f93dd1d4cb3 | 33 | */ |
sam_grove | 5:3f93dd1d4cb3 | 34 | class SMSInterface : protected IATCommandsProcessor |
sam_grove | 5:3f93dd1d4cb3 | 35 | { |
sam_grove | 5:3f93dd1d4cb3 | 36 | public: |
sam_grove | 5:3f93dd1d4cb3 | 37 | /** Create SMSInterface instance |
sam_grove | 5:3f93dd1d4cb3 | 38 | @param pIf Pointer to the ATCommandsInterface instance to use |
sam_grove | 5:3f93dd1d4cb3 | 39 | */ |
sam_grove | 5:3f93dd1d4cb3 | 40 | SMSInterface(ATCommandsInterface* pIf); |
sam_grove | 5:3f93dd1d4cb3 | 41 | |
sam_grove | 5:3f93dd1d4cb3 | 42 | /** Initialize interface |
sam_grove | 5:3f93dd1d4cb3 | 43 | Configure SMS commands & register for SMS-related unsolicited result codes |
sam_grove | 5:3f93dd1d4cb3 | 44 | */ |
sam_grove | 5:3f93dd1d4cb3 | 45 | int init(); |
sam_grove | 5:3f93dd1d4cb3 | 46 | |
sam_grove | 5:3f93dd1d4cb3 | 47 | /** Send a SM |
sam_grove | 5:3f93dd1d4cb3 | 48 | @param number The receiver's phone number |
sam_grove | 5:3f93dd1d4cb3 | 49 | @param message The message to send |
sam_grove | 5:3f93dd1d4cb3 | 50 | @return 0 on success, error code on failure |
sam_grove | 5:3f93dd1d4cb3 | 51 | */ |
sam_grove | 5:3f93dd1d4cb3 | 52 | int send(const char* number, const char* message); |
sam_grove | 5:3f93dd1d4cb3 | 53 | |
sam_grove | 5:3f93dd1d4cb3 | 54 | |
sam_grove | 5:3f93dd1d4cb3 | 55 | /** Receive a SM |
sam_grove | 5:3f93dd1d4cb3 | 56 | @param number Pointer to a buffer to store the sender's phone number (must be at least 17 characters-long, including the space for the null-terminating char) |
sam_grove | 5:3f93dd1d4cb3 | 57 | @param message Pointer to a buffer to store the the incoming message |
sam_grove | 5:3f93dd1d4cb3 | 58 | @param maxLength Maximum message length that can be stored in buffer (including null-terminating character) |
sam_grove | 5:3f93dd1d4cb3 | 59 | @return 0 on success, error code on failure |
sam_grove | 5:3f93dd1d4cb3 | 60 | */ |
sam_grove | 5:3f93dd1d4cb3 | 61 | int get(char* number, char* message, size_t maxLength); |
sam_grove | 5:3f93dd1d4cb3 | 62 | |
sam_grove | 5:3f93dd1d4cb3 | 63 | |
sam_grove | 5:3f93dd1d4cb3 | 64 | /** Get the number of SMs in the incoming box |
sam_grove | 5:3f93dd1d4cb3 | 65 | @param pCount pointer to store the number of unprocessed SMs on |
sam_grove | 5:3f93dd1d4cb3 | 66 | @return 0 on success, error code on failure |
sam_grove | 5:3f93dd1d4cb3 | 67 | */ |
sam_grove | 5:3f93dd1d4cb3 | 68 | int getCount(size_t* pCount); |
sam_grove | 5:3f93dd1d4cb3 | 69 | |
sam_grove | 5:3f93dd1d4cb3 | 70 | protected: |
sam_grove | 5:3f93dd1d4cb3 | 71 | //IATCommandsProcessor |
sam_grove | 5:3f93dd1d4cb3 | 72 | virtual int onNewATResponseLine(ATCommandsInterface* pInst, const char* line); |
sam_grove | 5:3f93dd1d4cb3 | 73 | virtual int onNewEntryPrompt(ATCommandsInterface* pInst); |
sam_grove | 5:3f93dd1d4cb3 | 74 | |
sam_grove | 5:3f93dd1d4cb3 | 75 | int updateInbox(); //Update messages count in the different inboxes |
sam_grove | 5:3f93dd1d4cb3 | 76 | |
sam_grove | 5:3f93dd1d4cb3 | 77 | private: |
sam_grove | 5:3f93dd1d4cb3 | 78 | ATCommandsInterface* m_pIf; |
sam_grove | 5:3f93dd1d4cb3 | 79 | |
sam_grove | 5:3f93dd1d4cb3 | 80 | //Current message |
sam_grove | 5:3f93dd1d4cb3 | 81 | char* m_msg; |
sam_grove | 5:3f93dd1d4cb3 | 82 | size_t m_maxMsgLength; |
sam_grove | 5:3f93dd1d4cb3 | 83 | char* m_msisdn; |
sam_grove | 5:3f93dd1d4cb3 | 84 | |
sam_grove | 5:3f93dd1d4cb3 | 85 | //Messages list |
sam_grove | 5:3f93dd1d4cb3 | 86 | size_t m_msgInListsCount[4]; //4 lists |
sam_grove | 5:3f93dd1d4cb3 | 87 | |
sam_grove | 5:3f93dd1d4cb3 | 88 | size_t m_headersToRead; |
sam_grove | 5:3f93dd1d4cb3 | 89 | |
sam_grove | 5:3f93dd1d4cb3 | 90 | enum { SMS_NONE, SMS_SENT, SMS_PENDING, SMS_FAILED } m_txState; |
sam_grove | 5:3f93dd1d4cb3 | 91 | enum { SMS_IDLE, SMS_SEND_CMD_SENT, SMS_GET_TX_STATUS_CMD_SENT, SMS_GET_CMD_SENT, SMS_GET_HDR_RECEIVED, SMS_GET_COUNT_CMD_SENT, SMS_CMD_PROCESSED } m_state; |
sam_grove | 5:3f93dd1d4cb3 | 92 | }; |
sam_grove | 5:3f93dd1d4cb3 | 93 | |
sam_grove | 5:3f93dd1d4cb3 | 94 | #endif /* SMSINTERFACE_H_ */ |