void net_sms_valettrunk(char* number)
  {
  char *p;

  if (sys_features[FEATURE_CARBITS]&FEATURE_CB_SOUT_SMS) return;

  delay100(2);
  net_send_sms_start(number);
  net_puts_rom(NET_MSG_VALETTRUNK);
  net_send_sms_finish();
  }
void net_sms_alarm(char* number)
  {
  char *p;

  if (sys_features[FEATURE_CARBITS]&FEATURE_CB_SOUT_SMS) return;

  delay100(2);
  net_send_sms_start(number);
  net_puts_rom(NET_MSG_ALARM);
  net_send_sms_finish();
  }
BOOL net_sms_in(char *caller, char *buf)
{
    // The buf contains an SMS command
    // and caller contains the caller telephone number
    char *p;
    int k;

    // Convert SMS command (first word) to upper-case
    for (p=buf; ((*p!=0)&&(*p!=' ')); p++)
        if ((*p > 0x60) && (*p < 0x7b)) *p=*p-0x20;
    if (*p==' ') p++;

    // Command parsing...
    for (k=0; sms_cmdtable[k][0] != 0; k++)
    {
        if (memcmppgm2ram(buf, (char const rom far*)sms_cmdtable[k]+1, strlenpgm((char const rom far*)sms_cmdtable[k])-1) == 0)
        {
            BOOL result = FALSE;
            char *arguments = net_sms_initargs(p);

            if (!net_sms_checkauth(sms_cmdtable[k][0], caller, &arguments))
                return FALSE; // auth error

            if (vehicle_fn_smshandler != NULL)
            {
                if (vehicle_fn_smshandler(TRUE, caller, buf, arguments))
                    return TRUE; // handled
            }

            result = (*sms_hfntable[k])(caller, buf, arguments);
            if (result)
            {
                if (vehicle_fn_smshandler != NULL)
                    vehicle_fn_smshandler(FALSE, caller, buf, arguments);
                net_send_sms_finish();
            }
            return result;
        }
    }

    if (vehicle_fn_smsextensions != NULL)
    {
        // Try passing the command to the vehicle module for handling...
        if (vehicle_fn_smsextensions(caller, buf, p))
            return TRUE; // handled
    }

    // SMS didn't match any command pattern, forward to user via net msg
    net_msg_forward_sms(caller, buf);
    return FALSE; // unknown command
}
void net_sms_socalert(char* number)
{
    char *s;

    delay100(10);
    net_send_sms_start(number);

    s = stp_i(net_scratchpad, "ALERT!!! CRITICAL SOC LEVEL APPROACHED (", car_SOC); // 95%
    s = stp_rom(s, "% SOC)");
    net_puts_ram(net_scratchpad);

    net_send_sms_finish();
    delay100(5);
}
예제 #5
0
void net_sms_alert(char* number, alert_type alert)
  {
  if (sys_features[FEATURE_CARBITS]&(FEATURE_CB_SOUT_SMS|FEATURE_CB_SVALERTS))
    return;

  delay100(2);
  net_send_sms_start(number);
  
  net_prep_alert(net_scratchpad, alert);
  cr2lf(net_scratchpad);
  
  net_puts_ram(net_scratchpad);
  net_send_sms_finish();
  }
void net_sms_12v_alert(char* number)
{
    char *s;

    delay100(10);
    net_send_sms_start(number);

    if (can_minSOCnotified & CAN_MINSOC_ALERT_12V)
        s = stp_l2f(net_scratchpad, "MP-0 PAALERT!!! 12V BATTERY CRITICAL (", car_12vline, 1);
    else
        s = stp_l2f(net_scratchpad, "MP-0 PA12V BATTERY OK (", car_12vline, 1);
    s = stp_l2f(s, "V, ref=", car_12vline_ref, 1);
    s = stp_rom(s, "V)");
    net_puts_ram(net_scratchpad);

    net_send_sms_finish();
    delay100(5);
}
BOOL net_sms_handle_params(char *caller, char *command, char *arguments)
{
    unsigned char d = PARAM_MILESKM;

    while ((d < PARAM_MAX)&&(arguments != NULL))
    {
        if ((arguments[0]=='-')&&(arguments[1]==0))
            par_set(d++, arguments+1);
        else
            par_set(d++, arguments);
        arguments = net_sms_nextarg(arguments);
    }

    net_send_sms_start(caller);
    net_puts_rom(NET_MSG_PARAMS);
    net_send_sms_finish();

    vehicle_initialise();

    if (net_state != NET_STATE_DIAGMODE)
        net_state_enter(NET_STATE_DONETINIT);

    return FALSE;
}