4 * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
27 * SMS APIs allow a client to accomplish the following features: @n
28 * - Send, Recieve, Save, Delete, Read short messages @n
29 * - Set and Get information like Service Center Address, Cell Broadcast configuration,Preferred Bearer, SMS parameters @n
30 * - Retrieve information like Current Memory selected, NetTextCount related to the messages @n
31 * - Set delivery report @n
38 #include "tapi_common.h"
39 #include "TapiUtility.h"
44 #include "ITapiNetText.h"
46 static void on_response_default(GObject *source_object, GAsyncResult *res, gpointer user_data)
49 GDBusConnection *conn = NULL;
50 struct tapi_resp_data *evt_cb_data = user_data;
53 GVariant *dbus_result = NULL;
56 conn = G_DBUS_CONNECTION (source_object);
57 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
63 if (evt_cb_data->cb_fn) {
64 evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
76 dbg("on_response_default type_format(%s)", g_variant_get_type_string(dbus_result));
78 g_variant_get (dbus_result, "(i)", &result);
81 if (evt_cb_data->cb_fn) {
82 evt_cb_data->cb_fn(evt_cb_data->handle, result, &data, evt_cb_data->user_data);
89 static void on_response_read_msg(GObject *source_object, GAsyncResult *res, gpointer user_data)
92 GDBusConnection *conn = NULL;
93 struct tapi_resp_data *evt_cb_data = user_data;
96 TelSmsData_t readMsg = {0,};
98 GVariant *dbus_result = NULL;
99 const char *sca = NULL;
100 const char *tpdu = NULL;
102 guchar *decoded_sca = NULL;
103 guchar *decoded_tpdu = NULL;
105 conn = G_DBUS_CONNECTION (source_object);
106 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
111 if (evt_cb_data->cb_fn) {
112 evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
124 dbg("on_response_read_msg type_format(%s)", g_variant_get_type_string(dbus_result));
126 // readMsg.SimIndex = 0xFFFFFFFF;
127 g_variant_get (dbus_result, "(iiisis)", &result,
131 &readMsg.SmsData.MsgLength,
134 decoded_sca = g_base64_decode(sca, &length);
136 memcpy(&(readMsg.SmsData.Sca[0]), decoded_sca, TAPI_SMS_ENCODED_SCA_LEN_MAX);
140 decoded_tpdu = g_base64_decode(tpdu, &length);
142 memcpy(&(readMsg.SmsData.szData[0]), decoded_tpdu, TAPI_NETTEXT_SMDATA_SIZE_MAX + 1);
143 g_free(decoded_tpdu);
147 if (evt_cb_data->cb_fn) {
148 evt_cb_data->cb_fn(evt_cb_data->handle, result, &readMsg, evt_cb_data->user_data);
155 static void on_response_write_msg(GObject *source_object, GAsyncResult *res, gpointer user_data)
157 GError *error = NULL;
158 GDBusConnection *conn = NULL;
159 struct tapi_resp_data *evt_cb_data = user_data;
163 GVariant *dbus_result = NULL;
165 conn = G_DBUS_CONNECTION (source_object);
166 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
171 if (evt_cb_data->cb_fn) {
172 evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
184 dbg("on_response_write_msg type_format(%s)", g_variant_get_type_string(dbus_result));
186 g_variant_get (dbus_result, "(ii)", &result, &index);
189 if (evt_cb_data->cb_fn) {
190 evt_cb_data->cb_fn(evt_cb_data->handle, result, &index, evt_cb_data->user_data);
197 static void on_response_delete_msg(GObject *source_object, GAsyncResult *res, gpointer user_data)
199 GError *error = NULL;
200 GDBusConnection *conn = NULL;
201 struct tapi_resp_data *evt_cb_data = user_data;
205 GVariant *dbus_result = NULL;
207 conn = G_DBUS_CONNECTION (source_object);
208 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
213 if (evt_cb_data->cb_fn) {
214 evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
226 dbg("on_response_delete_msg type_format(%s)", g_variant_get_type_string(dbus_result));
228 g_variant_get (dbus_result, "(ii)", &result, &index);
231 if (evt_cb_data->cb_fn) {
232 evt_cb_data->cb_fn(evt_cb_data->handle, result, &index, evt_cb_data->user_data);
239 static void on_response_get_msg_count(GObject *source_object, GAsyncResult *res, gpointer user_data)
241 GError *error = NULL;
242 GDBusConnection *conn = NULL;
243 struct tapi_resp_data *evt_cb_data = user_data;
245 TelSmsStoredMsgCountInfo_t storedMsgCnt = {0,};
247 GVariant *dbus_result = NULL;
248 const char *indexList = NULL;
250 guchar *decoded_indexList = NULL;
252 conn = G_DBUS_CONNECTION (source_object);
253 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
258 if (evt_cb_data->cb_fn) {
259 evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
271 dbg("on_response_get_msg_count type_format(%s)", g_variant_get_type_string(dbus_result));
273 g_variant_get (dbus_result, "(iiis)", &result,
274 &storedMsgCnt.TotalCount,
275 &storedMsgCnt.UsedCount,
278 decoded_indexList = g_base64_decode(indexList, &length);
279 if (decoded_indexList) {
280 memcpy(&(storedMsgCnt.IndexList[0]), decoded_indexList, TAPI_NETTEXT_GSM_SMS_MSG_NUM_MAX);
281 g_free(decoded_indexList);
285 if (evt_cb_data->cb_fn) {
286 evt_cb_data->cb_fn(evt_cb_data->handle, result, &storedMsgCnt, evt_cb_data->user_data);
294 static void on_response_get_sca(GObject *source_object, GAsyncResult *res, gpointer user_data)
296 GError *error = NULL;
297 GDBusConnection *conn = NULL;
298 struct tapi_resp_data *evt_cb_data = user_data;
300 TelSmsAddressInfo_t scaInfo = {0,};
302 GVariant *dbus_result = NULL;
303 const char *sca = NULL;
305 guchar *decoded_sca = NULL;
307 conn = G_DBUS_CONNECTION (source_object);
308 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
313 if (evt_cb_data->cb_fn) {
314 evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
326 dbg("on_response_get_sca type_format(%s)", g_variant_get_type_string(dbus_result));
328 g_variant_get (dbus_result, "(iiiis)", &result,
334 decoded_sca = g_base64_decode(sca, &length);
336 memcpy(&(scaInfo.szDiallingNum[0]), decoded_sca, TAPI_SIM_SMSP_ADDRESS_LEN + 1);
341 if (evt_cb_data->cb_fn) {
342 evt_cb_data->cb_fn(evt_cb_data->handle, result, &scaInfo, evt_cb_data->user_data);
349 static void on_response_get_cb_config(GObject *source_object, GAsyncResult *res, gpointer user_data)
351 GError *error = NULL;
352 GDBusConnection *conn = NULL;
353 struct tapi_resp_data *evt_cb_data = user_data;
356 TelSmsCbConfig_t cbConfig = {0,};
358 GVariant *dbus_result = NULL;
359 GVariant *value = NULL;
360 GVariantIter *iter = NULL;
361 GVariantIter *iter_row = NULL;
362 const gchar *key = NULL;
364 conn = G_DBUS_CONNECTION (source_object);
365 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
370 if (evt_cb_data->cb_fn) {
371 evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
383 dbg("on_response_get_cb_config type_format(%s)", g_variant_get_type_string(dbus_result));
385 g_variant_get (dbus_result, "(iiiiiaa{sv})", &result,
386 &cbConfig.Net3gppType,
388 &cbConfig.MsgIdMaxCount,
389 &cbConfig.MsgIdRangeCount,
393 while (g_variant_iter_next(iter, "a{sv}", &iter_row)) {
394 while (g_variant_iter_loop(iter_row, "{sv}", &key, &value)) {
395 if (!g_strcmp0(key, "FromMsgId")) {
396 cbConfig.MsgIDs[i].Net3gpp.FromMsgId = g_variant_get_uint16(value);
398 if (!g_strcmp0(key, "ToMsgId")) {
399 cbConfig.MsgIDs[i].Net3gpp.ToMsgId = g_variant_get_uint16(value);
401 if (!g_strcmp0(key, "CBCategory")) {
402 cbConfig.MsgIDs[i].Net3gpp2.CBCategory = g_variant_get_uint16(value);
404 if (!g_strcmp0(key, "CBLanguage")) {
405 cbConfig.MsgIDs[i].Net3gpp2.CBLanguage = g_variant_get_uint16(value);
407 if (!g_strcmp0(key, "Selected")) {
408 cbConfig.MsgIDs[i].Net3gpp.Selected = g_variant_get_byte(value);
412 g_variant_iter_free(iter_row);
414 g_variant_iter_free(iter);
417 if (evt_cb_data->cb_fn) {
418 evt_cb_data->cb_fn(evt_cb_data->handle, result, &cbConfig, evt_cb_data->user_data);
425 static void on_response_get_sms_params(GObject *source_object, GAsyncResult *res, gpointer user_data)
427 GError *error = NULL;
428 GDBusConnection *conn = NULL;
429 struct tapi_resp_data *evt_cb_data = user_data;
431 TelSmsParams_t paramInfo = {0,};
433 GVariant *dbus_result = NULL;
434 const char *alphaId = NULL;
435 const char *destDialNum = NULL;
436 const char *scaDialNum = NULL;
438 guchar *decoded_alphaId = NULL;
439 guchar *decoded_destDialNum = NULL;
440 guchar *decoded_scaDialNum = NULL;
442 conn = G_DBUS_CONNECTION (source_object);
443 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
448 if (evt_cb_data->cb_fn) {
449 evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
461 dbg("on_response_get_sms_params type_format(%s)", g_variant_get_type_string(dbus_result));
463 g_variant_get (dbus_result, "(iiiisiiiisiiisiii)", &result,
464 ¶mInfo.RecordIndex,
465 ¶mInfo.RecordLen,
466 ¶mInfo.AlphaIdLen,
468 ¶mInfo.ParamIndicator,
469 ¶mInfo.TpDestAddr.DialNumLen,
470 ¶mInfo.TpDestAddr.Ton,
471 ¶mInfo.TpDestAddr.Npi,
473 ¶mInfo.TpSvcCntrAddr.DialNumLen,
474 ¶mInfo.TpSvcCntrAddr.Ton,
475 ¶mInfo.TpSvcCntrAddr.Npi,
477 ¶mInfo.TpProtocolId,
478 ¶mInfo.TpDataCodingScheme,
479 ¶mInfo.TpValidityPeriod);
481 decoded_alphaId = g_base64_decode(alphaId, &length);
482 if (decoded_alphaId) {
483 memcpy(&(paramInfo.szAlphaId[0]), decoded_alphaId, TAPI_SIM_SMSP_ALPHA_ID_LEN_MAX + 1);
484 g_free(decoded_alphaId);
487 decoded_destDialNum = g_base64_decode(destDialNum, &length);
488 if (decoded_destDialNum) {
489 memcpy(&(paramInfo.TpDestAddr.szDiallingNum[0]), decoded_destDialNum, TAPI_SIM_SMSP_ADDRESS_LEN + 1);
490 g_free(decoded_destDialNum);
493 decoded_scaDialNum = g_base64_decode(scaDialNum, &length);
494 if (decoded_scaDialNum) {
495 memcpy(&(paramInfo.TpSvcCntrAddr.szDiallingNum[0]), decoded_scaDialNum, TAPI_SIM_SMSP_ADDRESS_LEN + 1);
496 g_free(decoded_scaDialNum);
500 if (evt_cb_data->cb_fn) {
501 evt_cb_data->cb_fn(evt_cb_data->handle, result, ¶mInfo, evt_cb_data->user_data);
509 static void on_response_get_sms_param_cnt(GObject *source_object, GAsyncResult *res, gpointer user_data)
511 GError *error = NULL;
512 GDBusConnection *conn = NULL;
513 struct tapi_resp_data *evt_cb_data = user_data;
517 GVariant *dbus_result = NULL;
519 conn = G_DBUS_CONNECTION (source_object);
520 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
525 if (evt_cb_data->cb_fn) {
526 evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
538 dbg("on_response_get_sms_param_cnt type_format(%s)", g_variant_get_type_string(dbus_result));
540 g_variant_get (dbus_result, "(ii)", &result,
544 if (evt_cb_data->cb_fn) {
545 evt_cb_data->cb_fn(evt_cb_data->handle, result, &recordCount, evt_cb_data->user_data);
554 * This function enables the applications to send SMS to the network.
556 * @return Returns appropriate error code. Refer TapiResult_t .
557 * @param[in] pDataPackage - SMS-SUBMIT TPDU or SMS-COMMAND, and its length have to be passed in this structure.
558 * tapi_sms_more_to_send_t parameter denotes whether the sms is short or concatenated.
560 * @param[out] RequestId-Unique identifier for a particular request
561 * Its value can be any value from 0 to 255 if the API is returned successfully
562 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
563 * @Interface Asynchronous.
565 * @Refer tapi_sms_datapackage, tapi_sms_more_to_send_t.
567 EXPORT_API int tel_send_sms(struct tapi_handle *handle,
568 const TelSmsDatapackageInfo_t *pDataPackage,
570 tapi_response_cb callback, void* user_data)
572 struct tapi_resp_data *evt_cb_data = NULL;
574 gchar *encoded_sca = NULL;
575 gchar *encoded_tpdu = NULL;
577 dbg("Func Entrance ");
579 TAPI_RET_ERR_NUM_IF_FAIL(pDataPackage ,TAPI_API_INVALID_PTR);
581 if ((pDataPackage->Sca[0] > TAPI_SIM_SMSP_ADDRESS_LEN)
582 || (pDataPackage->MsgLength > TAPI_NETTEXT_SMDATA_SIZE_MAX))
583 return TAPI_API_INVALID_INPUT;
585 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
587 encoded_sca = g_base64_encode(&(pDataPackage->Sca[0]), TAPI_SMS_ENCODED_SCA_LEN_MAX);
588 if (encoded_sca == NULL) {
589 dbg("g_base64_encode: Failed to Enocde the SCA");
590 return TAPI_API_OPERATION_FAILED;
593 encoded_tpdu = g_base64_encode(&(pDataPackage->szData[0]), pDataPackage->MsgLength);
594 if (encoded_tpdu == NULL) {
595 dbg("g_base64_encode: Failed to Enocde the TPDU");
596 return TAPI_API_OPERATION_FAILED;
599 param = g_variant_new("(sisi)", encoded_sca,
600 pDataPackage->MsgLength,
604 g_dbus_connection_call(handle->dbus_connection,
605 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
606 "SendMsg", param, NULL,
607 G_DBUS_CALL_FLAGS_NONE, 120000, handle->ca,
608 on_response_default, evt_cb_data);
611 g_free(encoded_tpdu);
613 return TAPI_API_SUCCESS;
619 * This function enables the applications to read sms from the preferred storage.
621 * @return Returns appropriate error code. Refer TapiResult_t .
622 * @param[in] index - the message to be read
624 * @param[out] RequestId-Unique identifier for a particular request
625 * Its value can be any value from 0 to 255 if the API is returned successfully
626 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
627 * @Interface Asynchronous.
628 * @remark tapi_sms_selmem_set is to be called always to select the
629 * preferred memory before calling this api.
632 EXPORT_API int tel_read_sms_in_sim(struct tapi_handle *handle, int index, tapi_response_cb callback, void* user_data)
634 struct tapi_resp_data *evt_cb_data = NULL;
637 dbg("Func Entrance ");
639 if( (index < 0) || (index > TAPI_NETTEXT_MAX_INDEX) ) {
640 err("Invalid Input -Read SMS %d",index);
642 return TAPI_API_INVALID_INPUT;
645 TAPI_RET_ERR_NUM_IF_FAIL(callback ,TAPI_API_INVALID_PTR);
647 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
649 param = g_variant_new("(i)", index);
651 g_dbus_connection_call(handle->dbus_connection,
652 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
653 "ReadMsg", param, NULL,
654 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
655 on_response_read_msg, evt_cb_data);
657 return TAPI_API_SUCCESS;
663 * This function enables the applications to write/save sms to the preferred storage.
665 * @return Returns appropriate error code. Refer TapiResult_t .
666 * @param[in] index - the message to be saved, msg_status will denote the status
667 * of the message whether Sent, Unsent, Read, Unread, Unknown.
668 * pDataPackage- the SMS-SUBMIT PDU or SMS-DELIVER,SMS-STATUSREPORT
669 * being passed to be saved in memory.
671 * @param[out] RequestId-Unique identifier for a particular request
672 * Its value can be any value from 0 to 255 if the API is returned successfully
673 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
674 * @Interface Asynchronous.
675 * @Refer tapi_sms_datapackage, tapi_sms_status_type.
677 EXPORT_API int tel_write_sms_in_sim(struct tapi_handle *handle, const TelSmsData_t *pWriteData, tapi_response_cb callback, void* user_data)
679 struct tapi_resp_data *evt_cb_data = NULL;
681 gchar *encoded_sca = NULL;
682 gchar *encoded_tpdu = NULL;
684 dbg("Func Entrance ");
686 TAPI_RET_ERR_NUM_IF_FAIL(pWriteData ,TAPI_API_INVALID_PTR);
688 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
690 encoded_sca = g_base64_encode(&(pWriteData->SmsData.Sca[0]), TAPI_SMS_ENCODED_SCA_LEN_MAX);
691 if (encoded_sca == NULL) {
692 dbg("g_base64_encode: Failed to Enocde the SCA");
693 return TAPI_API_OPERATION_FAILED;
696 encoded_tpdu = g_base64_encode(&(pWriteData->SmsData.szData[0]), TAPI_NETTEXT_SMDATA_SIZE_MAX + 1);
697 if (encoded_tpdu == NULL) {
698 dbg("g_base64_encode: Failed to Enocde the TPDU");
699 return TAPI_API_OPERATION_FAILED;
702 param = g_variant_new("(isis)", pWriteData->MsgStatus,
704 pWriteData->SmsData.MsgLength,
707 g_dbus_connection_call(handle->dbus_connection,
708 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
709 "SaveMsg", param, NULL,
710 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
711 on_response_write_msg, evt_cb_data);
714 g_free(encoded_tpdu);
716 return TAPI_API_SUCCESS;
722 * This function enables the applications to delete sms to the preferred storage.
724 * @return Returns appropriate error code. Refer TapiResult_t .
725 * @param[in] index - the message to be deleted. if index is -1, all sms in the sim are deleted.
727 * @param[out] RequestId-Unique identifier for a particular request
728 * Its value can be any value from 0 to 255 if the API is returned successfully
729 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
730 * @Interface Asynchronous.
731 * @remark tapi_sms_selmem_set has to be called always before calling this API
734 EXPORT_API int tel_delete_sms_in_sim(struct tapi_handle *handle, int index, tapi_response_cb callback, void* user_data)
736 struct tapi_resp_data *evt_cb_data = NULL;
739 dbg("Func Entrance ");
741 if ((index < -1) || (index > TAPI_NETTEXT_MAX_INDEX)) {
742 err("Invalid Index Input");
743 return TAPI_API_INVALID_INPUT;
746 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
748 param = g_variant_new("(i)", index);
750 g_dbus_connection_call(handle->dbus_connection,
751 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
752 "DeleteMsg", param, NULL,
753 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
754 on_response_delete_msg, evt_cb_data);
756 return TAPI_API_SUCCESS;
762 * This function enables the applications to get the count of the messages stored in the memory
764 * @return Returns appropriate error code. Refer TapiResult_t .
767 * @param[out] RequestId-Unique identifier for a particular request
768 * Its value can be any value from 0 to 255 if the API is returned successfully
769 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
770 * @Interface Asynchronous
771 * @remark The requested memory details come in response API
774 EXPORT_API int tel_get_sms_count(struct tapi_handle *handle, tapi_response_cb callback, void* user_data)
776 struct tapi_resp_data *evt_cb_data = NULL;
778 dbg("Func Entrance ");
780 TAPI_RET_ERR_NUM_IF_FAIL(callback ,TAPI_API_INVALID_PTR);
782 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
784 g_dbus_connection_call(handle->dbus_connection,
785 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
786 "GetMsgCount", NULL, NULL,
787 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
788 on_response_get_msg_count, evt_cb_data);
790 return TAPI_API_SUCCESS;
796 * This function enables the applications to get the service center address from the SIM storage
798 * @return Returns appropriate error code. Refer TapiResult_t .
799 * @param[in] pSCA - the service center address that is to be set in the SIM storage
800 * refer to 3GPP TS 23.040:9.1.2.5 Address fields
801 * index - the index that is to be set in the SIM storage
803 * @param[out] RequestId-Unique identifier for a particular request
804 * Its value can be any value from 0 to 255 if the API is returned successfully
805 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
806 * @Interface Asynchronous.
808 * @Refer tapi_sms_sms_addr_info
810 EXPORT_API int tel_get_sms_sca(struct tapi_handle *handle, int index, tapi_response_cb callback, void* user_data)
812 struct tapi_resp_data *evt_cb_data = NULL;
815 dbg("Func Entrance ");
817 TAPI_RET_ERR_NUM_IF_FAIL(callback ,TAPI_API_INVALID_PTR);
819 if ((index < 0) || (index > TAPI_NETTEXT_MAX_INDEX)) {
820 err("Invalid Index Input");
821 return TAPI_API_INVALID_INPUT;
824 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
826 param = g_variant_new("(i)", index);
828 g_dbus_connection_call(handle->dbus_connection,
829 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
830 "GetSca", param, NULL,
831 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
832 on_response_get_sca, evt_cb_data);
834 return TAPI_API_SUCCESS;
840 * This function enables the applications to set the service center address in the SIM storage
842 * @return Returns appropriate error code. Refer TapiResult_t .
843 * @param[in] pSCA - the service center address that is to be set in the SIM storage
844 * refer to 3GPP TS 23.040:9.1.2.5 Address fields
845 * index - the index that is to be set in the SIM storage
847 * @param[out] RequestId-Unique identifier for a particular request
848 * Its value can be any value from 0 to 255 if the API is returned successfully
849 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
850 * @Interface ASynchronous.
852 * @Refer tapi_sms_sms_addr_info
854 EXPORT_API int tel_set_sms_sca(struct tapi_handle *handle, const TelSmsAddressInfo_t *pSCA, int index, tapi_response_cb callback, void* user_data)
856 struct tapi_resp_data *evt_cb_data = NULL;
858 gchar *encoded_sca = NULL;
860 dbg("Func Entrance ");
862 TAPI_RET_ERR_NUM_IF_FAIL(pSCA ,TAPI_API_INVALID_PTR);
864 if ((index < 0) || (index > TAPI_NETTEXT_MAX_INDEX)) {
865 err("Invalid Index Input");
866 return TAPI_API_INVALID_INPUT;
869 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
871 encoded_sca = g_base64_encode(&(pSCA->szDiallingNum[0]), TAPI_SIM_SMSP_ADDRESS_LEN);
872 if (encoded_sca == NULL) {
873 dbg("g_base64_encode: Failed to Enocde the SCA");
874 return TAPI_API_OPERATION_FAILED;
877 param = g_variant_new("(iiiis)", index,
883 g_dbus_connection_call(handle->dbus_connection,
884 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
885 "SetSca", param, NULL,
886 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
887 on_response_default, evt_cb_data);
892 return TAPI_API_SUCCESS;
898 * This function enables the applications to set the configuration for cell broadcast messages
900 * @return Returns appropriate error code. Refer TapiResult_t .
903 * @param[out] RequestId-Unique identifier for a particular request
904 * Its value can be any value from 0 to 255 if the API is returned successfully
905 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
906 * @Interface Asynchronous.
910 EXPORT_API int tel_get_sms_cb_config(struct tapi_handle *handle, tapi_response_cb callback, void* user_data)
912 struct tapi_resp_data *evt_cb_data = NULL;
914 dbg("Func Entrance ");
916 TAPI_RET_ERR_NUM_IF_FAIL(callback ,TAPI_API_INVALID_PTR);
918 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
920 g_dbus_connection_call(handle->dbus_connection,
921 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
922 "GetCbConfig", NULL, NULL,
923 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
924 on_response_get_cb_config, evt_cb_data);
926 return TAPI_API_SUCCESS;
931 * This function enables the applications to set the configuration for cell broadcast messages
933 * @return Returns appropriate error code. Refer TapiResult_t .
934 * @param[in] tapi_sms_cb_config the configuration details to be set
936 * @param[out] RequestId-Unique identifier for a particular request
937 * Its value can be any value from 0 to 255 if the API is returned successfully
938 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
939 * @Interface Asynchronous.
941 * @Refer tapi_sms_cb_config
943 EXPORT_API int tel_set_sms_cb_config(struct tapi_handle *handle, const TelSmsCbConfig_t *pCBConfig, tapi_response_cb callback, void* user_data)
945 struct tapi_resp_data *evt_cb_data = NULL;
947 gchar *encoded_cbConfig = NULL;
949 dbg("Func Entrance ");
951 TAPI_RET_ERR_NUM_IF_FAIL(pCBConfig ,TAPI_API_INVALID_PTR);
953 if ((pCBConfig->Net3gppType > 2) || (pCBConfig->MsgIdRangeCount < 0)) {
954 err("Invalid Input -3gppType(%d)",pCBConfig->Net3gppType);
955 err("Invalid Input -MsgIdRangeCount(%d)",pCBConfig->MsgIdRangeCount);
957 return TAPI_API_INVALID_INPUT;
960 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
962 encoded_cbConfig = g_base64_encode((const guchar *)&(pCBConfig->MsgIDs[0]), TAPI_NETTEXT_GSM_SMS_CBMI_LIST_SIZE_MAX*5);
963 if (encoded_cbConfig == NULL) {
964 dbg("g_base64_encode: Failed to Enocde the CB Config");
965 return TAPI_API_OPERATION_FAILED;
968 param = g_variant_new("(iiiis)", pCBConfig->Net3gppType,
969 pCBConfig->CBEnabled,
970 pCBConfig->MsgIdMaxCount,
971 pCBConfig->MsgIdRangeCount,
974 g_dbus_connection_call(handle->dbus_connection,
975 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
976 "SetCbConfig", param, NULL,
977 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
978 on_response_default, evt_cb_data);
980 g_free(encoded_cbConfig);
982 return TAPI_API_SUCCESS;
987 * This function enables the applications to set the phone memory status whether full or available
989 * @return Returns appropriate error code. Refer TapiResult_t .
990 * @param[in] memory_status whether full or available
992 * @param[out] RequestId-Unique identifier for a particular request
993 * Its value can be any value from 0 to 255 if the API is returned successfully
994 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
995 * @Interface Asynchronous.
997 * @Refer tapi_sms_memstatus_type
999 EXPORT_API int tel_set_sms_memory_status(struct tapi_handle *handle, int memoryStatus, tapi_response_cb callback, void* user_data)
1001 struct tapi_resp_data *evt_cb_data = NULL;
1004 dbg("Func Entrance ");
1006 if ((memoryStatus < TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE) || (memoryStatus > TAPI_NETTEXT_PDA_MEMORY_STATUS_FULL)) {
1007 err("Invalid Input -MemoryStatus Nettext");
1008 return TAPI_API_INVALID_INPUT;
1011 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
1013 param = g_variant_new("(i)", memoryStatus);
1015 g_dbus_connection_call(handle->dbus_connection,
1016 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
1017 "SetMemStatus", param, NULL,
1018 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
1019 on_response_default, evt_cb_data);
1021 return TAPI_API_SUCCESS;
1026 * This function is used to get SMS preferred bearer on which SMS has to be transmitted. This is a synchronous function
1028 * @return TRUE in case of success and FALSE in case of error .
1031 * @param[out] requestId-Unique identifier for a particular request
1032 * Its value can be any value from 0 to 255 if the API is returned successfully
1033 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
1034 * @Interface Asynchronous.
1038 EXPORT_API int tel_get_sms_preferred_bearer(struct tapi_handle *handle, tapi_response_cb callback, void* user_data)
1040 struct tapi_resp_data *evt_cb_data = NULL;
1042 dbg("Func Entrance ");
1044 TAPI_RET_ERR_NUM_IF_FAIL(callback ,TAPI_API_INVALID_PTR);
1046 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
1048 g_dbus_connection_call(handle->dbus_connection,
1049 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
1050 "GetPrefBearer", NULL, NULL,
1051 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
1052 on_response_default, evt_cb_data);
1054 return TAPI_API_SUCCESS;
1059 * This function enables the applications to set the preferred bearer
1061 * @return Returns appropriate error code. Refer TapiResult_t .
1062 * @param[in] service option ie the bearer type to be set
1064 * @param[out] RequestId-Unique identifier for a particular request
1065 * Its value can be any value from 0 to 255 if the API is returned successfully
1066 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
1067 * @Interface Asynchronous.
1069 * @Refer tapi_sms_bearer_type
1071 EXPORT_API int tel_set_sms_preferred_bearer(struct tapi_handle *handle, TelSmsBearerType_t BearerType, tapi_response_cb callback, void* user_data)
1073 struct tapi_resp_data *evt_cb_data = NULL;
1076 dbg("Func Entrance ");
1078 if ((TAPI_NETTEXT_BEARER_PS_ONLY > BearerType) || (TAPI_NETTEXT_NO_PREFERRED_BEARER < BearerType)) {
1079 err("Invalid Input -PrefBearer Set Nettext");
1080 return TAPI_API_INVALID_INPUT;
1083 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
1085 param = g_variant_new("(i)", BearerType);
1087 g_dbus_connection_call(handle->dbus_connection,
1088 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
1089 "SetPrefBearer", param, NULL,
1090 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
1091 on_response_default, evt_cb_data);
1093 return TAPI_API_SUCCESS;
1098 * This function enables the applications to set the deliver report for an incoming message(MT).
1100 * @return Returns appropriate error code. Refer TapiResult_t .
1101 * @param[in] pDataPackage - SMS-DELIVER-REPORT, and its length have to be passed in this structure.
1102 * @param[in] RPCause - the result cause
1104 * @param[out] RequestId-Unique identifier for a particular request
1105 * Its value can be any value from 0 to 255 if the API is returned successfully
1106 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
1107 * @Interface Synchronous.
1109 * @Refer tapi_sms_deliver_report
1111 EXPORT_API int tel_send_sms_deliver_report(struct tapi_handle *handle,
1112 const TelSmsDatapackageInfo_t *pDataPackage,
1113 TelSmsResponse_t RPCause,
1114 tapi_response_cb callback, void* user_data)
1116 struct tapi_resp_data *evt_cb_data = NULL;
1118 gchar *encoded_sca = NULL;
1119 gchar *encoded_tpdu = NULL;
1121 dbg("Func Entrance ");
1123 TAPI_RET_ERR_NUM_IF_FAIL(pDataPackage ,TAPI_API_INVALID_PTR);
1125 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
1127 encoded_sca = g_base64_encode(&(pDataPackage->Sca[0]), TAPI_SMS_ENCODED_SCA_LEN_MAX);
1128 if (encoded_sca == NULL) {
1129 dbg("g_base64_encode: Failed to Enocde the SCA");
1130 return TAPI_API_OPERATION_FAILED;
1133 encoded_tpdu = g_base64_encode(&(pDataPackage->szData[0]), TAPI_NETTEXT_SMDATA_SIZE_MAX + 1);
1134 if (encoded_tpdu == NULL) {
1135 dbg("g_base64_encode: Failed to Enocde the TPDU");
1136 return TAPI_API_OPERATION_FAILED;
1139 param = g_variant_new("(sisi)", encoded_sca,
1140 pDataPackage->MsgLength,
1144 g_dbus_connection_call(handle->dbus_connection,
1145 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
1146 "SetDeliveryReport", param, NULL,
1147 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
1148 on_response_default, evt_cb_data);
1150 g_free(encoded_sca);
1151 g_free(encoded_tpdu);
1153 return TAPI_API_SUCCESS;
1158 * This function enables the application to set the status of a message
1160 * @return Returns appropriate error code. Refer TapiResult_t .
1161 * @param[in] index - the message to be changed
1162 * msgStatus -SMS message status
1164 * @param[out] RequestId-Unique identifier for a particular request
1165 * Its value can be any value from 0 to 255 if the API is returned successfully
1166 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
1167 * @Interface Asynchronous.
1169 * @Refer tapi_sms_memory_type,tapi_sms_status_type
1171 EXPORT_API int tel_set_sms_message_status(struct tapi_handle *handle, int index, TelSmsMsgStatus_t msgStatus, tapi_response_cb callback, void* user_data)
1173 struct tapi_resp_data *evt_cb_data = NULL;
1176 dbg("Func Entrance ");
1178 if ((index < 0) || (index > TAPI_NETTEXT_MAX_INDEX) ||
1179 (msgStatus > TAPI_NETTEXT_STATUS_RESERVED)) {
1180 err("Invalid Input -MsgStatus Set Nettext");
1181 return TAPI_API_INVALID_INPUT;
1184 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
1186 param = g_variant_new("(ii)", index, msgStatus);
1188 g_dbus_connection_call(handle->dbus_connection,
1189 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
1190 "SetMsgStatus", param, NULL,
1191 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
1192 on_response_default, evt_cb_data);
1194 return TAPI_API_SUCCESS;
1199 * This function enables to application to get the sms parameters
1201 * @return Returns appropriate error code. Refer TapiResult_t .
1202 * @param[in] record index of the record in which the sms parameters are stored in the EFsmsp file
1204 * @param[out] RequestId-Unique identifier for a particular request
1205 * Its value can be any value from 0 to 255 if the API is returned successfully
1206 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
1207 * @Interface ASynchronous.
1208 * @remark Requested details come in response API
1211 EXPORT_API int tel_get_sms_parameters(struct tapi_handle *handle, int index, tapi_response_cb callback, void* user_data)
1213 struct tapi_resp_data *evt_cb_data = NULL;
1216 dbg("Func Entrance ");
1218 TAPI_RET_ERR_NUM_IF_FAIL(callback ,TAPI_API_INVALID_PTR);
1220 if ((index < 0) || (index > TAPI_NETTEXT_MAX_INDEX)) {
1221 err("Invalid Input -SMS Param Get Nettext");
1222 return TAPI_API_INVALID_INPUT;
1225 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
1227 param = g_variant_new("(i)", index);
1229 g_dbus_connection_call(handle->dbus_connection,
1230 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
1231 "GetSmsParams", param, NULL,
1232 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
1233 on_response_get_sms_params, evt_cb_data);
1235 return TAPI_API_SUCCESS;
1240 * This function enables to application to get the sms parameters
1242 * @return Returns appropriate error code. Refer TapiResult_t .
1243 * @param[in] tapi_smsp_set_param_t sms parameters to be set in the EFsmsp file
1245 * @param[out] RequestId-Unique identifier for a particular request
1246 * Its value can be any value from 0 to 255 if the API is returned successfully
1247 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
1248 * @Interface ASynchronous.
1250 * @Refer tapi_smsp_set_param_t
1252 EXPORT_API int tel_set_sms_parameters(struct tapi_handle *handle, const TelSmsParams_t *pSmsSetParameters, tapi_response_cb callback, void* user_data)
1254 struct tapi_resp_data *evt_cb_data = NULL;
1256 gchar *encoded_alphaId = NULL;
1257 gchar *encoded_destDialNum = NULL;
1258 gchar *encoded_scaDialNum = NULL;
1260 dbg("Func Entrance ");
1262 TAPI_RET_ERR_NUM_IF_FAIL(pSmsSetParameters ,TAPI_API_INVALID_PTR);
1264 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
1266 encoded_alphaId = g_base64_encode((guchar *)&(pSmsSetParameters->szAlphaId[0]), TAPI_SIM_SMSP_ALPHA_ID_LEN_MAX + 1);
1267 if (encoded_alphaId == NULL) {
1268 dbg("g_base64_encode: Failed to Enocde the AlphaId");
1269 return TAPI_API_OPERATION_FAILED;
1272 encoded_destDialNum = g_base64_encode(&(pSmsSetParameters->TpDestAddr.szDiallingNum[0]), TAPI_SIM_SMSP_ADDRESS_LEN + 1);
1273 if (encoded_destDialNum == NULL) {
1274 dbg("g_base64_encode: Failed to Enocde the DestAddr.DiallingNum");
1275 return TAPI_API_OPERATION_FAILED;
1278 encoded_scaDialNum = g_base64_encode(&(pSmsSetParameters->TpSvcCntrAddr.szDiallingNum[0]), TAPI_SIM_SMSP_ADDRESS_LEN + 1);
1279 if (encoded_scaDialNum == NULL) {
1280 dbg("g_base64_encode: Failed to Enocde the ScaAddr.DiallingNum");
1281 return TAPI_API_OPERATION_FAILED;
1284 param = g_variant_new("(iiisiiiisiiisiii)", pSmsSetParameters->RecordIndex,
1285 pSmsSetParameters->RecordLen,
1286 pSmsSetParameters->AlphaIdLen,
1288 pSmsSetParameters->ParamIndicator,
1289 pSmsSetParameters->TpDestAddr.DialNumLen,
1290 pSmsSetParameters->TpDestAddr.Ton,
1291 pSmsSetParameters->TpDestAddr.Npi,
1292 encoded_destDialNum,
1293 pSmsSetParameters->TpSvcCntrAddr.DialNumLen,
1294 pSmsSetParameters->TpSvcCntrAddr.Ton,
1295 pSmsSetParameters->TpSvcCntrAddr.Npi,
1297 pSmsSetParameters->TpProtocolId,
1298 pSmsSetParameters->TpDataCodingScheme,
1299 pSmsSetParameters->TpValidityPeriod);
1301 g_dbus_connection_call(handle->dbus_connection,
1302 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
1303 "SetSmsParams", param, NULL,
1304 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
1305 on_response_default, evt_cb_data);
1307 g_free(encoded_alphaId);
1308 g_free(encoded_destDialNum);
1309 g_free(encoded_scaDialNum);
1311 return TAPI_API_SUCCESS;
1316 * This function enables to application to get the sms parameter count from the EFsmsp file.
1318 * @return Returns appropriate error code. Refer TapiResult_t .
1321 * @param[out] RequestId-Unique identifier for a particular request
1322 * Its value can be any value from 0 to 255 if the API is returned successfully
1323 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
1324 * @Interface ASynchronous.
1325 * @remark Requested details come in response API
1328 EXPORT_API int tel_get_sms_parameter_count(struct tapi_handle *handle, tapi_response_cb callback, void* user_data)
1330 struct tapi_resp_data *evt_cb_data = NULL;
1332 dbg("Func Entrance ");
1334 TAPI_RET_ERR_NUM_IF_FAIL(callback ,TAPI_API_INVALID_PTR);
1336 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
1338 g_dbus_connection_call(handle->dbus_connection,
1339 DBUS_TELEPHONY_SERVICE , handle->path, DBUS_TELEPHONY_SMS_INTERFACE,
1340 "GetSmsParamCnt", NULL, NULL,
1341 G_DBUS_CALL_FLAGS_NONE, -1, handle->ca,
1342 on_response_get_sms_param_cnt, evt_cb_data);
1344 return TAPI_API_SUCCESS;
1350 * This API is used to send an SMS message to the network. This API allows keeping
1351 * the dedicated link at lower layers by passing information as more messages to send in parameters.
1352 * This will enable not to release if a dedicated connection is used for transmission.
1354 * @return TRUE in case of success and FALSE in case of error .
1355 * @param[in] TelSmsMsgInfo_t - SMS_SUBMIT/ACK/CANCEL and its length have to be passed in this structure.
1357 * unsigned int MoreMsgToSend will be set to TRUE when there are more than one message to be
1358 * send or Multiple segmented concatenated message to be send, otherwise FALSE. This flag
1359 * indicates OEM that more messages to send.
1361 * @param[out] RequestId-Unique identifier for a particular request
1362 * Its value can be any value from 0 to 255 if the API is returned successfully
1363 * -1 (INVALID_REQUEST_ID) will be sent in case of failure
1365 * @Interface Asynchronous.
1367 * @Refer TelSmsMsgInfo_t.
1369 EXPORT_API int tel_send_sms_msg(struct tapi_handle *handle, const TelSmsMsgInfo_t *pSmsMsgInfo, unsigned int MoreMsgToSend, tapi_response_cb callback, void* user_data)
1371 struct tapi_resp_data *evt_cb_data = NULL;
1374 dbg("Func Entrance ");
1376 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
1377 TS_BOOL ret = FALSE;
1378 int api_err = TAPI_API_SUCCESS;
1379 int emergency_mode = 0;
1381 if (vconf_get_int("db/telephony/emergency", &emergency_mode) != 0) {
1382 TAPI_LIB_DEBUG(LEVEL_ERR, "[FAIL]GET db/telephony/emergency");
1383 return TAPI_API_OPERATION_FAILED;
1385 if (emergency_mode) {
1386 TAPI_LIB_DEBUG(LEVEL_DEBUG, "emergency mode on");
1387 return TAPI_API_OPERATION_FAILED;
1390 TAPI_RET_ERR_NUM_IF_FAIL(pSmsMsgInfo ,TAPI_API_INVALID_PTR);
1392 if (conn_name.length_of_name == 0) {
1393 TAPI_LIB_DEBUG(LEVEL_ERR, "No dbus connection name");
1394 return TAPI_API_OPERATION_FAILED;
1397 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status(), TAPI_API_SYSTEM_RPC_LINK_NOT_EST);
1398 TAPI_GLIB_INIT_PARAMS();
1400 TAPI_GLIB_ALLOC_PARAMS(in_param1,in_param2,in_param3,in_param4,
1401 out_param1,out_param2,out_param3,out_param4);
1403 g_array_append_vals(in_param1, pSmsMsgInfo, sizeof(TelSmsMsgInfo_t));
1404 g_array_append_vals(in_param2, &MoreMsgToSend, sizeof(unsigned int));
1405 g_array_append_vals(in_param4, &conn_name, sizeof(tapi_dbus_connection_name));
1407 ret = tapi_send_request(TAPI_CS_SERVICE_NETTEXT, TAPI_CS_NETTEXT_SEND_EX, in_param1, in_param2, in_param3,
1408 in_param4, &out_param1, &out_param2, &out_param3, &out_param4);
1411 api_err = g_array_index(out_param1, int, 0);
1414 api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1417 TAPI_GLIB_FREE_PARAMS(in_param1,in_param2,in_param3,in_param4,
1418 out_param1,out_param2,out_param3,out_param4);
1426 * This function enables the applications to check the device status
1428 * @return Returns appropriate error code. Refer TapiResult_t .
1432 * @param[out] Device status whether Ready or Not Ready
1433 * @Interface Synchronous.
1437 EXPORT_API int tel_check_sms_device_status(struct tapi_handle *handle, int *pReadyStatus)
1440 GVariant *smsReady = NULL;
1442 dbg("Func Entrance ");
1444 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
1445 TAPI_RET_ERR_NUM_IF_FAIL(pReadyStatus, TAPI_API_INVALID_PTR);
1447 memset(pReadyStatus, 0, sizeof(int));
1450 smsReady = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
1451 DBUS_TELEPHONY_SMS_INTERFACE, "GetSmsReadyStatus", NULL, NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
1454 dbg( "error to get SMS ready_status(%s)", error->message);
1455 g_error_free (error);
1456 return TAPI_API_OPERATION_FAILED;
1459 dbg("get SMS ready_status type_format(%s)", g_variant_get_type_string(smsReady));
1461 g_variant_get(smsReady, "(b)", pReadyStatus);
1463 dbg("************SMS_device_status (%d)", *pReadyStatus);
1465 return TAPI_API_SUCCESS;
1471 * This function enables to application to set that the device is ready to recieve messages from network.
1473 * @return Returns appropriate error code. Refer TapiResult_t .
1477 * @Interface Synchronous.
1481 EXPORT_API int tel_set_sms_device_status(struct tapi_handle *handle)
1483 struct tapi_resp_data *evt_cb_data = NULL;
1486 dbg("Func Entrance ");
1488 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
1490 TS_BOOL ret = FALSE;
1491 int api_err = TAPI_API_SUCCESS;
1493 TAPI_RET_ERR_NUM_IF_FAIL(tapi_check_dbus_status_internal(), TAPI_API_SYSTEM_RPC_LINK_NOT_EST);
1494 TAPI_GLIB_INIT_PARAMS();
1495 TAPI_GLIB_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param1, out_param2, out_param3, out_param4);
1497 ret = tapi_send_request_internal(TAPI_CS_SERVICE_NETTEXT, TAPI_CS_NETTEXT_DEVICEREADY,
1498 in_param1, in_param2, in_param3, in_param4,
1499 &out_param1, &out_param2, &out_param3, &out_param4);
1502 api_err = g_array_index(out_param1, int, 0);
1505 api_err = TAPI_API_SYSTEM_RPC_LINK_DOWN;
1508 TAPI_GLIB_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param1, out_param2, out_param3, out_param4);