/*ÏÈÊdzõʼ»¯ÒÔ¼°Ò»Ð©È·ÈϹ¤×÷*/
AT+CPIN?//Ê×ÏÈҪȷ±£ SIM ¿¨µÄ PIN ÂëÒѽ⡣
+CPIN:READY//Õâ±íÃ÷ SIM ¿¨µÄ PIN ÂëÒѽ⡣
OK
AT+CREG?//È·ÈÏÕÒÍø³É¹¦
+CREG: 0,1//Õâ±íÃ÷ÕÒÍø³É¹¦£¬Èç¹ûûÓгɹ¦£¬¼ÌÐøÖ´ÐÐÃüÁî AT+CREG?²é
ѯ¡£ÕâÀïÒ²¿ÉÒÔͨ¹ýÔÚ¿ªÊ¼Ê±ÉèÖÃÃüÁî AT+CREG=1 ´ò¿ªÍøÂç״̬±ä»»Ê±µÄ×Ô¶¯Éϱ¨¡£ÕâÑù£¬µÈ´ý+CREG:1 »ò+CERG:5 µÄ×Ô¶¯Éϱ¨¾Í¿ÉÒÔÁË¡£
OK
AT+CGATT?//²éѯ GPRS ¸½×ÅÊÇ·ñ³É¹¦
+CGATT: 1//Õâ±íÃ÷ GPRS ¸½×ųɹ¦£¬Èç¹ûûÓгɹ¦£¬ÐèÒª¼ÌÐøÖ´ÐÐÃüÁî
AT+CGATT?²éѯ¡£¶ÔÓÚ GPRS ÊÇ·ñ¸½×ŵÄÅжÏÒ²¿ÉÒÔͨ¹ýÔÚ¿ª»úʱִÐÐÃüÁî AT+CGREG=1£¬È»ºóµÈ´ý+CGREG:1 »ò+CGREG:5µÄ×Ô¶¯Éϱ¨¡£
OK
AT+QIFGCNT=0//½« Context 0 ÉèΪǰ̨ Context¡£´ËºóµÄÏà¹Ø²Ù×ö¶¼ÊÇÕë¶Ô
Context 0 ½øÐвÙ×÷
OK
AT+QICSGP=1,"CMNET"//ÉèÖÃGPRS µÄAPN¡£Èç¹ûÊÇʹÓÃÖйúÒƶ¯»òÖйúÁªÍ¨µÄSIM ¿¨£¬²¢Í¨¹ý GPRS ½¨Á¢ TCP Á¬½Ó£¬ÔòÕâÌõÃüÁî¿ÉÒÔÊ¡µô¡£
OK
/*ÒÔÉ϶¼Êdzõʼ»¯¹¤×÷£¬ ½¨ÒéÔÚ½¨Á¢ TCP Á¬½Ó֮ǰÏÈ×öÉÏÃæµÄ³õʼ×÷¡£
*/ AT+QIOPEN="TCP","116.226.39.202","7007"// Á¬½ÓÒ»¸ö TCP ·þÎñÆ÷¡£ µØÖ·ÊÇ 116.226.39.202:7007
OK//ÕâÀïÈç¹û·µ»Ø ERROR µÄ»°£¬¿ÉÄÜÓÐÁ½¸öÔÒò¡£1¡¢ÃüÁî¸ñʽ²»¶Ô£¬Èç¹ûËùÓÐÊý¾Ý¸ñʽ¶¼¶Ô£¬ÐèÒª¿´¿´ QIMUX ÊDz»ÊÇÉèΪ 0 ÁË¡£2¡¢µ±Ç°µÄ TCPIP ·þÎñµÄ״̬²»ÊÇ IP INITIAL »òIP STATUS »ò IP CLOSE¡£ÕâÀﻹÓпÉÄÜÓÐÊä³ö"ALREADY CONNECT"£¬Õâ±íÃ÷ÒѾ½¨Á¢ÁËÒ»¸ö TCP Á¬½Ó»ò UDP Á¬½Ó¡£
CONNECT OK//TCP Á¬½Ó³É¹¦¡£Èç¹ûÕâ¸öλÖ÷µ»Ø CONNECT FAIL£¬×îºÃµÄ´¦Àí·½·¨ÈçÏ£ºÊ×ÏÈ£¬Ö´ÐÐÃüÁî AT+QISTAT ²éѯµ±Ç°µÄ״̬£¬ Èç¹ûµ±Ç°×´Ì¬Îª TCP CONNECTING£¬½¨Òéͨ¹ý AT+QICLOSE ¹Ø±Õµ±Ç°Ê§°ÜµÄÁ¬½Ó£¬ÕâÑù¿ÉÒÔ±£³Ö GPRS ÈÔÈ»´¦ÓÚ¼¤»î״̬£¬²»ÓÃÖØÆô
GPRS£¬ÒÔÌá¸ß³ÌÐòÔËÐеÄËٶȡ£Èç¹ûµ±Ç°×´Ì¬²»ÊÇ TCP CONNECTING£¬½¨ÒéÖ´ÐÐÃüÁî
AT+QIDEACT Ö±½Ó¹Ø±Õµ±Ç°µÄGPRS ³¡¾°£¨ÒòΪÔÚÕâЩ״̬Ï£¬Í¨³£ÊÇÒòΪ GPRS ³¡¾°¼¤»îʧ°ÜËùÖ£©¡£ÕâÌõÃüÁîÀíÂÛÉÏ×µÄµÈ´ýʱ¼ä´ó¸ÅÔÚ 2 ·Ö°ëµ½ 3 ·Ö°ë¡£¿Í»§ÔÚʵ¼ÊÓ¦ÓÃÖÐÒ²
¿ÉÒÔ¸ù¾Ýʵ¼ÊÇé¿öÉèÖÃÒ»¸öСÓÚ 2 ·ÖÖӵij¬Ê±Ê±¼ä£¬³¬Ê±ºóµÄ´¦Àí·½·¨ºÍÊÕµ½ CONENCT
FAIL Ö®ºóµÄ´¦Àí·½·¨Ò»Ñù¡£
/*ͬÑù£¬Ä£¿éÒ²Ö§³Ö UDP ·½Ê½£¬ÔÚʹÓà UDP ·½Ê½Ö®Ç°£¬ÏÈÒª½¨Á¢ UDP Á¬½Ó¡£·½Ê½ºÍ½¨Á¢
TCP Á¬½ÓÒ»Ñù¡£*/
AT+QIOPEN="UDP","116.226.39.202","7007" // Á¬½ÓÒ»¸ö UDP ·þÎñÆ÷¡£µØÖ·ÊÇ
116.226.39.202:7007
OK
CONNECT OK//UDP Á¬½Ó³É¹¦¡£Êµ¼ÊÉÏ UDP ·½Ê½²¢²»Óý¨Á¢Á¬½Ó£¬ÕâÀïÆäʵֻÊÇÉèÖÃÁ˽ÓÏÂÀ´ÐèÒª·¢ËÍ
UDP Êý¾ÝµÄÄ¿±êµØÖ·ºÍ¶Ë¿Ú¡£