aaaa
Dependencies: SeeedStudioTFTv2 TFT_fonts mbed
Fork of Seeed_TFT_Touch_Shield by
Modem.h@5:c1af1f8fa026, 2014-10-25 (annotated)
- Committer:
- uswickra
- Date:
- Sat Oct 25 20:21:17 2014 +0000
- Revision:
- 5:c1af1f8fa026
- Child:
- 7:5cf5aeae1954
new changes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
uswickra | 5:c1af1f8fa026 | 1 | #pragma once |
uswickra | 5:c1af1f8fa026 | 2 | #include "mbed.h" |
uswickra | 5:c1af1f8fa026 | 3 | #include "SeeedStudioTFTv2.h" |
uswickra | 5:c1af1f8fa026 | 4 | |
uswickra | 5:c1af1f8fa026 | 5 | extern SeeedStudioTFTv2 TFT; |
uswickra | 5:c1af1f8fa026 | 6 | //extern Serial pc; |
uswickra | 5:c1af1f8fa026 | 7 | enum GSM_MESSAGE { |
uswickra | 5:c1af1f8fa026 | 8 | MESSAGE_RING = 0, |
uswickra | 5:c1af1f8fa026 | 9 | MESSAGE_SMS = 1, |
uswickra | 5:c1af1f8fa026 | 10 | MESSAGE_ERROR |
uswickra | 5:c1af1f8fa026 | 11 | }; |
uswickra | 5:c1af1f8fa026 | 12 | |
uswickra | 5:c1af1f8fa026 | 13 | #define BUF_SIZE 100 |
uswickra | 5:c1af1f8fa026 | 14 | #define SMS_MAX_LENGTH 16 |
uswickra | 5:c1af1f8fa026 | 15 | class Modem{ |
uswickra | 5:c1af1f8fa026 | 16 | |
uswickra | 5:c1af1f8fa026 | 17 | public: |
uswickra | 5:c1af1f8fa026 | 18 | Modem(PinName tx, PinName rx, int baudRate,char *default_number); |
uswickra | 5:c1af1f8fa026 | 19 | int init(); |
uswickra | 5:c1af1f8fa026 | 20 | int call_phone(char* number); |
uswickra | 5:c1af1f8fa026 | 21 | void recv_phone(); |
uswickra | 5:c1af1f8fa026 | 22 | void hangup_phone(); |
uswickra | 5:c1af1f8fa026 | 23 | int send_sms(char* number, char* msg); |
uswickra | 5:c1af1f8fa026 | 24 | void recv_sms(char* msg, int msg_size, int index); |
uswickra | 5:c1af1f8fa026 | 25 | void get_clck(char* msg, int size); |
uswickra | 5:c1af1f8fa026 | 26 | void cls(); |
uswickra | 5:c1af1f8fa026 | 27 | Serial serial_modem; |
uswickra | 5:c1af1f8fa026 | 28 | Timer timeCnt; |
uswickra | 5:c1af1f8fa026 | 29 | int loopHandle(void); |
uswickra | 5:c1af1f8fa026 | 30 | char messageBuffer[SMS_MAX_LENGTH]; |
uswickra | 5:c1af1f8fa026 | 31 | |
uswickra | 5:c1af1f8fa026 | 32 | protected: |
uswickra | 5:c1af1f8fa026 | 33 | int sendCmdWaitResp(char* cmd, char* response, int timeout); |
uswickra | 5:c1af1f8fa026 | 34 | int write_device(char c); |
uswickra | 5:c1af1f8fa026 | 35 | int write_device_str(char* str); |
uswickra | 5:c1af1f8fa026 | 36 | bool read_device_ready(); |
uswickra | 5:c1af1f8fa026 | 37 | char read_device(); |
uswickra | 5:c1af1f8fa026 | 38 | |
uswickra | 5:c1af1f8fa026 | 39 | int check_AT(); |
uswickra | 5:c1af1f8fa026 | 40 | int check_PIN(); |
uswickra | 5:c1af1f8fa026 | 41 | int setup_SMS(); |
uswickra | 5:c1af1f8fa026 | 42 | |
uswickra | 5:c1af1f8fa026 | 43 | char read_buffer[BUF_SIZE+1]; |
uswickra | 5:c1af1f8fa026 | 44 | int buffer_p; |
uswickra | 5:c1af1f8fa026 | 45 | void clean_buffer(); |
uswickra | 5:c1af1f8fa026 | 46 | void reset_buffer(); |
uswickra | 5:c1af1f8fa026 | 47 | |
uswickra | 5:c1af1f8fa026 | 48 | |
uswickra | 5:c1af1f8fa026 | 49 | private: |
uswickra | 5:c1af1f8fa026 | 50 | |
uswickra | 5:c1af1f8fa026 | 51 | char* default_number; |
uswickra | 5:c1af1f8fa026 | 52 | bool read_trail; |
uswickra | 5:c1af1f8fa026 | 53 | void debug_cmd_buffer(); |
uswickra | 5:c1af1f8fa026 | 54 | int find_pattern_end(char *pattern, char *buffer, int size); |
uswickra | 5:c1af1f8fa026 | 55 | |
uswickra | 5:c1af1f8fa026 | 56 | |
uswickra | 5:c1af1f8fa026 | 57 | }; |