Esempio n. 1
0
File: gprs.c Progetto: sundhhy/dtu
static void S_GSM_CHAR_MODE_S()
{
    if((buf_uart3.buf[2]=='O')&&(buf_uart3.buf[3]=='K'))
    {
        PUT("S_GSM_CHAR_MODE_S OK \r\n");
        clear_buf_uart3();
        current_status = GSM_CHAR_MODE_S;
        uart_string_send(GSM_CHAR_MODE);
    }
    else
    {
        PUT("S_GSM_CHAR_MODE_S NO \r\n");
        clear_buf_uart3();
        uart_string_send(GSM_MSG_MODE);
    }
}
Esempio n. 2
0
/***** Public *****/
void speakjet_init(void)
{
    /* Set up Speakjet signal pins */
    DDRB &= ~( _BV(SPEAKJET_READY) | _BV(SPEAKJET_SPEAKING) );

    uart_string_send(init_voice);
}
Esempio n. 3
0
File: gprs.c Progetto: sundhhy/dtu
static void S_TCPIP_BJ_ADDR()
{
    clear_buf_uart3();
    current_status = TCPIP_CONNECT ;
    uart_string_send(GPRS_BJ_ADDR);		  //获取本地IP地址
    PUT_2("S_TCPIP_BJ_ADDR\r\n");
}
Esempio n. 4
0
/***** Private *****/
static void phrase_speak(uint8_t const * const phrase[], uint8_t phrase_length)
{
    int i;
    for (i = 0; i < phrase_length; ++i)
    {
        uart_string_send(phrase[i]);
    }
}
Esempio n. 5
0
File: gprs.c Progetto: sundhhy/dtu
static void S_START_OPEN_GPRS_S()               //开始GPRS 检测SIM卡先
{
    PUT_2("S_START_OPEN_GPRS_S OK \r\n");

    clear_buf_uart3();
    current_status = GPRS_DEF_PDP_S ;           //定义PDP移动场景
    uart_string_send(SIMCARD_CMD);
}
Esempio n. 6
0
File: gprs.c Progetto: sundhhy/dtu
static void S_GSM_INIT0()
{

    PUT_2("S_GSM_INIT0 \r\n");
    clear_buf_uart3();
    uart_string_send(ATE0_CMD);		  //关闭回显
    current_status = RST ;
}
Esempio n. 7
0
File: gprs.c Progetto: sundhhy/dtu
static void S_GSM_MSG_MODE_S()
{

    PUT("S_GSM_MSG_MODE_S OK \r\n");
    clear_buf_uart3();
    current_status = GSM_MSG_MODE_S ;           //定义PDP移动场景
    uart_string_send(GSM_MSG_MODE);

}
Esempio n. 8
0
File: gprs.c Progetto: sundhhy/dtu
static void S_GPRS_ACT_PDP_S()                  //判断定义PDP 激活PDP
{
    if((buf_uart3.buf[2]=='O')&&(buf_uart3.buf[3]=='K'))
    {
        PUT_2("S_GPRS_DEF_PDP_S OK \r\n");
        clear_buf_uart3();
        current_status = GPRS_ACT_PDP_S_RET ;       // 发送激活
        uart_string_send(GPRS_ACT_PDP);
    }
    else
    {
        PUT_2("S_GPRS_DEF_PDP_S NO \r\n");

        clear_buf_uart3();
        uart_string_send(GPRS_DEF_PDP);			//接入点

    }
}
Esempio n. 9
0
File: gprs.c Progetto: sundhhy/dtu
static void S_GPRS_DEF_PDP_S()                  //检测SIM卡 定义PDP
{
    char *t = NULL ;

    t = strstr((const char*)buf_uart3.buf,"OK");
    if(t)
    {
        PUT_2("SIMCARD_CMD OK \r\n");
        clear_buf_uart3();
        current_status = GPRS_ACT_PDP_S ;
        uart_string_send(GPRS_DEF_PDP);
    }
    else
    {
        PUT_2("SIMCARD_CMD NO \r\n");
        clear_buf_uart3();
        uart_string_send(SIMCARD_CMD);
    }
}
Esempio n. 10
0
File: gprs.c Progetto: sundhhy/dtu
static void S_SIMCARD_CMD()
{
    char *pp = NULL;
    PUT(buf_uart3.buf);
    pp = strstr((const char*)buf_uart3.buf,"OK");
    if(pp)
    {
        PUT_2("SIMCARD_CMD OK \r\n");
        clear_buf_uart3();
        current_status = CREG ;
        uart_string_send(CREG_CMD);
    }
	else
	{
        PUT_2("SIMCARD_CMD Gprs_err \r\n");
        clear_buf_uart3();
        current_status = SIMCARD ;
        uart_string_send(SIMCARD_CMD);
    }
}
Esempio n. 11
0
File: gprs.c Progetto: sundhhy/dtu
void send_gsm_text(unsigned char * buf , unsigned int count)
{
    unsigned int i ;
    char send_sms_cmd_num[SMS_CMD_LEN];
    memset((void*)send_sms_cmd_num,0,SMS_CMD_LEN);

    if(!is_gprs_mode_ok)
        return ;

    init_sms_to_send();
    if(current_status != GSM_TEXT_MODE_FINISH)
        return ;

    PUT((char *)buf);

    PUT("\r\nTEL-\r\n");
    PUT(tpy_send_tel_num);
    PUT("-END\r\n");

    if(strlen(tpy_send_tel_num) != 11)
        uart_string_send(GSM_SEND_TEXT);
    else
    {
        sprintf(send_sms_cmd_num,"AT+CMGS=\"+86%s\"\x00D\x00A",tpy_send_tel_num);
        PUT(send_sms_cmd_num);
        uart_string_send(send_sms_cmd_num);
    }
    delay_GSM(100);
    for( i = 0 ;i < count ; i ++)
    {
        for ( i = 0 ; i < strlen((const char*)buf) ; i ++)
        {
            uart_data_send(buf[i]);
        }
    }

    delay_GSM(100);
    send_data_uart1(0X1A);
    delay_GSM(5000);
}
Esempio n. 12
0
File: gprs.c Progetto: sundhhy/dtu
/// 建立一个IP连接 AT+CIPSTART=”TCP”,”211.136.42.12”,”2020”
void __GPRS_TCPIP()
{//AT+CMGR=1

    uart_string_send(GPRS_TCP1);
    uart_data_send(0x22);
    uart_string_send(g_config_data.protocoltype);
    uart_data_send(0x22);
    uart_data_send(',');
    uart_data_send(0x22);
    uart_string_send(g_config_data.ipaddr);
    uart_data_send(0x22);
    uart_data_send(',');
    uart_data_send(0x22);
    uart_string_send(g_config_data.portnum);
    uart_data_send(0x22);
    uart_data_send(0x0D);
    uart_data_send(0x0A);
    PUT("destination address:");
    PUT(g_config_data.ipaddr);
  
    delay_GSM(3000);
}
Esempio n. 13
0
File: gprs.c Progetto: sundhhy/dtu
static void S_RST()
{
    PUT_2(buf_uart3.buf);
    if(buf_uart3.buf[2] == 'O' &&
       buf_uart3.buf[3] == 'K')
    {

        PUT_2("S_RST OK \r\n");
        is_gprs_mode_start_succeed = 1;		 //GPRS模块和单片机的串口3已经通信上了
        clear_buf_uart3();
        current_status = SIMCARD ;
        uart_string_send(SIMCARD_CMD);

    }
	else
	{
        delay_GSM(5000);
        clear_buf_uart3();
        current_status = RST ;
        uart_string_send(ATE0_CMD);
    }
}
Esempio n. 14
0
File: gprs.c Progetto: sundhhy/dtu
static void S_GPRS_ACT_PDP_S_RET()                  //判断激活
{
    if((buf_uart3.buf[2]=='O')&&(buf_uart3.buf[3]=='K'))
    {
        PUT_2("S_GPRS_ACT_PDP_S_RET OK \r\n");
        clear_buf_uart3();
        current_status = GPRS_OPEN_FINISH;
    }
    else
    {
        PUT_2(buf_uart3.buf);
        PUT_2("S_GPRS_ACT_PDP_S_RET NO \r\n");
        clear_buf_uart3();
		uart_string_send(GPRS_ACT_PDP);
    }
}
Esempio n. 15
0
File: gprs.c Progetto: sundhhy/dtu
static void S_CREG()
{
    if(((buf_uart3.buf[9]=='0')&&
        (buf_uart3.buf[11]=='1'))||
       ((buf_uart3.buf[9]=='0')&&
        (buf_uart3.buf[11]=='5')))
    {
        PUT_2("S_REG OK \r\n");
        current_status = INIT_FINISH_OK;
    }else{
        PUT_2(buf_uart3.buf);
        PUT_2("S_REG Gprs_err \r\n");

        debug_put_word(buf_uart3.buf[9]);
        debug_put_word(buf_uart3.buf[11]);

        clear_buf_uart3();
        current_status = CREG ;
        uart_string_send(CREG_CMD);
    }
}
Esempio n. 16
0
File: gprs.c Progetto: sundhhy/dtu
void send_gprs_data(char * buf , unsigned int count)
{
    unsigned int i ,j;
    if (current_status != TCP_IP_OK)        // 如果协议没有连接成功直接返回
        return ;

	ibusy = 1;
#if 1
    uart_string_send(GPRS_SEND_DATA);		  //发送数据命令 注意没长度限制
    delay_GSM(2000);

    for( j = 0 ;j < count ; j ++)
    {
        for ( i = 0 ; i < strlen((const char*)buf) ; i ++)
        {
            uart_data_send(buf[i]);
        }
    }

    uart_data_send(0x1A);  //LF			  //没长度限制一定要用1A表示结束
#endif
	ibusy = 0;
}