TCORE_AT_NO_RESULT, /* no intermediate response expected */
TCORE_AT_NUMERIC, /* a single intermediate response starting with a 0-9 */
TCORE_AT_SINGLELINE, /* a single intermediate response starting with a prefix */
- TCORE_AT_MULTILINE /* multiple line intermediate response starting with a prefix */
+ TCORE_AT_MULTILINE, /* multiple line intermediate response starting with a prefix */
+ TCORE_AT_PDU
};
enum ATCMEError{
gboolean tcore_sim_decode_iccid(struct tel_sim_iccid *p_out, unsigned char *p_in, int in_length);
gboolean tcore_sim_decode_lp(struct tel_sim_language *p_out, unsigned char *p_in, int in_length);
-gboolean tcore_sim_encode_lp(char *p_out, int out_length, struct tel_sim_language *p_in);
+char* tcore_sim_encode_lp(int *out_length, struct tel_sim_language *p_in);
gboolean tcore_sim_decode_li(enum tel_sim_file_id file_id, struct tel_sim_language *p_out, unsigned char *p_in, int in_length);
-gboolean tcore_sim_encode_li(char *p_out, int out_length, struct tel_sim_language *p_in);
+char* tcore_sim_encode_li(int *out_length, struct tel_sim_language *p_in);
gboolean tcore_sim_decode_imsi(struct tel_sim_imsi *p_out, unsigned char *p_in, int in_length);
gboolean tcore_sim_decode_sst(struct tel_sim_sst *p_sst, unsigned char *p_in, int in_length);
gboolean tcore_sim_decode_spn(struct tel_sim_spn *p_spn, unsigned char *p_in, int in_length);
TcorePending* tcore_queue_ref_next_pending(TcoreQueue *queue);
unsigned int tcore_queue_get_length(TcoreQueue *queue);
TcoreHal* tcore_queue_ref_hal(TcoreQueue *queue);
+TReturn tcore_queue_cancel_pending_by_command(TcoreQueue *queue, enum tcore_request_command command);
+TcorePending* tcore_queue_search_by_command(TcoreQueue *queue, enum tcore_request_command command, gboolean flag_sent);
__END_DECLS
gboolean state;
};
-#define MAX_SOUND_EQ_PARAMETER_SIZE 13
+#define MAX_SOUND_EQ_PARAMETER_SIZE 6
struct treq_call_sound_set_equalization {
gboolean mode;
enum telephony_call_sound_direction direction;
- char parameter[ MAX_SOUND_EQ_PARAMETER_SIZE ];
+ unsigned short parameter[ MAX_SOUND_EQ_PARAMETER_SIZE ];
};
struct treq_call_sound_set_noise_reduction {
#define SAT_SUB_ADDR_LEN_MAX 30
#define SAT_CCP_DATA_LEN_MAX 30 /**< max length of ccp data */
#define SAT_URL_LEN_MAX 129 /**< max length of url */
-#define SAT_BEARER_LIST_MAX_COUNT 50 /**< max count of bearer list */
+#define SAT_BEARER_LIST_MAX_COUNT 5 /**< max count of bearer list */
#define SAT_PROVISIONING_REF_MAX_COUNT 10 /**< max count of sat provisioning reference */
#define SAT_PROVISIONING_FILE_PATH_LEN_MAX 50 /**< max length of provisioning file path */
#define SAT_BEARER_PARAMS_LEN_MAX 10 /**< max length of bearer parameters */
enum telephony_sms_CbMsgType cbMsgType; /**< Cell Broadcast message type */
unsigned short length; /**<Size of array szMsgData (which is actual TPDU message) */
- char msgData[SMS_CB_PAGE_SIZE_MAX + 1]; /**<Cell broadcast message data[Refer 3GPP TS 23.041 9.4.1]*/
+ char msgData[SMS_CB_SIZE_MAX + 1]; /**<Cell broadcast message data[Refer 3GPP TS 23.041 9.4.1]*/
};
/**
#sbs-git:slp/pkgs/l/libtcore
Name: libtcore
Summary: Telephony-core library
-Version: 0.1.44
+Version: 0.1.50
Release: 1
Group: System/Libraries
License: Apache
}
tcore_pending_emit_response_callback(p, sizeof(TcoreATResponse *), at->resp);
- tcore_user_request_free(tcore_pending_ref_user_request(p));
+ tcore_user_request_unref(tcore_pending_ref_user_request(p));
tcore_pending_free(p);
_response_free(at->resp);
}
break;
+ case TCORE_AT_PDU:
+ if (at->req->prefix) {
+ if (g_str_has_prefix(pos, at->req->prefix)) {
+ _response_add(at->resp, pos);
+ }
+ else {
+ if (at->resp->lines != NULL) {
+ _response_add(at->resp, pos);
+ }
+ else {
+ _emit_unsolicited_message(at, pos);
+ }
+ }
+ }
+ else {
+ _response_add(at->resp, pos);
+ }
+ break;
+
default:
dbg("unknown");
_emit_unsolicited_message(at, pos);
_sat_decode_ton_npi(src_data[index++], &address_obj->ton, &address_obj->npi);
str_ascii = tcore_util_convert_bcd2ascii((const char*)&src_data[index], address_len-1, SAT_DIALING_NUMBER_LEN_MAX);
if(str_ascii){
- memcpy(address_obj->dialing_number, str_ascii, sizeof(str_ascii));
- address_obj->dialing_number_len = sizeof(str_ascii);
+ memcpy(address_obj->dialing_number, str_ascii, strlen(str_ascii));
+ address_obj->dialing_number_len = strlen(str_ascii);
g_free(str_ascii);
}
}
/**
* This function is used to encode EFLP (2G)
*/
-gboolean tcore_sim_encode_lp(char *p_out, int out_length, struct tel_sim_language *p_in)
+char* tcore_sim_encode_lp( int *out_length, struct tel_sim_language *p_in)
{
- int i;
+ int i = 0;
+ char *tmp_out = NULL;
- if (p_in->language_count > out_length)
- return FALSE;
+ if ( out_length == NULL || p_in == NULL ){
+ dbg("out_length or p_in is null");
+ return NULL;
+ }
- memset((void*) p_out, 0xff, out_length);
+ tmp_out = (char*)malloc(p_in->language_count);
+ memset((void*) tmp_out, 0xff, p_in->language_count);
- for (i = 0; i < p_in->language_count; i++)
- p_out[i] = p_in->language[i];
+ for (i = 0; i < p_in->language_count; i++)
+ tmp_out[i] = p_in->language[i];
- return TRUE;
+ *out_length = i;
+ return tmp_out;
}
/**
/**
* This function is used to encode EFLI (3G)
*/
-gboolean tcore_sim_encode_li(char *p_out, int out_length, struct tel_sim_language *p_in)
+char* tcore_sim_encode_li( int *out_length, struct tel_sim_language *p_in)
{
int i = 0;
+ char *tmp_out = NULL;
char *LanguageCode[] = { "de", "en", "it", "fr", "es", "nl", "sv", "da", "pt", "fi", "no", "el",
"tr", "hu", "pl", "ko", "zh", "ru", "ja" };
- if (p_in->language_count > out_length)
- return FALSE;
+ if ( out_length == NULL || p_in == NULL ){
+ dbg("out_length or p_in is null");
+ return NULL;
+ }
- memset((void*) p_out, 0xFF, out_length);
+ tmp_out = (char*)malloc((p_in->language_count) *2);
+ memset((void*) tmp_out, 0xff, (p_in->language_count)*2);
for (i = 0; i < p_in->language_count; i++) {
if (p_in->language[i] < SIM_LANG_UNSPECIFIED) {
- strncpy((char *) &p_out[i * 2], LanguageCode[p_in->language[i]], 2);
- dbg( "sim_encode_li: p_out[%s]:[%x][%x]", p_out, p_out[i*2], p_out[(i*2)+1]);
+ strncpy((char *) &tmp_out[i * 2], LanguageCode[p_in->language[i]], 2);
+ dbg( "sim_encode_li: p_out[%s]:[%x][%x]", tmp_out, tmp_out[i*2], tmp_out[(i*2)+1]);
}
}
- return TRUE;
+ *out_length = i*2;
+ return tmp_out;
}
gboolean tcore_sim_decode_imsi(struct tel_sim_imsi *p_out, unsigned char *p_in, int in_length)
gboolean tcore_sim_decode_pnn(struct tel_sim_pnn *p_pnn, unsigned char* p_in, int in_length)
{
- int f_name_length = 0, s_name_length = 0;
- int i, cvt_leng = 0;
+ int f_name_len = 0, s_name_len = 0;
+ int cvt_leng = 0, s_name_base = 0;
if (_is_empty(p_in, in_length) == TRUE) {
memset(p_pnn, 0x00, sizeof(struct tel_sim_pnn));
/*Full name for network IEI(Information Element Identifier),0x43*/
if (p_in[0] == 0x43) {
dbg( " Full name of network IEI exist");
- /*Assigning the variable 'f_name_length' with the Full name network length*/
- f_name_length = p_in[1];
-
- /* current telephony supports 40 bytes network name string */
- if (f_name_length > SIM_NW_FULL_NAME_LEN_MAX)
- f_name_length = SIM_NW_FULL_NAME_LEN_MAX;
+ //f_name_part includes information byte.
+ f_name_len = (int)p_in[1] - 1;
/* 3rd byte information element(according to TS 24.008 for Network Name)
8 :ext1
*/
if ((p_in[2] & 0x01110000) >> 4 == 0) {
dbg( "DCS:GSM7");
- //f_name_length includes information byte.
- _unpack_7bit28bit(p_in + 3, f_name_length - 1,
- (unsigned char *) (p_pnn->full_name));
- }
- else if ((p_in[2] & 0x01110000) >> 4 == 1) {
+ // In case of GSM7, 35byte packing data will be converted 40 bytes unpacking string.
+ if (f_name_len > (SIM_NW_FULL_NAME_LEN_MAX * 7) / 8)
+ f_name_len = (SIM_NW_FULL_NAME_LEN_MAX * 7) / 8;
+
+ _unpack_7bit28bit(p_in + 3, f_name_len, (unsigned char *) (p_pnn->full_name));
+ } else if ((p_in[2] & 0x01110000) >> 4 == 1) {
dbg( "DCS:UCS2");
- _ucs2_to_utf8(f_name_length, p_in + 3, (int*) &cvt_leng,
- (unsigned char *) (p_pnn->full_name));
- }
- else {
+ /* current telephony supports 40 bytes network name string */
+ if (f_name_len > SIM_NW_FULL_NAME_LEN_MAX)
+ f_name_len = SIM_NW_FULL_NAME_LEN_MAX;
+
+ _ucs2_to_utf8(f_name_len, p_in + 3, (int*) &cvt_leng, (unsigned char *) (p_pnn->full_name));
+ } else {
dbg( "DCS:unknown");
return FALSE;
}
dbg( " Full name of network contents[%s]", p_pnn->full_name);
+ s_name_base = (int)p_in[1] +2;
+ dbg( " short name base byte [0x%02x]", s_name_base);
+
/*Short Name for network IEI(Information Element Identifier), 0x45*/
- if (p_in[f_name_length + 2] == 0x45) {
+ if (p_in[s_name_base] == 0x45) {
dbg( " Short name of network IEI exist");
- /*Assigning the variable 's_name_length' with the short name network length*/
- s_name_length = p_in[f_name_length + 3];
-
- if (s_name_length > SIM_NW_FULL_NAME_LEN_MAX)
- s_name_length = SIM_NW_FULL_NAME_LEN_MAX;
-
- for (i = 0; i < s_name_length; i++)
- p_pnn->short_name[i] = p_in[f_name_length + 4 + i];
-
+ //s_name_part includes information byte.
+ s_name_len = p_in[s_name_base +1] -1;
+
+ if ((p_in[s_name_base + 2] & 0x01110000) >> 4 == 0) {
+ dbg( "DCS:GSM7");
+ // In case of GSM7, 35byte packing data will be converted 40 bytes unpacking string.
+ if (s_name_len > (SIM_NW_FULL_NAME_LEN_MAX * 7) / 8)
+ s_name_len = (SIM_NW_FULL_NAME_LEN_MAX * 7) / 8;
+
+ _unpack_7bit28bit(p_in + s_name_base + 3, s_name_len, (unsigned char *) (p_pnn->short_name));
+ } else if ((p_in[s_name_base +2] & 0x01110000) >> 4 == 1) {
+ dbg( "DCS:UCS2");
+ if (s_name_len > SIM_NW_FULL_NAME_LEN_MAX)
+ s_name_len = SIM_NW_FULL_NAME_LEN_MAX;
+
+ _ucs2_to_utf8(s_name_len, p_in + s_name_base+ 3, (int*) &cvt_leng, (unsigned char *) (p_pnn->short_name));
+ } else {
+ dbg( "DCS:unknown");
+ return FALSE;
+ }
dbg( " Short name of network contents[%s]", p_pnn->short_name);
}
return TRUE;
}
-
return FALSE;
}
}
tcore_pending_emit_response_callback(p, data_len, data);
- tcore_user_request_free(tcore_pending_ref_user_request(p));
+ tcore_user_request_unref(tcore_pending_ref_user_request(p));
tcore_pending_free(p);
/* Send next request in queue */
TcoreQueue *queue;
};
+enum search_field {
+ SEARCH_FIELD_ID_ALL = 0x01,
+ SEARCH_FIELD_ID_WAIT = 0x11,
+ SEARCH_FIELD_ID_SENT = 0x21,
+ SEARCH_FIELD_COMMAND_ALL = 0x02,
+ SEARCH_FIELD_COMMAND_WAIT = 0x12,
+ SEARCH_FIELD_COMMAND_SENT = 0x22,
+};
+
static gboolean _on_pending_timeout(gpointer user_data)
{
TcorePending *p = user_data;
+ dbg("pending timeout!!");
+
if (!p)
return FALSE;
tcore_pending_emit_timeout_callback(p);
- p = tcore_queue_pop(p->queue);
- tcore_pending_free(p);
-
- p->timer_src = 0;
+ p->on_response = NULL;
+ tcore_hal_dispatch_response_data(p->queue->hal, p->id, 0, NULL);
return FALSE;
}
if (pending->on_send)
pending->on_send(pending, result, pending->on_send_user_data);
- if (result == TCORE_RETURN_SUCCESS) {
+ if (result == TRUE) {
if (pending->flag_auto_free_after_sent == FALSE && pending->timeout > 0) {
/* timer */
+ dbg("start pending timer! (%d secs)", pending->timeout);
pending->timer_src = g_timeout_add_seconds(pending->timeout, _on_pending_timeout, pending);
}
}
}
-static TcorePending *_tcore_queue_search(TcoreQueue *queue, unsigned int id,
- gboolean flag_pop)
+static TcorePending *_tcore_queue_search_full(TcoreQueue *queue, unsigned int id,
+ enum tcore_request_command command, enum search_field field, gboolean flag_pop)
{
TcorePending *pending = NULL;
int i = 0;
+ UserRequest *ur;
if (!queue)
return NULL;
if (!pending)
return NULL;
- if (pending->id == id) {
- if (flag_pop == TRUE) {
- pending = g_queue_pop_nth(queue->gq, i);
+ if ((field & 0xF0) == 0x10) {
+ /* search option is wait pending */
+ if (pending->flag_sent) {
+ i++;
+ continue;
+ }
+ }
+ else if ((field & 0xF0) == 0x20) {
+ /* search option is sent pending */
+ if (pending->flag_sent == FALSE) {
+ i++;
+ continue;
+ }
+ }
+
+ if ((field & 0x0F) == SEARCH_FIELD_ID_ALL) {
+ if (pending->id == id) {
+ if (flag_pop == TRUE) {
+ pending = g_queue_pop_nth(queue->gq, i);
+ }
+ break;
+ }
+ }
+ else if ((field & 0x0F) == SEARCH_FIELD_COMMAND_ALL) {
+ ur = tcore_pending_ref_user_request(pending);
+ if (tcore_user_request_get_command(ur) == command) {
+ if (flag_pop == TRUE) {
+ pending = g_queue_pop_nth(queue->gq, i);
+ }
+ break;
}
- break;
}
i++;
return pending;
}
+TcorePending *tcore_queue_search_by_command(TcoreQueue *queue,
+ enum tcore_request_command command, gboolean flag_sent)
+{
+ if (flag_sent)
+ return _tcore_queue_search_full(queue, 0, command, SEARCH_FIELD_COMMAND_SENT, FALSE);
+
+ return _tcore_queue_search_full(queue, 0, command, SEARCH_FIELD_COMMAND_WAIT, FALSE);
+}
+
TcorePending *tcore_queue_pop_by_id(TcoreQueue *queue, unsigned int id)
{
if (!queue)
return NULL;
- return _tcore_queue_search(queue, id, TRUE);
+ return _tcore_queue_search_full(queue, id, 0, SEARCH_FIELD_ID_ALL, TRUE);
}
TcorePending *tcore_queue_ref_pending_by_id(TcoreQueue *queue, unsigned int id)
if (!queue)
return NULL;
- return _tcore_queue_search(queue, id, FALSE);
+ return _tcore_queue_search_full(queue, id, 0, SEARCH_FIELD_ID_ALL, FALSE);
}
TcorePending *tcore_queue_ref_next_pending(TcoreQueue *queue)
return queue->hal;
}
+
+TReturn tcore_queue_cancel_pending_by_command(TcoreQueue *queue, enum tcore_request_command command)
+{
+ TcorePending *pending;
+
+ if (!queue)
+ return TCORE_RETURN_EINVAL;
+
+ while (1) {
+ pending = _tcore_queue_search_full(queue, 0, command, SEARCH_FIELD_COMMAND_ALL, FALSE);
+ if (!pending)
+ break;
+
+ dbg("pending(0x%x) cancel", pending);
+
+ if (queue->hal) {
+ tcore_hal_dispatch_response_data(queue->hal, pending->id, 0, NULL);
+ }
+ else {
+ pending = tcore_queue_pop_by_pending(queue, pending);
+ tcore_pending_emit_response_callback(pending, 0, NULL);
+ tcore_user_request_unref(tcore_pending_ref_user_request(pending));
+ tcore_pending_free(pending);
+ }
+ }
+
+ return TCORE_RETURN_SUCCESS;
+}
if (!ur)
return;
- if ( ur->ref > 0 ) {
+ if (ur->ref > 0) {
ur->ref--;
- return ;
+ return;
}
if (ur->free_hook)
void tcore_user_request_unref(UserRequest *ur)
{
if (!ur)
- return ;
+ return;
- if ( ur->ref > 0 )
+ if (ur->ref > 0)
ur->ref--;
else
- tcore_user_request_free( ur );
+ tcore_user_request_free(ur);
- return ;
+ return;
}
-
TReturn tcore_user_request_set_free_hook(UserRequest *ur,
UserRequestFreeHook free_hook)
{
if (ur->ui.appname) {
dbg("free old appname (%s)", ur->ui.appname);
free(ur->ui.appname);
+ ur->ui.appname = NULL;
}
if (ui->appname) {
if (!ur)
return TCORE_RETURN_EINVAL;
- ur->metainfo_len = metainfo_len;
-
if (metainfo_len > 0 && metainfo != NULL) {
ur->metainfo = calloc(metainfo_len, 1);
if (!ur->metainfo)
return TCORE_RETURN_ENOMEM;
+ ur->metainfo_len = metainfo_len;
memcpy(ur->metainfo, metainfo, metainfo_len);
}
else {
ur->metainfo = NULL;
+ ur->metainfo_len = 0;
}
return TCORE_RETURN_SUCCESS;
return TCORE_RETURN_FAILURE;
}
+ memset(&sai, 0, sizeof(struct sockaddr_in));
sai.sin_family = AF_INET;
sai.sin_port = 0;
memset(&ifr, 0, sizeof(struct ifreq));
return NULL;
for (pos = 0, i = 0; i < src_len; pos++, i++) {
- if ( pos >= outlen ) {
+ if (pos >= outlen) {
+ free(dest);
return NULL;
}