Skip to content

Commit

Permalink
Merge pull request #2 from yylyyl/master
Browse files Browse the repository at this point in the history
It can receive SMS from alphabetical addresses now. Fixed USSD for E261.
  • Loading branch information
wdoekes committed Sep 20, 2015
2 parents 7eb9b85 + d8c39e3 commit ec6f87a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This channel driver should work with the folowing UMTS cards:
* Huawei E169 / K3520
* Huawei E155X
* Huawei E175X
* Huawei E261
* Huawei K3765

Check complete list in:
Expand Down
1 change: 1 addition & 0 deletions at_response.c
Original file line number Diff line number Diff line change
Expand Up @@ -1616,6 +1616,7 @@ static int at_response_cgmm (struct pvt* pvt, const char* str)
"E153",
"E156B",
"E1752",
"E261"
};

ast_copy_string (pvt->model, str, sizeof (pvt->model));
Expand Down
15 changes: 14 additions & 1 deletion pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@
*/

#define NUMBER_TYPE_INTERNATIONAL 0x91
#define NUMBER_TYPE_NATIONAL 0xC8
#define NUMBER_TYPE_ALPHANUMERIC 0xD0

/* Message Type Indicator Parameter */
#define PDUTYPE_MTI_SHIFT 0
Expand Down Expand Up @@ -229,6 +231,7 @@

#define PDU_PID_SMS 0x00 /* bit5 No interworking, but SME-to-SME protocol = SMS */
#define PDU_PID_EMAIL 0x32 /* bit5 Telematic interworking, bits 4..0 0x 12 = email */
#define PDU_PID_SMS_REPLACE_MASK 0x40 /* bit7 Replace Short Message function activated (TP-PID = 0x41 to 0x47) */

/* DCS */
/* bits 1..0 Class */
Expand Down Expand Up @@ -454,7 +457,15 @@ static int pdu_parse_number(char ** pdu, size_t * pdu_length, unsigned digits, i
{
char digit;
if(*toa == NUMBER_TYPE_INTERNATIONAL)
{
*number++ = '+';
}
else if(*toa == NUMBER_TYPE_ALPHANUMERIC)
{
for(; syms > 0; syms--, *pdu += 1, *pdu_length -= 1)
*number++ = pdu[0][0];
return *pdu - begin;
}
for(; syms > 0; syms -= 2, *pdu += 2, *pdu_length -= 2)
{
digit = pdu_code2digit(pdu[0][1]);
Expand Down Expand Up @@ -690,10 +701,12 @@ EXPORT_DEF const char * pdu_parse(char ** pdu, size_t tpdu_length, char * oa, si
{
int pid = pdu_parse_byte(pdu, &pdu_length);
*oa_enc = STR_ENCODING_7BIT;
if(oa_toa == NUMBER_TYPE_ALPHANUMERIC)
*oa_enc = STR_ENCODING_7BIT_HEX;
if(pid >= 0)
{
/* TODO: support other types of messages */
if(pid == PDU_PID_SMS)
if( (pid == PDU_PID_SMS) || (pid & PDU_PID_SMS_REPLACE_MASK) )
{
int dcs = pdu_parse_byte(pdu, &pdu_length);
if(dcs >= 0)
Expand Down

0 comments on commit ec6f87a

Please sign in to comment.