示例#1
0
void ipc_parse_tm(struct ipc_client* client, struct modem_io *ipc_frame)
{
	DEBUG_I("Entering");

    DEBUG_I("leaving");

}
示例#2
0
void ipc_sms_send_status(void* data)
{
	LOGE("%s: test me!", __func__);
	tapiNettextCallBack* callBack = (tapiNettextCallBack*)(data);

	RIL_SMS_Response response;

	memset(&response, 0, sizeof(response));
	response.messageRef = 0;
	response.ackPDU = NULL;

	switch(callBack->status){
		case 0:
			DEBUG_I("%s : Message sent  ", __func__);
			response.errorCode = -1;
			ril_request_complete(ril_data.tokens.outgoing_sms, RIL_E_SUCCESS, &response, sizeof(response));
			return;

		default:
			DEBUG_I("%s : Message sending error  ", __func__);
			response.errorCode = 500;
			ril_request_complete(ril_data.tokens.outgoing_sms, RIL_E_GENERIC_FAILURE, &response, sizeof(response));
			return;
	}

}
示例#3
0
void ipc_parse_boot(struct ipc_client *client, struct modem_io *ipc_frame)
{
	DEBUG_I("Inside ipc_parse_boot\n");
	int retval, count;
	
    DEBUG_I("Inside ipc_parse_boot leaving\n");

}
示例#4
0
void ipc_parse_dbg_level(struct ipc_client *client, struct modem_io *ipc_frame)
{
	DEBUG_I("Inside ipc_parse_dbg_level\n");

	ipc_send_debug_level(1);
	/* Initialize AMSS in LPM mode by default, we'll initialize network interfaces on RIL request */
	ipc_send_lpm_mode(1);
	syssec_send_imei();
	ipc_send_lazy_fw_ver();
	DEBUG_I("Inside ipc_parse_dbg_level leaving\n");

}
示例#5
0
void ipc_parse_syssec(struct ipc_client* client, struct modem_io *ipc_frame)
{
	DEBUG_I("Entering");

	struct sysSecPacketHeader *rx_header;

    rx_header = (struct sysSecPacketHeader*)(ipc_frame->data);

	DEBUG_I("Syssec packet type = 0x%x\n  Syssec packet unk1 = 0x%X\n  packet length = 0x%X, unk2= 0x%X", rx_header->type, rx_header->unknown1, rx_header->bufLen, rx_header->unknown2);
	ipc_hex_dump(client, ipc_frame->data, rx_header->bufLen);
	DEBUG_I("Exiting");
}
示例#6
0
void ipc_dispatch(struct ipc_client *client, struct modem_io *ipc_frame)
{
	switch(ipc_frame->cmd)
    {
		case FIFO_PKT_SIM:
			ipc_parse_sim(client, ipc_frame);
		break;
		case FIFO_PKT_PROTO:
			ipc_parse_proto(client, ipc_frame);
		break;
        case FIFO_PKT_TAPI:
        	ipc_parse_tapi(client, ipc_frame);
        break;
        case FIFO_PKT_FILE:
        	ipc_parse_fm(client, ipc_frame);
			/*
        	if (ret)
        	{
        		modem_send_tapi_init(ipc_frame);
        		sim_atk_open(0);
        		sim_open_to_modem(0);
        	}*/
        break;
		case FIFO_PKT_SOUND:
            ipc_parse_sound(client, ipc_frame);
		break;
        case FIFO_PKT_DVB_H_DebugLevel:
            ipc_parse_dbg_level(client, ipc_frame);
        break;
        case FIFO_PKT_BOOT:
            ipc_parse_boot(client, ipc_frame);
        break;
		case FIFO_PKT_SYSTEM:
			ipc_parse_system(client, ipc_frame);
		break;
        case FIFO_PKT_DRV:
        	ipc_parse_drv(client, ipc_frame);
        break;
        case FIFO_PKT_DEBUG:
        	ipc_parse_dbg(client, ipc_frame);
        break;
        default :
        	DEBUG_I("Packet type 0x%x not yet handled\n", ipc_frame->cmd);
        	DEBUG_I("Frame header = 0x%x\n Frame type = 0x%x\n Frame length = 0x%x\n", 
			ipc_frame->magic, ipc_frame->cmd, ipc_frame->datasize);
        	ipc_hex_dump(client, ipc_frame->data, ipc_frame->datasize);

    }
}
示例#7
0
void ipc_sim_io_response(void* data)
{
	ALOGE("%s: test me!", __func__);

	char *response, *a;
	uint8_t *buf;
	int i, dataLen;
	RIL_SIM_IO_Response sim_io_response;
	

	sim_data_response* resp = (sim_data_response*)(data);

	ALOGE("%s: FileId = %X", __func__, resp->simDataType);
	ALOGE("%s: bufLen = %d", __func__, resp->bufLen);

	buf = (uint8_t *)data + sizeof(sim_data_response);

	dataLen = resp->bufLen;

	if (resp->simDataType == 0x6f42 && ril_data.smsc_number[0] == 0)
	{

		for (i = dataLen - 15; i < dataLen - (int)buf[dataLen - 15]; i++)
		{
			asprintf(&a, "%02x", buf[i]);
			strcat(ril_data.smsc_number,a);
		}
		DEBUG_I("%s : SMSC number: %s", __func__, ril_data.smsc_number);
		return;				
	}
	
	response = malloc((dataLen * 2) + 1);
	memset(response, 0, (dataLen * 2) + 1);

	for (i = 0; i < dataLen; i++)
	{
		asprintf(&a, "%02x", buf[i]);
		strcat(response,a);
	}
	DEBUG_I("%s : SIM_IO_RESPONSE: %s", __func__, response);
	sim_io_response.sw1 = 144;
	sim_io_response.sw2 = 0;
	sim_io_response.simResponse = response;
//	ril_request_complete(token, RIL_E_SUCCESS, &sim_io_response, sizeof(sim_io_response));
	free(response);
}
示例#8
0
void ipc_parse_system(struct ipc_client *client, struct modem_io *ipc_frame)
{
	DEBUG_I("received SYSTEM packet with AMSS version, notifying RIL that AMSS has initialized");
	uint32_t desc_size;
	int suffix_size;
	desc_size = strlen((const char*)ipc_frame->data);
	if(desc_size > 32 || desc_size > ipc_frame->datasize)
		DEBUG_E("too big desc_size: %d", desc_size);
	else
		memcpy(cached_sw_version, ipc_frame->data, desc_size);
	cached_sw_version[desc_size] = 0x00;
	suffix_size = ipc_frame->datasize - desc_size - 1;
	if(suffix_size > 0) {
		DEBUG_I("dumping rest of data from IPC_SYSTEM packet");
		ipc_hex_dump(client, ipc_frame->data+desc_size+1, suffix_size);
	}
	ipc_invoke_ril_cb(CP_SYSTEM_START, ipc_frame->data);
}
示例#9
0
void ipc_pin_status(void* data)
{
	ALOGE("%s: test me!", __func__);
	pinStatus* pinSt = (pinStatus*)(data);
	int attempts = -1;
	switch(pinSt->status){
		case 0:
			DEBUG_I("%s : Correct password ", __func__);
			ril_request_complete(ril_data.tokens.pin_status, RIL_E_SUCCESS, &attempts, sizeof(attempts));
			return;
		case 1:
			DEBUG_I("%s : Wrong password ", __func__);
			attempts = pinSt->attempts;
			ril_request_complete(ril_data.tokens.pin_status, RIL_E_PASSWORD_INCORRECT, &attempts, sizeof(attempts));
			return;
		case 2:
			DEBUG_I("%s : Wrong password and no attempts left!", __func__);
			attempts = 0;
			ril_request_complete(ril_data.tokens.pin_status, RIL_E_PASSWORD_INCORRECT, &attempts, sizeof(attempts));
			sim_status(4);
			return;	
	}
}
示例#10
0
void load_sec_data()
{
	uint8_t data[150];
	uint8_t real_imei[9]; 	
	int i;
	DEBUG_I("Loading dat stuff.");
	get_nvm_data(data, 150);

	if (data[137] == 0x08)
	{
		DEBUG_I("Real IMEI exist in nv_data");
		for (i = 0; i < 9; i++) {
			real_imei[i] = data[i+137];}
		memcpy(cached_bcd_imei, real_imei, 9);

		
	}else{
		DEBUG_I("We are using fake IMEI");
		memcpy(cached_bcd_imei, fake_imei, 9);
	}
	
	DEBUG_I("Converting IMEI out of dat stuff to ASCII.");
	imei_bcd2ascii(cached_imei, cached_bcd_imei);
}
示例#11
0
void tapi_at_parser(uint16_t tapiAtType, uint32_t tapiAtLength, uint8_t *tapiAtData)
{
	struct tapiPacket tx_packet;

	struct modem_io request;
    uint8_t *frame;
    uint8_t *payload;
    uint32_t frame_length;

    switch(tapiAtType)
    {
    default:
		DEBUG_I("TapiAT Packet type 0x%X is not yet handled, len = 0x%x", tapiAtType, tapiAtLength);
		hex_dump(tapiAtData, tapiAtLength);
    	break;
    }
}
示例#12
0
	void XlsReader::parseXls( const string &filePath ){
		m_SheetArray.clear();

		xlsWorkBook *p_Wb;
		xlsWorkSheet *p_Ws;

		p_Wb = xls_open( filePath.c_str(), "UTF-8" );
		if(  p_Wb == NULL ){
			DEBUG_I("parse failed [ " << filePath << "] ");
		}

		for(  int indexOfSheet = 0; indexOfSheet < p_Wb->sheets.count; ++indexOfSheet ){
			p_Ws = xls_getWorkSheet( p_Wb, indexOfSheet );
			xls_parseWorkSheet( p_Ws );

			m_SheetArray.push_back(  XlsSheet(*p_Ws) );

			xls_close_WS( p_Ws );  // 源码示例中没有进行delete,只有close函数。
		}

		xls_close_WB( p_Wb);  // 源码示例中没有进行delete,只有close函数。
	}
示例#13
0
/**
 * In: RIL_REQUEST_SEND_SMS
 *   Send an SMS message.
 *
 * Out: TAPI_NETTEXT_SEND
 */
void ril_request_send_sms(RIL_Token t, void *data, size_t length)
{
	tapiNettextInfo* mess;
	char *pdu, *a, *message;
	unsigned char *smsc, *pdu_hex, *p, *message_tmp;
	int smsc_length, pdu_length, pdu_hex_length, i, numberLen, send_msg_type;

	if (data == NULL || length < 2 * sizeof(char *))
		return;

	pdu = ((char **) data)[1];
	pdu_length = 0;

	if (pdu != NULL) {
		pdu_length = strlen(pdu) + 1;
		pdu = strdup(pdu);
	}

	/* We first need to get SMS SVC before sending the message */

	smsc_length = strlen((char *) ril_data.smsc_number);
	smsc = (unsigned char *) strdup((char *) ril_data.smsc_number);

	if (pdu == NULL || pdu_length <= 0 || smsc == NULL || smsc_length <= 0) {
		LOGE("Provided PDU or SMSC is invalid! Aborting");
		ril_request_complete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
		return;
	}

	if ((pdu_length / 2 + smsc_length) > 0xfe) {
		LOGE("PDU or SMSC too large, aborting");
		ril_request_complete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
		return;
	}

	pdu_hex_length = pdu_length % 2 == 0 ? pdu_length / 2 :	(pdu_length ^ 1) / 2;

	pdu_hex = calloc(1, pdu_hex_length);

	hex2bin(pdu, pdu_length, pdu_hex);

	send_msg_type = 0;

	/* PDU operations */

	int pdu_tp_da_index = 2;

	unsigned char pdu_tp_da_len = pdu_hex[pdu_tp_da_index];

	if (pdu_tp_da_len > 0xff / 2) {

		LOGE("PDU TP-DA Len failed (0x%x)\n", pdu_tp_da_len);

		goto pdu_end;

	}

	LOGD("PDU TP-DA Len is 0x%x\n", pdu_tp_da_len);

	int pdu_tp_udh_index = pdu_tp_da_index + pdu_tp_da_len / 2 + 5;

	if (pdu_tp_da_len % 2 > 0)
		pdu_tp_udh_index += 1;
		

	unsigned char pdu_tp_udh_len = pdu_hex[pdu_tp_udh_index];

	if (pdu_tp_udh_len > 0xff / 2 || pdu_tp_udh_len < 5) {

		LOGE("PDU TP-UDH Len failed (0x%x)\n", pdu_tp_udh_len);

		goto pdu_end;

	}

	LOGD("PDU TP-UDH Len is 0x%x\n", pdu_tp_udh_len);

	int pdu_tp_udh_num_index = pdu_tp_udh_index + 4;

	unsigned char pdu_tp_udh_num = pdu_hex[pdu_tp_udh_num_index];

	if (pdu_tp_udh_num > 0xf) {

		LOGE("PDU TP-UDH Num failed (0x%x)\n", pdu_tp_udh_num);

		goto pdu_end;

	}

	int pdu_tp_udh_seq_index = pdu_tp_udh_index + 5;

	unsigned char pdu_tp_udh_seq = pdu_hex[pdu_tp_udh_seq_index];

	if (pdu_tp_udh_seq > 0xf || pdu_tp_udh_seq > pdu_tp_udh_num) {

		LOGE("PDU TP-UDH Seq failed (0x%x)\n", pdu_tp_udh_seq);

		goto pdu_end;

	}

	LOGD("We are sending message %d on %d\n", pdu_tp_udh_seq, pdu_tp_udh_num);

	if (pdu_tp_udh_num > 1) {

		LOGD("We are sending a multi-part message!");

		send_msg_type = 1; //multi-part

	}


	pdu_end:

	DEBUG_I("%s : pdu : %s", __func__, pdu);

	numberLen = (uint8_t)pdu_tp_da_len;	

	mess = (tapiNettextInfo *)malloc(sizeof(tapiNettextInfo));
	memset(mess, 0, sizeof(tapiNettextInfo));

	mess->NPI_ToNumber= 0x01; // 01

	if (pdu_hex[pdu_tp_da_index + 1] == 0x91)
		mess->TON_ToNumber= 0x01; // 01 - international
	else
		mess->TON_ToNumber= 0x00; // 00 - national

	mess->lengthToNumber = numberLen;

	if (numberLen % 2 > 0)
		numberLen = numberLen + 1;
		
	i = 0;
	
	while (i < numberLen)
	{
		mess->szToNumber[i] = pdu[i + 9];
		if ( pdu[i + 8] != 'f')
		mess->szToNumber[i+1] =pdu[i + 8]; 	
		i = i + 2;		
	}


	mess->scTime = time(NULL);

	mess->NPI_SMSC = 0x01;

	if (smsc[2] == 0x39 && smsc [3] == 0x31)
		mess->TON_SMSC = 0x01; // 01 - international
	else
		mess->TON_SMSC= 0x00; // 00 - national

	if (smsc[smsc_length - 2] == 'f' || smsc[smsc_length - 2] == 'F')
		mess->lengthSMSC = smsc_length - 5;
	else
		mess->lengthSMSC = smsc_length - 4;

	i = 4;

	while (i < smsc_length)
	{
		mess->SMSC[i - 4] = smsc[i + 1];
		if ( smsc[i] != 'f')
		mess->SMSC[i - 3] =smsc[i]; 	
		i = i + 2;		
	}

	if (pdu_hex[0] == 0x21 || pdu_hex[0] == 0x61)
		mess->bSRR = 0x01;

	mess->validityValue = 0xFF; //FF

	mess->classType = 0x04; //04	

	if (send_msg_type == 1)
	{
		mess->nUDH = 0x01; //multipart SMS
		mess->bUDHI = 0x01;
		mess->messageLength = pdu_hex[(numberLen / 2) + 6] - 1;
	}
	else
		mess->messageLength = pdu_hex[(numberLen / 2) + 6];
	
	if (pdu_hex[(numberLen / 2) + 5] == 8)
	{
		DEBUG_I("%s : DCS - Unicode", __func__);
		mess->alphabetType = 0x03; //Unicode
		if (send_msg_type == 0)
		{
			int k = (numberLen / 2) + 7;
			for (i = 0; i < pdu_hex[(numberLen / 2) + 6]; i++)
				mess->messageBody[i] = pdu_hex[i + k];
		}
		else 
		{
			int k = (numberLen / 2) + 8;
			for (i = 0; i < pdu_hex[(numberLen / 2) + 6] - 1; i++)
				mess->messageBody[i] = pdu_hex[i + k];
		}	
	} else {
		DEBUG_I("%s : DCS - GSM7", __func__);
		mess->alphabetType = 0x00; //GSM7
		int k = (numberLen / 2) + 7;

		message_tmp = malloc(((pdu_hex[(numberLen / 2) + 6]) * 2) + 1);
		memset(message_tmp, 0, ((pdu_hex[(numberLen / 2) + 6]) * 2) + 1);
			for (i = 0; i < pdu_hex[(numberLen / 2) + 6]; i++)
				message_tmp[i] = pdu_hex[i + k];

		gsm72ascii(message_tmp, &message, pdu_hex[(numberLen / 2) + 6]);
		
		if (send_msg_type == 0)
		{

			for (i = 0; i < pdu_hex[(numberLen / 2) + 6]; i++)
				mess->messageBody[i] = message[i];
		}
		else
		{
			mess->messageLength = mess->messageLength - 1;
			for (i = 0; i < pdu_hex[(numberLen / 2) + 6] - 2; i++)
				mess->messageBody[i] = message[i + 2];
			for (i = 0; i < 5; i++)
				mess->messageBody[i] = pdu_hex[(numberLen / 2) + 8 + i];

		}

		free(message_tmp);

	}

	tapi_nettext_set_net_burst(0);
	tapi_nettext_send((uint8_t *)mess);
	
	ril_data.tokens.outgoing_sms = t;

	if (pdu != NULL)
		free(pdu);

	if (smsc != NULL)
		free(smsc);

	if (mess != NULL)	
		free(mess);

	if (pdu_hex != NULL)
		free(pdu_hex);
}
示例#14
0
void ipc_incoming_sms(void* data)
{
	tapiNettextInfo* nettextInfo = (tapiNettextInfo*)(data);
	char *number_smsc, *da_len, *sca, *a, *b;
	char *number_oa, *tp_oa;
	char *pdu_type, *tp_pid, *tp_dcs, *tp_udl, *tp_ud, *message; 
	char tp_scts[15];
	char pdu[400];
	char c[3];
	char *number, *number2, *len_char;
	char *message_tmp, *number_tmp, *message_bin;
	uint8_t *mess, dcs;
	unsigned int i , len_sca, len_oa, message_length, len_mess;
	char buf[50];
	time_t l_time;

	number_tmp = NULL;
	message_tmp = NULL;
	
	memset(tp_scts, 0, sizeof(tp_scts));
	memset(pdu, 0, sizeof(pdu));
	memset(c, 0, sizeof(c));

	/* Convert sms packet to SMS-DELIVER PDU type  format
	SMS = SCA + TPDU */
	
	//SCA
	//Convert nettextInfo->serviceCenter to SCA
	
	number_smsc = nettextInfo->SMSC;
	if ((strlen(number_smsc) % 2) > 0) 
		strcat(number_smsc, "F");

	number = malloc(strlen(number_smsc) + 1);
	memset(number, 0, strlen(number_smsc) + 1);

	i = 0;	
	
	while (i < strlen(number_smsc)) 
	{
		a = &(number_smsc[i+1]);
		strncat(number, a, 1);
		b = &(number_smsc[i]);
		strncat(number, b, 1);
		i = i + 2;
	}

	sca = malloc(strlen(number) + 5);
	memset(sca, 0, strlen(number) + 5);

	len_sca =  (strlen(number) / 2 ) + 1;
	asprintf(&len_char, "%02X", len_sca);
	strcat(sca, len_char);
	strcat(sca, "91");
	strcat(sca, number);

	DEBUG_I("%s : sca = %s", __func__, sca);

	strcat (pdu, sca);

	if (number != NULL)	
		free (number);

	if (sca != NULL)	
		free (sca);

	len_char = NULL;
	

	//TPDU

	/* Protocol Data Unit Type (PDU Type) 
	SMS-DELIVER

	TP-MTI:   00
	TP-MMS:   04
	TP-SRI:   20
	TP-RP:    00
	TP-UDHI:  00		*/

	if (nettextInfo->dischargeTime == 0x00)
	{
		if (nettextInfo->nUDH == 1)
		{
			pdu_type = "44";
		}
		else 
		{
			pdu_type = "04";
		}
		DEBUG_I("%s : pdu_type = %s", __func__, pdu_type);		
		strcat (pdu, pdu_type);
	}

	else
	{
		pdu_type = "06";
		DEBUG_I("%s : pdu_type = %s", __func__, pdu_type);		
		strcat (pdu, pdu_type);
		strcat (pdu, "00");

	}



	// TP-OA: TP- Originating-Address
	//Convert nettextInfo->phoneNumber to TP-OA

	number_oa = nettextInfo->szFromNumber;

	if (nettextInfo->TON_FromNumber == 5 )
	{	
		ascii2gsm7(number_oa, (unsigned char **)&number_tmp, strlen(number_oa));

		number2 = malloc((strlen(number_tmp)* 2) + 1);
		memset(number2, 0, (strlen(number_tmp)* 2) + 1);
		
		bin2hex((unsigned char *)number_tmp, strlen(number_tmp), number2);

		tp_oa = malloc(strlen(number2)  + 5);
		memset(tp_oa, 0, strlen(number2) + 5);

		asprintf(&len_char, "%02X", strlen(number2));
		strcat(tp_oa, len_char);
		strcat(tp_oa, "D0");
		strcat(tp_oa, number2);
		DEBUG_I("%s : tp_oa = %s", __func__, tp_oa);		
	} else {
		len_oa =  strlen(number_oa);

		if ((strlen(number_oa) % 2) > 0) 
			strcat(number_oa, "F");

		number2 = malloc(strlen(number_oa) + 1);
		memset(number2, 0, strlen(number_oa) + 1);

		i = 0;	
		while (i < strlen(number_oa)) 
		{
			a = &(number_oa[i+1]);
			strncat(number2, a, 1);
			b = &(number_oa[i]);
			strncat(number2, b, 1);
			i = i + 2;
		}
	
		tp_oa = malloc(strlen(number2) + 5);
		memset(tp_oa, 0, strlen(number2) + 5);
		asprintf(&len_char, "%02X", len_oa);
		strcat(tp_oa, len_char);
			if (nettextInfo->TON_FromNumber == 1 )	
				strcat(tp_oa, "91");
			else
				strcat(tp_oa, "81");
		strcat(tp_oa, number2);
		DEBUG_I("%s : tp_oa = %s", __func__, tp_oa);
	}

	strcat (pdu, tp_oa);

	if (number2 != NULL)	
		 free (number2);

	if (tp_oa != NULL)	
		free (tp_oa);

	len_char = NULL;

	//TP-PID : TP-Protocol-Identifier 

	if (nettextInfo->dischargeTime == 0x00)
	{
		tp_pid = "00";
		strcat (pdu, tp_pid);
	}

	//TP-SCTS: TP-Service-Centre-Time-Stamp
	//Convert nettextInfo->timestamp and nettextInfo->time_zone to TP-SCTS
	
	l_time = nettextInfo->scTime;

	strftime(buf, sizeof(buf), "%y%m%d%H%M%S", gmtime(&l_time));

	asprintf(&a, "%02d", nettextInfo->time_zone);

	strcat(buf, a);

	i = 0;
	while (i < 14) 
	{
		a = &(buf[i+1]);
		strncat(tp_scts, a, 1);
		b = &(buf[i]);
		strncat(tp_scts, b, 1);
		i = i + 2;
	}

	DEBUG_I("%s : scTime = %s", __func__, tp_scts);

	if (nettextInfo->dischargeTime != 0x00)
	{
		strcat (pdu, tp_scts);
		
		memset(tp_scts, 0, 15);
	
		l_time = nettextInfo->dischargeTime;

		strftime(buf, sizeof(buf), "%y%m%d%H%M%S", gmtime(&l_time));

		asprintf(&a, "%02d", nettextInfo->time_zone);

		strcat(buf, a);

			i = 0;
		while (i < 14) 
		{
			a = &(buf[i+1]);
			strncat(tp_scts, a, 1);
			b = &(buf[i]);
			strncat(tp_scts, b, 1);
			i = i + 2;
		}

		DEBUG_I("%s : dischargeTime = %s", __func__, tp_scts);

		strcat (pdu, tp_scts);
		
		if (nettextInfo->statusReport == 0)
			strcat (pdu, "00"); 
		else 
			strcat (pdu, "01");

		DEBUG_I("%s : pdu = %s", __func__, pdu);
	
		ril_request_unsolicited(RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT, pdu, strlen(pdu));

		return;
	}
 
	//TP-UD: TP-User Data
	//Convert messageBody to TP-UD

	mess = nettextInfo->messageBody;
	message_length = nettextInfo->messageLength;

	message = malloc((message_length * 2) + 3);
	memset(message, 0, (message_length * 2) + 3);

	i = 0;

	if (nettextInfo->nUDH == 1)
	{
		strcat(message, "05");
		message_length += 1; 
	}
		
	while (i < nettextInfo->messageLength)
	{
		sprintf(c, "%02X",mess[i]);
		strcat(message, c);
		i++;
	}

	if (nettextInfo->alphabetType == 3) 
	{
		/*TP-DCS: TP-Data-Coding-Scheme */
		dcs = 0x08; //Unicode
		DEBUG_I("%s : TP-DCS = Unicode", __func__);

		tp_ud = malloc(strlen(message) + 2);
		memset(tp_ud, 0, strlen(message) + 2);

		strcat(tp_ud,message);
	} else {
		/*TP-DCS: TP-Data-Coding-Scheme */
		dcs = 0x00; //gsm7
		DEBUG_I("%s : TP-DCS = GSM7", __func__);

		if (nettextInfo->nUDH == 1)
		{
			message_bin = malloc(strlen(message) + 3);
			memset(message_bin, 0, strlen(message) + 3);

			strcat(message_bin, "0000000");
			strcat(message_bin, (char *)(mess + 5));

			len_mess = ascii2gsm7(message_bin, (unsigned char **)&message_tmp, strlen(message) + 2);

			tp_ud = malloc(len_mess  + 1);
			memset(tp_ud, 0, len_mess + 1);

			bin2hex((unsigned char *)(message_tmp), len_mess / 2, tp_ud);
			
			i = 0;
			while (i < 12)
			{
				tp_ud[i] = message[i];
				i++;
			}

			message_length += 1; 

			if (message_bin != NULL)	
				free(message_bin);
		}	
		else
		{
			len_mess = ascii2gsm7((char *)mess, (unsigned char **)&message_tmp, strlen(message));

			tp_ud = malloc(len_mess + 1);
			memset(tp_ud, 0, len_mess + 1);

			bin2hex((unsigned char *)message_tmp, len_mess / 2, tp_ud);		
		}
	}

	DEBUG_I("%s : tp_ud = %s", __func__, tp_ud);

	if (nettextInfo->bFlash == 1) 
		dcs += 0x10;
	asprintf(&tp_dcs, "%02X", dcs);

	//TP-UDL:TP-User-Data-Length

	asprintf(&tp_udl, "%02X", message_length);
	DEBUG_I("%s : tp_udl = %s", __func__, tp_udl);

	strcat (pdu, tp_dcs);
	strcat (pdu, tp_scts);
	strcat (pdu, tp_udl);	
	strcat (pdu, tp_ud);

	DEBUG_I("%s : pdu = %s", __func__, pdu);
	
	ril_request_unsolicited(RIL_UNSOL_RESPONSE_NEW_SMS, pdu, strlen(pdu));

	if (message != NULL)	
		free (message);

	if (tp_ud != NULL)	
		free (tp_ud);
}