aaaa
Dependencies: SeeedStudioTFTv2 TFT_fonts mbed
Fork of Seeed_TFT_Touch_Shield by
Modem.h
- Committer:
- uswickra
- Date:
- 2014-10-25
- Revision:
- 5:c1af1f8fa026
- Child:
- 7:5cf5aeae1954
File content as of revision 5:c1af1f8fa026:
#pragma once #include "mbed.h" #include "SeeedStudioTFTv2.h" extern SeeedStudioTFTv2 TFT; //extern Serial pc; enum GSM_MESSAGE { MESSAGE_RING = 0, MESSAGE_SMS = 1, MESSAGE_ERROR }; #define BUF_SIZE 100 #define SMS_MAX_LENGTH 16 class Modem{ public: Modem(PinName tx, PinName rx, int baudRate,char *default_number); int init(); int call_phone(char* number); void recv_phone(); void hangup_phone(); int send_sms(char* number, char* msg); void recv_sms(char* msg, int msg_size, int index); void get_clck(char* msg, int size); void cls(); Serial serial_modem; Timer timeCnt; int loopHandle(void); char messageBuffer[SMS_MAX_LENGTH]; protected: int sendCmdWaitResp(char* cmd, char* response, int timeout); int write_device(char c); int write_device_str(char* str); bool read_device_ready(); char read_device(); int check_AT(); int check_PIN(); int setup_SMS(); char read_buffer[BUF_SIZE+1]; int buffer_p; void clean_buffer(); void reset_buffer(); private: char* default_number; bool read_trail; void debug_cmd_buffer(); int find_pattern_end(char *pattern, char *buffer, int size); };