Ejemplo n.º 1
0
void sms_fetch() 
{
    static uint8_t fetch_sms;
    static uint8_t delete_sms = 0;
    
    fetch_sms ++;
    if (pdu_must_parse) {
        uint8_t ret;
        SMS_DEBUG("pdu_parser called with: %s\r\n", rx_buffer);
        ret = pdu_parser((uint8_t *) rx_buffer);

        if(ret == 0) {
            /* we want to delete the recently received message */
            delete_sms = 1;
        }
        pdu_must_parse = 0;
    }
    
    if (!global_mobil_access && delete_sms) {
        global_mobil_access = 1;
        delete_sms = 0;
        /* delete received and read message */
        fprintf(ausgabe, "AT+CMGD=1\r\n");  
        SMS_DEBUG("delete sms\r\n");
    }

    if (!global_mobil_access && !pdu_must_parse && (!(fetch_sms % 50))) {
        global_mobil_access = 1;
        /* fetch received and not read messages */
        fprintf(ausgabe, "AT+CMGL=0\r\n"); 
        SMS_DEBUG("fetch sms\n\n\n");
    }
}
Ejemplo n.º 2
0
Archivo: main.c Proyecto: yhcting/ylisp
void*
_packet_handler(void* arg) {
	struct _packet*	  p = (struct _packet*) arg;
	yldynb_t	  cmd;
	yldynb_t	  data;
	assert(p);
	yldynb_init(&cmd,  256);
	yldynb_init(&data, 4096);

	if (0 > pdu_parser(&cmd, &data, p->data, p->sz))
		goto done;

	if (0 > cmd_do(yldynb_buf(&cmd), yldynb_buf(&data), yldynb_sz(&data)))
		goto done;

 done:
	yldynb_clean(&cmd);
	yldynb_clean(&data);
	free(p->data);
	free(p);
	return NULL;
}