📄 wap_ussd.c
字号:
/*
* Copyright (C) Ericsson Mobile Communications AB, 2000.
* Licensed to AU-System AB.
* All rights reserved.
*
* This software is covered by the license agreement between
* the end user and AU-System AB, and may be used and copied
* only in accordance with the terms of the said agreement.
*
* Neither Ericsson Mobile Communications AB nor AU-System AB
* assumes any responsibility or liability for any errors or inaccuracies in
* this software, or any consequential, incidental or indirect damage arising
* out of the use of the Generic WAP Client software.
*/
#include "wiptrgt.h"
#include "aapiussd.h"
#include "capiussd.h"
#ifdef LOG_EXTERNAL
#include "aapiclnt.h"
#endif
#include "cmmnrsrc.h"
/*
Exported from UDP.
*/
extern const size_t cHeaderUDP;
CHAR * responseUDP(const size_t, const size_t, const CHAR *, size_t *);
CHAR * responseOnceDeck1(size_t *);
/*
Exported from SMS.
*/
extern const size_t cHeaderSMS;
CHAR * responseSMS(const size_t, const size_t, const CHAR *, size_t *);
const size_t cHeaderUSSD = 18;
CHAR *
responseUSSD(const size_t cHeader, const size_t cNbr, const CHAR *data, size_t *len)
{
CHAR *d;
d = responseSMS(cHeader + cHeaderUSSD, cNbr, data, len);
d[1] = *len - 2;
d[2] = 0x1B;
d[3] = (CHAR)-32; /*0xE0;*/
d[4] = 0x0E;
d[5] = 0x20;
d[6] = 0x0C;
d[7] = 0x34;
d[8] = 0x36;
d[9] = 0x30;
d[10] = 0x37;
d[11] = 0x30;
d[12] = 0x33;
d[13] = 0x31;
d[14] = 0x32;
d[15] = 0x33;
d[16] = 0x34;
d[17] = 0x35;
d[cHeaderUSSD] = 0x32; /* SMS header */
return d;
}
static CHAR *
responseDeck1(const size_t cNbr, size_t *len)
{
CHAR *d = NULL;
/* content wml = 94, resten body */
switch (cNbr)
{
/* The header for the first segment of the message is longer than the the rest of the segments. */
case 1:
d = responseUSSD(0, 1, "9401046a007f67600348656C6C6F20", len);
break;
case 2:
d = responseUSSD(0, 2, "776F726C6421", len);
break;
case 3:
d = responseUSSD(0, 3, "00010101", len);
break;
}
return d;
}
VOID USSDa_sendInvokeProcessRequest (const CHAR *data, UINT8 stringLength)
{
#ifdef LOG_EXTERNAL
{
const char *_data;
char *strData;
_data = strData = OctetString2HexString(data, stringLength);
CLNTa_log(0, 0, "USSDa_sendInvokeProcessRequest\nconst CHAR * \t data \t %s\nUINT8 \t stringLength \t %u\n", _data, (int)stringLength);
OSConnectorFree(strData);
}
#endif
#ifndef CBASIC_WITH_NO_CONNECTORS
/* RETURN */
/* DECK */
{
const size_t cUSSDextraOut = 17;
const UINT8 cDCS = 85;
size_t len;
CHAR *response;
char i;
for (i = 1; i <= 3; i++)
{
response = responseDeck1(i, &len);
response[3+cHeaderUSSD] = data[5+cUSSDextraOut];
response[4+cHeaderUSSD] = data[6+cUSSDextraOut];
response[5+cHeaderUSSD] = data[3+cUSSDextraOut];
response[6+cHeaderUSSD] = data[4+cUSSDextraOut];
if (i == 1)
{
response[cHeaderSMS+cHeaderUSSD] = data[7+cUSSDextraOut]; /* TId */
}
USSDc_receivedInvokeRequest(response, (UINT8)len);
OSConnectorFree(response);
}
}
#endif
}
VOID USSDa_sendResultRequest (const CHAR *data, UINT8 stringLength)
{
#ifdef LOG_EXTERNAL
{
const char *_data;
char *strData;
_data = strData = OctetString2HexString(data, stringLength);
CLNTa_log(0, 0, "USSDa_sendResultRequest\nconst CHAR * \t data \t %s\nUINT8 \t stringLength \t %u\n", _data, (int)stringLength);
OSConnectorFree(strData);
}
#endif
#ifndef CBASIC_WITH_NO_CONNECTORS
/* RETURN */
USSDc_receivedInvokeRequest(data, stringLength);
#endif
}
VOID USSDa_sendAbort (VOID)
{
#ifdef LOG_EXTERNAL
CLNTa_log(0, 0, "USSDa_sendAbort\nVOID\n");
#endif
#ifndef CBASIC_WITH_NO_CONNECTORS
/* RETURN */
USSDc_receivedRelease();
#endif
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -