aaaa
Dependencies: SeeedStudioTFTv2 TFT_fonts mbed
Fork of Seeed_TFT_Touch_Shield by
Modem.h@7:5cf5aeae1954, 2014-10-25 (annotated)
- Committer:
- uswickra
- Date:
- Sat Oct 25 21:55:05 2014 +0000
- Revision:
- 7:5cf5aeae1954
- Parent:
- 5:c1af1f8fa026
- Child:
- 11:575dfd388778
interrupt handler
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 | 7:5cf5aeae1954 | 8 | MESSAGE_NONE = 0 , |
uswickra | 7:5cf5aeae1954 | 9 | MESSAGE_RING = 1, |
uswickra | 7:5cf5aeae1954 | 10 | MESSAGE_SMS = 2, |
uswickra | 5:c1af1f8fa026 | 11 | MESSAGE_ERROR |
uswickra | 5:c1af1f8fa026 | 12 | }; |
uswickra | 5:c1af1f8fa026 | 13 | |
uswickra | 5:c1af1f8fa026 | 14 | #define BUF_SIZE 100 |
uswickra | 5:c1af1f8fa026 | 15 | #define SMS_MAX_LENGTH 16 |
uswickra | 5:c1af1f8fa026 | 16 | class Modem{ |
uswickra | 5:c1af1f8fa026 | 17 | |
uswickra | 5:c1af1f8fa026 | 18 | public: |
uswickra | 5:c1af1f8fa026 | 19 | Modem(PinName tx, PinName rx, int baudRate,char *default_number); |
uswickra | 5:c1af1f8fa026 | 20 | int init(); |
uswickra | 5:c1af1f8fa026 | 21 | int call_phone(char* number); |
uswickra | 5:c1af1f8fa026 | 22 | void recv_phone(); |
uswickra | 5:c1af1f8fa026 | 23 | void hangup_phone(); |
uswickra | 5:c1af1f8fa026 | 24 | int send_sms(char* number, char* msg); |
uswickra | 5:c1af1f8fa026 | 25 | void recv_sms(char* msg, int msg_size, int index); |
uswickra | 5:c1af1f8fa026 | 26 | void get_clck(char* msg, int size); |
uswickra | 5:c1af1f8fa026 | 27 | void cls(); |
uswickra | 5:c1af1f8fa026 | 28 | Serial serial_modem; |
uswickra | 5:c1af1f8fa026 | 29 | Timer timeCnt; |
uswickra | 5:c1af1f8fa026 | 30 | int loopHandle(void); |
uswickra | 5:c1af1f8fa026 | 31 | char messageBuffer[SMS_MAX_LENGTH]; |
uswickra | 7:5cf5aeae1954 | 32 | char messageCopyBuffer[SMS_MAX_LENGTH]; |
uswickra | 7:5cf5aeae1954 | 33 | int updateBuffer(char c); |
uswickra | 7:5cf5aeae1954 | 34 | int mIndex ; |
uswickra | 7:5cf5aeae1954 | 35 | int mTypeState ; |
uswickra | 5:c1af1f8fa026 | 36 | |
uswickra | 5:c1af1f8fa026 | 37 | protected: |
uswickra | 5:c1af1f8fa026 | 38 | int sendCmdWaitResp(char* cmd, char* response, int timeout); |
uswickra | 5:c1af1f8fa026 | 39 | int write_device(char c); |
uswickra | 5:c1af1f8fa026 | 40 | int write_device_str(char* str); |
uswickra | 5:c1af1f8fa026 | 41 | bool read_device_ready(); |
uswickra | 5:c1af1f8fa026 | 42 | char read_device(); |
uswickra | 5:c1af1f8fa026 | 43 | |
uswickra | 5:c1af1f8fa026 | 44 | int check_AT(); |
uswickra | 5:c1af1f8fa026 | 45 | int check_PIN(); |
uswickra | 5:c1af1f8fa026 | 46 | int setup_SMS(); |
uswickra | 5:c1af1f8fa026 | 47 | |
uswickra | 5:c1af1f8fa026 | 48 | char read_buffer[BUF_SIZE+1]; |
uswickra | 5:c1af1f8fa026 | 49 | int buffer_p; |
uswickra | 5:c1af1f8fa026 | 50 | void clean_buffer(); |
uswickra | 5:c1af1f8fa026 | 51 | void reset_buffer(); |
uswickra | 5:c1af1f8fa026 | 52 | |
uswickra | 5:c1af1f8fa026 | 53 | |
uswickra | 5:c1af1f8fa026 | 54 | private: |
uswickra | 5:c1af1f8fa026 | 55 | |
uswickra | 5:c1af1f8fa026 | 56 | char* default_number; |
uswickra | 5:c1af1f8fa026 | 57 | bool read_trail; |
uswickra | 5:c1af1f8fa026 | 58 | void debug_cmd_buffer(); |
uswickra | 5:c1af1f8fa026 | 59 | int find_pattern_end(char *pattern, char *buffer, int size); |
uswickra | 5:c1af1f8fa026 | 60 | |
uswickra | 5:c1af1f8fa026 | 61 | |
uswickra | 5:c1af1f8fa026 | 62 | }; |