|
bladox.com Turbo SIM Toolkit Adapter Forums
|
View previous topic :: View next topic |
Author |
Message |
prchal Guest
|
Posted: Fri May 18, 2007 8:04 am Post subject: Pager 2: potvrzování SMS |
|
|
Dobrý den,
mám Turbo 2 s aplikací Pager 2.1.0 v Nokii 6310i a krásně to funguje, jen mi vadí, ?e přijatá ovládací SMS není zpět odesílateli potvrzena s aktuálním stavem. Je to pou?itým telefonem, nebo je to vlastnost aplikace?
Děkuji |
|
Back to top |
|
|
pz Guest
|
Posted: Sat May 19, 2007 7:49 am Post subject: |
|
|
Vlastnost, muzete si nadefinovat stejny text jako stavovou SMS a pak dostanete i stav. |
|
Back to top |
|
|
prchal Guest
|
Posted: Wed May 23, 2007 6:07 am Post subject: Pager 2: Potvrzování SMS |
|
|
A co takhle, po?le to stav:
Code: | void rec_sms (File_apdu_data * fd)
{
u8 *t;
u8 *data = fd->data;
u8 i;
u16 j;
u8 *s;
u8 l;
u8 cmd = 0;
u8 pin;
SEdge *nrs;
SNode *n;
Number *nr_cap;
u8 *ms;
u8 *msg;
#ifdef DEBUG
dbsp ("REC_SMS\n");
for (i = 0; i < fd->p3; i++)
{
dbch (data[i]);
dbc (' ');
}
dbc ('\n');
#endif
if ((data[0] & 0x07) == 3) //received, to be read
{
s = data;
s++; // state
i = *s;
s += i + 1; // TS-Service-Centre-Address
i = *s;
if ((i & 0x03) == 0x00) //deliver
{
msg = malloc (161);
if (msg)
{
if (i & 0x40)
{
// UHDI
u16 bits, b1;
dbsp ("UHDI\n");
t = tpdu_seek (s, T_SMS_DCS);
j = *t;
t = tpdu_seek (s, T_SMS_UDL);
l = *t;
t++;
i = *t; //UDHL
if (dcs_is_7b (j))
{
dbsp ("7B\n");
j = 7 - ((1 + i) * 8) % 7; //padding, fill bits
if (j == 7)
j = 0;
dbsp ("JP ");
dbih (j);
dbc ('\n');
j += (1 + i) * 8; // header in bits divisible 7
dbsp ("J7 ");
dbih (j);
dbc ('\n');
bits = l * 7 - j;
dbsp ("BITS ");
dbih (j);
dbc ('\n');
for (b1 = 0; b1 < bits; b1++)
set_bit (msg, b1, get_bit (t, b1 + j));
i = bits / 7;
dcs_78 (msg, i, DCS_7_TO_8);
msg[i] = '\0';
}
else
{
dbsp ("8B\n");
memcpy (msg, t + 1 + i, l - 1 - i);
msg[l - 1 - i] = '\0';
}
}
else
{
t = tpdu_seek (s, T_SMS_UDL);
i = *t;
memcpy (msg, t + 1, 140);
t = tpdu_seek (s, T_SMS_DCS);
if (dcs_is_7b (*t))
dcs_78 (msg, i, DCS_7_TO_8);
msg[i] = '\0';
}
#ifdef DEBUG
dbsp ("MSG: ");
l = strlen (msg);
dbch (l);
dbc (' ');
for (i = 0; i < l; i++)
dbc (msg[i]);
dbc ('\n');
#endif
t = tpdu_seek (s, T_SMS_AA);
ms = msisdncpy (t, MSISDN_SMS, MEM_R);
refsms_d (fd);
for (pin = 0; pin < MAX_PIN; pin++)
{
dbsp ("PIN ");
dbch (i);
dbc ('\n');
if (cmp_msg (msg, rw (&pers_mem->pin[pin].msg_state)))
{
dbsp ("STATE\n");
if (check_nr (ms, pin, NR_CAP_STATUS))
{
dbsp ("NR OK\n");
if (rb (&pers_mem->pin[pin].dir) == DEF_OUT)
{
// OUT
if (out_pin_val (pin) == DEF_ON)
send_msg (ms, rw (&pers_mem->pin[pin].msg_notify_on), NULL,
MSISDN_SMS);
else
send_msg (ms, rw (&pers_mem->pin[pin].msg_notify_off), NULL,
MSISDN_SMS);
}
else if (rb (&pers_mem->pin[pin].dir) == DEF_IN)
{
// IN
if (get_val_pin (pin) == DEF_ON)
send_msg (ms, rw (&pers_mem->pin[pin].msg_notify_on), NULL,
MSISDN_SMS);
else
send_msg (ms, rw (&pers_mem->pin[pin].msg_notify_off), NULL,
MSISDN_SMS);
}
else
{
// ADC
u8 *r = buf_A ();
r = sprints (r, rw (&pers_mem->pin[pin].msg_notify_adc));
r = sprintc (r, ' ');
r = sprinti (r, get_pin_adc (pin));
r = sprintc (r, '\0');
send_msg (ms, buf_A (), NULL, MSISDN_SMS);
}
}
}
if (rb (&pers_mem->pin[pin].dir) == DEF_OUT)
{
if (cmp_msg (msg, rw (&pers_mem->pin[pin].msg_on)))
{
if (check_nr (ms, pin, NR_CAP_ON))
{
set_pin (pin, DEF_ON);
//odeslat odpoved
send_state (ms, MSISDN_SMS);
// notify on
// OPEN if number not specified, send status?
nrs = rw (&pers_mem->pin[pin].numbers);
while (nrs)
{
n = rw (&nrs->t);
nr_cap = rw (&n->p);
if (rb (&nr_cap->cap) & NR_CAP_NOTIFY)
send_msg (rw (&nr_cap->nr),
rw (&pers_mem->pin[pin].msg_notify_on), NULL,
MSISDN_ADN);
nrs = rw (&nrs->next);
}
}
}
if (cmp_msg (msg, rw (&pers_mem->pin[pin].msg_off)))
{
if (check_nr (ms, pin, NR_CAP_OFF))
{
set_pin (pin, DEF_OFF);
//odeslat odpoved
send_state (ms, MSISDN_SMS);
// notify off
// OPEN if number not specified, send status?
nrs = rw (&pers_mem->pin[pin].numbers);
while (nrs)
{
n = rw (&nrs->t);
nr_cap = rw (&n->p);
if (rb (&nr_cap->cap) & NR_CAP_NOTIFY)
send_msg (rw (&nr_cap->nr),
rw (&pers_mem->pin[pin].msg_notify_off), NULL,
MSISDN_ADN);
nrs = rw (&nrs->next);
}
}
}
if (cmp_msg (msg, rw (&pers_mem->pin[pin].msg_btn)))
{
if (check_nr (ms, pin, NR_CAP_BTN))
{
u16 msecs;
set_pin (pin, !out_pin_val (pin));
for (msecs = 0; msecs < CONFIG_BTN_DELAY_MILISEC; msecs++)
delay_1ms ();
set_pin (pin, !out_pin_val (pin));
// notify on/off
// OPEN if number not specified, send status?
nrs = rw (&pers_mem->pin[pin].numbers);
while (nrs)
{
n = rw (&nrs->t);
nr_cap = rw (&n->p);
if (rb (&nr_cap->cap) & NR_CAP_NOTIFY)
send_msg (rw (&nr_cap->nr),
rw (&pers_mem->pin[pin].msg_notify_on),
rw (&pers_mem->pin[pin].msg_notify_off),
MSISDN_ADN);
nrs = rw (&nrs->next);
}
}
}
}
}
free (ms);
free (msg);
return;
}
}
refsms_d (fd);
return;
}
store_sms_2_sim (); // not incoming message, something user
}
|
Je?tě dal?í námět: přepočtová konstanta pro ADC vstupy, aby to u?ivateli ukazovalo měřenou veličinu. |
|
Back to top |
|
|
pz Guest
|
Posted: Wed May 23, 2007 6:31 pm Post subject: |
|
|
No parada, neco takoveho to bude.
ADC konstanta/prepocet - to je taky TODO, jen zaciname mit obavu o velikost aplikace. Asi vyhazeme nejake jazyky. |
|
Back to top |
|
|
prchal Guest
|
Posted: Mon May 28, 2007 6:54 am Post subject: Pager 2: Potvrzování SMS |
|
|
Jestli máte zájem, poslal bych Vám zdroják mnou upravený na přepočet analogové hodnoty na mV. Není to nic slo?itého a aplikace má cca 21kB. |
|
Back to top |
|
|
pz Guest
|
Posted: Tue May 29, 2007 9:59 am Post subject: |
|
|
No jasne, dame to na nas server a tady ve foru link. Poslete to prosim na info. |
|
Back to top |
|
|
pz Guest
|
Posted: Wed May 30, 2007 7:29 pm Post subject: |
|
|
Takze zde je Vas prispevek: http://www.bladox.com/pub/pager-2.1.0-prchal-1.tar.gz
Komentar:
Quote: |
Je?tě jsem udělal dal?í úpravu, a to přepočet na teplotu ve stupních C ve stavové SMS pro připojené čidlo LM61. Chtěl jsem to udělat volitelně (mV / C), ale narazil jsem na problém, ?e fce "ABC_val" umí jen 3 polo?ky na výběr. Tak?e teď je to v C a pasá? s mV je zakomentovaná.
Také jsem upravil fci "adc_measure" tak, aby vracela průměr ze 16 vzorků.
|
Diky moc, neco podobneho zapracujeme. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|