aaa
Dependencies: SeeedStudioTFTv2 TFT_fonts mbed
Fork of Seeed_TFT_Touch_Shield by
Diff: main.cpp
- Revision:
- 9:1efb9e26fbeb
- Parent:
- 8:5e8c0b37bcf9
--- a/main.cpp Sat Oct 25 20:28:50 2014 +0000 +++ b/main.cpp Sun Oct 26 00:56:52 2014 +0000 @@ -339,7 +339,7 @@ TFT.printf("TEXT"); TFT.circle(180,240,50,Maroon); - while(!(strcmp(cmd, "Call") == 0)) + while((strcmp(cmd, "Back") == 0) || cmd == NULL) { if (TFT.getTouch(p) == TFT.YES) { @@ -348,24 +348,16 @@ if(p.y >= 1500 && p.y <= 3800) { //call - cmd = "Ring"; - break; + cmd = "Call"; } else if(p.y >= 4500 && p.y <= 7100) { //text cmd = "Text"; - break; } - } } - else if(strcmp(cmd, "Ring") == 0 || strcmp(cmd, "RecvM") == 0) - { - break; - } } - if(strcmp(cmd, "Call") == 0) { initKeypad(); @@ -630,9 +622,44 @@ } else if(strcmp(cmd, "RecvM") == 0) { - - //display msg - //back on button press + TFT.background(White); + TFT.foreground(Blue); + TFT.set_font((unsigned char*) Arial24x23); + char *start_pos, *end_pos, *msg_pos; + start_pos = strstr(recv_msgbuffer,"+CMT: \""); + char txtnum[20]; + gsm.cleanBuffer(txtnum,20); + char recv_msg[140]; + gsm.cleanBuffer(recv_msg,140); + start_pos += 7; + if(strstr(start_pos,"\",") != NULL) + { + end_pos = strstr(start_pos,"\","); + strncpy(txtnum,start_pos,(end_pos - start_pos)); + TFT.locate(0,5); + TFT.printf("\r\nFrom: %s \r\n",txtnum); + } + if(strstr(start_pos,"\n") != NULL) + { + msg_pos = strstr(start_pos,"\n"); + if(strstr(msg_pos+1,"\n") != NULL) + { + end_pos = strstr(msg_pos+1,"\n"); + strncpy(recv_msg,msg_pos+1,(end_pos - msg_pos - 1)); + TFT.locate(0,100); + TFT.printf("Message: %s\r\n",recv_msg); + } + } + TFT.line(0,270,240,270,Red); + TFT.foreground(Blue); + TFT.locate(60,280); + TFT.set_font((unsigned char*) Arial24x23); + TFT.printf("OK"); + while(strcmp(cmd, "RecvM") == 0) + { + if(TFT.getTouch(p) == TFT.YES && p.x >= 6300 && p.x <= 7250) + cmd = "Back"; + } } } }