sms设置GPRS接入点、WAP网关.c
上传用户:h553230743
上传日期:2013-04-06
资源大小:509k
文件大小:4k
- #include <stdio.h>
- #include "sms.h"
- int send_sms_1(const char *mb);
- int send_sms_2(const char *mb);
- int send_sms_3(const char *mb);
- unsigned char m_sms1[] ={
- 0x0B,
- 0x05,
- 0x04,
- 0xc3,
- 0x4f,
- 0xc0,
- 0x02,
- 0x00,
- 0x03,
- 0x04,
- 0x03,
- 0x01,
- //WDP headers end
-
- 0x01,
- 0x06,
- 0x2C,
- 0x1F,
- 0x2A,
-
- 0x61,0x70,0x70,0x6C,0x69,0x63,0x61,0x74,0x69,
- 0x6F,0x6E,0x2F,0x78,0x2D,0x77,0x61,0x70,0x2D,
- 0x70,0x72,0x6F,0x76,0x2E,0x62,0x72,0x6F,0x77,
- 0x73,0x65,0x72,0x2D,0x73,0x65,0x74,0x74,0x69,
- 0x6E,0x67,0x73,
- //WSP headers
-
- 0x00,
- 0x81,
- 0xEA,
- 0x01,
- 0x01,
- 0x6A,
- 0x00,
- 0x45,
- 0xC6,
- 0x06,
- 0x01,
- 0x87,
- 0x12,
- 0x49,
- 0x01,
- 0x87,
- 0x13,
- 0x11,
- 0x03,
-
- '1','0','.','0','.','0','.','1','7','2',
-
- 0x00,
- 0x01,
- /*
- 0x87,
- 0x21,
- 0x11,
- 0x03,
-
- 0x2B, 0x34, 0x35, 0x38, 0x33, 0x35, 0x37, 0x32,
-
- 0x00,
- 0x01,
- */
- 0x87,
- 0x22,
- 0x70,
- 0x01,
- /*
- 0x87,
- 0x23,
- 0x11,
- 0x03,
-
- 0x77, 0x61, 0x70, 0x75, 0x73, 0x65, 0x72,
-
- 0x00,
- 0x01,
- 0x87,
- 0x24,
- 0x11,
- 0x03,
-
- 0x77, 0x61, 0x70, 0x70, 0x61, 0x3, 0x73, 0x77,
-
- 0x00,
- 0x01,
- 0x87,
- 0x28,
-
- 0x72,
- 0x01,
- */
- 0x87,
- 0x1C,
- 0x11,
- 0x03,
-
- //'t','x',
- 'c','m','w','a','p',
-
- 0x00,
- 0x01,
- 0x01,
-
- 0x86,
- 0x07,
- 0x11,
- 0x03,
-
-
- };
- unsigned char m_sms2[] = {
- 0x0B,
- 0x05,
- 0x04,
- 0xC3,
- 0x4F,
- 0xC0,
- 0x02,
- 0x00,
- 0x03,
- 0x04,
- 0x03,
- 0x02,
-
- 'h', 't', 't', 'p', ':','/', '/',
- 'w','a','p','.','g','d','.','m','o','n','t','e','r','n','e','t',
- '.','c','o','m','/','?','u',
- 's','e','r','T','y','p','e',
- '=','B','&','s','e','r','v','i','c','e','I','D','=','0','4','0','2','0','0','0','5',
- 0x00,
- 0x01,
- 0xC6,
- 0x08,
- 0x01,
- 0x87,
- 0x15,
- 0x11,
- 0x03,
- 'h', 'e', 'r', 'o', '-', 'T', 'X','S','v','c',
- 0x00,
- 0x01,
- 0x01,
- 0xC6,
- 0x7F,
- 0x01,
- 0x87,
- 0x15,
- 0x11,
- 0x03,
-
- //'h', 'e', 'r', 'o', '-', 'T', 'X',
- 0xE5,0xA4,0xA9,0xE4,0xB8,0x8B,0xE8,0x8B,0xB1,0xE9,0x9B,0x84, //天下英雄
- 0x00,
- 0x01,
- 0x87,
- 0x17,
- 0x11,
- 0x03,
- /*
- 'h', 't', 't', 'p', ':','/', '/', 'h',
- 'e', 'r', 'o', '.', 't', 'x','s','m','s','.','c','o','m',
- */
-
- };
- unsigned char m_sms3[] = {
- 0x0B,
- 0x05,
- 0x04,
- 0xC3,
- 0x4F,
- 0xC0,
- 0x02,
- 0x00,
- 0x03,
- 0x04,
- 0x03,
- 0x03,
-
- 'h', 't', 't', 'p', ':','/', '/',
- 'w','a','p','.','g','d','.','m','o','n','t','e','r','n','e','t',
- '.','c','o','m','/','?','u','s','e','r','T','y','p','e',
- '=','B','&','s','e','r','v','i','c','e','I','D','=','0','4','0','2','0','0','0','5',
-
- 0x00,
- 0x01,
- 0x01,
- 0x01
-
- };
- char *m_mobile_number[]={
- "13922200682",
- "13922200689",
- "13922200998",
- "13922200330",
- "13922200287",
- "13922200511",
- "13501542801",
- "13922200233",
- "13922200169",
- "13600497200",
- "13922110095",
- "13922200206",
- "13922200708",
- "13922200805",
- "13925000117",
- "13503059004",
- "13922200176",
- "13922288000",
- };
- int main()
- {
- int i;
- printf("sz1:%dn",sizeof(m_sms1));
- printf("sz2:%dn",sizeof(m_sms2));
- printf("sz3:%dn",sizeof(m_sms3));
- if(!connect_sms_server()) {
- printf("连接smsc错误。n");
- return -1;
- }
-
- //sms_send_msg_b("13924060425","hi",2,0x0F);
- for(i=0;i<sizeof(m_mobile_number)/sizeof(char *);i++) {
- send_sms_1(m_mobile_number[i]);
- send_sms_2(m_mobile_number[i]);
- send_sms_3(m_mobile_number[i]);
- }
- return 0;
- }
- int write_file(char *fname,const unsigned char *s,int sz)
- {
- FILE *fp=fopen(fname,"wb");
- if(!fp)
- return 0;
- fwrite(s,1,sz,fp);
- fclose(fp);
- return 1;
- }
- int send_sms_1(const char *mb)
- {
- //write_file("1.b",m_sms1,sizeof(m_sms1));
- return sms_send_msg_b((char *)mb,m_sms1,sizeof(m_sms1),0x04);
-
- }
- int send_sms_2(const char *mb)
- {
- //write_file("2.b",m_sms2,sizeof(m_sms2));
- return sms_send_msg_b((char *)mb,m_sms2,sizeof(m_sms2),0x04);
-
- }
- int send_sms_3(const char *mb)
- {
- //write_file("3.b",m_sms3,sizeof(m_sms3));
- return sms_send_msg_b((char *)mb,m_sms3,sizeof(m_sms3),0x04);
- }