Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

callback.c

Example of SMS handing and set_up_call().
/*
 * Copyright (C) 2003 BLADOX, s.r.o.  All rights reserved.
 * 
 * This file is part of an example program for Turbo. This example
 * program may be used, distributed and modified without limitation.
 *
 */

#include <config.h>
#include <turbo/turbo.h>

#include <stdlib.h>

/* *INDENT-OFF* */

lc_char PROGMEM lc_Callback[]={
        LC_EN("Callback")
        LC_END
};

/* *INDENT-ON* */

u8 PROGMEM t_Callback_mime[] = "callback";

void callback_sms (u8 * s)
{
  u8 *t;

  t = tpdu_seek (s, T_SMS_AA);
  //retval(0x9F07);
  set_up_call (t, MSISDN_SMS, NULL);
}

void callback (void *data)
{
  u8 *res, *q;
  u8 *tmp = NULL;
  u8 *ms = NULL;

  res = msisdn (NULL);
  if (res == ENULL || res == NULL)
    return;                     // user back or end app
  ms = msisdncpy (res, MSISDN_ADN, MEM_R);
  if (ms == NULL)
    return;                     //not enough memory

  tmp = malloc (30);
  if (tmp != NULL)
  {
    q = create_head_msg (tmp, t_Callback_mime);
    send_sms (tmp, q - tmp, ms, MSISDN_ADN, tsms_dcs (), tsms_pid (), NULL,
              NULL);
  }

  free (tmp);
  free (ms);
}

void turbo_handler (u8 action, void *data)
{
  switch (action)
  {
    case ACTION_SMS_MSG:
      stk_thread (callback_sms, data);
      break;
    case ACTION_APP_REGISTER:
      reg_sms_tag (locale (lc_Callback), t_Callback_mime, SMS_TYPE_MSG);
      break;
    case ACTION_INSERT_MENU:
      insert_menu (locale (lc_Callback));
      break;
    case ACTION_MENU_SELECTION:
      stk_thread (callback, data);
      break;
    default:
      break;
  }
}


Copyright © 2004-2006 BLADOX
Turbo version 1.2