BuildRequires: cmake
BuildRequires: pkgconfig(bundle)
BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(capi-network-connection)
%description
Native API Integration TC (%{name})
<privileges>
<privilege>http://tizen.org/privilege/telephony</privilege>
<privilege>http://tizen.org/privilege/location.coarse</privilege>
+ <privilege>http://tizen.org/privilege/network.profile</privilege>
+ <privilege>http://tizen.org/privilege/network.get</privilege>
+ <privilege>http://tizen.org/privilege/network.set</privilege>
</privileges>
</manifest>
glib-2.0
capi-system-info
dlog elementary
+ capi-network-connection
)
INCLUDE_DIRECTORIES(
g_bTelephonyInit = false;
return;
}
+
+ bool bWifiFeatureSupported = TCTCheckSystemInfoFeatureSupported(WIFI_FEATURE, API_NAMESPACE);
+ bool bEthernetFeatureSupported = TCTCheckSystemInfoFeatureSupported(ETHERNET_FEATURE, API_NAMESPACE);
+ bool bBtFeatureSupported = TCTCheckSystemInfoFeatureSupported(TETHERING_BLUETOOTH_FEATURE, API_NAMESPACE);
+
+ connection_h hConenctionHandle = NULL;
+ connection_cellular_state_e eState;
+
+ nRet = connection_create(&hConenctionHandle);
+ if ( false == g_bTelephonyIssupportedFeature && false == bWifiFeatureSupported && false == bBtFeatureSupported && false == bEthernetFeatureSupported )
+ {
+ if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+ {
+ FPRINTF("[Line: %d][%s] connection_create API call returned mismatch %s error for unsupported telephony feature\\n", __LINE__, API_NAMESPACE, ConnectionGetError(nRet));
+ g_bTelephonySkipExecutionWithFail = true;
+ }
+ else
+ {
+ FPRINTF("[Line: %d][%s] connection_create API call correctly returned %s error for unsupported telephony feature\\n", __LINE__, API_NAMESPACE, ConnectionGetError(nRet));
+ g_bTelephonySkipExecutionWithPass = true;
+ }
+ return;
+ }
+
+ if ( nRet != CONNECTION_ERROR_NONE )
+ {
+ FPRINTF("[Line: %d][%s] Startup failed on connection create API returned error %s\\n", __LINE__, API_NAMESPACE, ConnectionGetError(nRet));
+ g_bTelephonyInit = false;
+ return;
+ }
+
+ if ( hConenctionHandle == NULL )
+ {
+ FPRINTF("[Line: %d][%s] Startup failed on connection create returned handle = NULL\\n", __LINE__, API_NAMESPACE);
+ g_bTelephonyInit = false;
+ return;
+ }
+
+ nRet = connection_get_cellular_state(hConenctionHandle, &eState);
+ if ( nRet != CONNECTION_ERROR_NONE )
+ {
+ FPRINTF("[Line: %d][%s] Startup failed on get cellular state\\n", __LINE__, API_NAMESPACE);
+ g_bTelephonyInit = false;
+ return;
+ }
+ if (eState == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE)
+ {
+ FPRINTF("[Line: %d][%s] Cellular state is out of service\\n", __LINE__, API_NAMESPACE);
+ g_bTelephonySkipExecutionWithPass = true;
+ return;
+ }
+ if ( hConenctionHandle != NULL )
+ {
+ connection_destroy(hConenctionHandle);
+ }
+
#if DEBUG
FPRINTF("[Line : %d][%s] telephony_init successful in startup\\n", __LINE__, API_NAMESPACE);
#endif
}
/**
+* @function ConnectionGetError
+* @description Maps error enums to string values
+* @parameter nRet : error code returned
+* @return error string
+*/
+char* ConnectionGetError(connection_error_e nRet)
+{
+ char *szErrorVal = NULL;
+ switch ( nRet )
+ {
+ case CONNECTION_ERROR_NONE : szErrorVal = "CONNECTION_ERROR_NONE"; break;/**< Successful */
+ case CONNECTION_ERROR_INVALID_PARAMETER : szErrorVal = "CONNECTION_ERROR_INVALID_PARAMETER"; break;/**< Invalid parameter */
+ case CONNECTION_ERROR_OUT_OF_MEMORY: szErrorVal = "CONNECTION_ERROR_OUT_OF_MEMORY"; break;/**< Out of memory error */
+ case CONNECTION_ERROR_INVALID_OPERATION : szErrorVal = "CONNECTION_ERROR_INVALID_OPERATION"; break;/**< Invalid Operation */
+ case CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED : szErrorVal = "CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED"; break;/**< Address family not supported */
+ case CONNECTION_ERROR_OPERATION_FAILED : szErrorVal = "CONNECTION_ERROR_OPERATION_FAILED"; break;/**< Operation failed */
+ case CONNECTION_ERROR_ITERATOR_END : szErrorVal = "CONNECTION_ERROR_ITERATOR_END"; break;/**< End of iteration */
+ case CONNECTION_ERROR_NO_CONNECTION : szErrorVal = "CONNECTION_ERROR_NO_CONNECTION"; break;/**< There is no connection */
+ case CONNECTION_ERROR_NOW_IN_PROGRESS : szErrorVal = "CONNECTION_ERROR_NOW_IN_PROGRESS"; break;/** Now in progress */
+ case CONNECTION_ERROR_ALREADY_EXISTS : szErrorVal = "CONNECTION_ERROR_ALREADY_EXISTS"; break;/**< Already exists */
+ case CONNECTION_ERROR_OPERATION_ABORTED : szErrorVal = "CONNECTION_ERROR_OPERATION_ABORTED"; break;/**< Operation is aborted */
+ case CONNECTION_ERROR_DHCP_FAILED : szErrorVal = "CONNECTION_ERROR_DHCP_FAILED"; break;/**< DHCP failed */
+ case CONNECTION_ERROR_INVALID_KEY : szErrorVal = "CONNECTION_ERROR_INVALID_KEY"; break;/**< Invalid key */
+ case CONNECTION_ERROR_NO_REPLY : szErrorVal = "CONNECTION_ERROR_NO_REPLY"; break;/**< No reply */
+ case CONNECTION_ERROR_PERMISSION_DENIED : szErrorVal = "CONNECTION_ERROR_PERMISSION_DENIED"; break;/**< Permission denied */
+ case CONNECTION_ERROR_NOT_SUPPORTED : szErrorVal = "CONNECTION_ERROR_NOT_SUPPORTED"; break;/**< Not supported */
+ default : szErrorVal = "Unknown Error"; break;
+ }
+ return szErrorVal;
+}
+
+/**
* @function TelephonyGetServiceState
* @description Maps enums values to string values
* @parameter eRet : service state
#include "tct_common.h"
#include <telephony.h>
+#include <net_connection.h>
+
/** @addtogroup itc-telephony
* @ingroup itc
* @{
#define GMAINTIMEOUT 2000
#define API_NAMESPACE "TELEPHONY_ITC"
#define TELEPHONY_FEATURE "http://tizen.org/feature/network.telephony"
+#define WIFI_FEATURE "http://tizen.org/feature/network.wifi"
+#define TETHERING_BLUETOOTH_FEATURE "http://tizen.org/feature/network.tethering.bluetooth"
+#define TELEPHONY_FEATURE "http://tizen.org/feature/network.telephony"
+#define ETHERNET_FEATURE "http://tizen.org/feature/network.ethernet"
//Add helper function declarations here
char *TelephonyGetState(telephony_state_e eRet);
bool TelephonyGetSimHandle(int nSlotCount);
char *TelephonyGetNetworkSelMode(telephony_network_selection_mode_e eRet);
+char* ConnectionGetError(connection_error_e nRet);
/** @} */
#endif //_ITS_TELEPHONY_COMMON_H_
return;
}
+ bool bWifiFeatureSupported = TCTCheckSystemInfoFeatureSupported(WIFI_FEATURE, API_NAMESPACE);
+ bool bEthernetFeatureSupported = TCTCheckSystemInfoFeatureSupported(ETHERNET_FEATURE, API_NAMESPACE);
+ bool bBtFeatureSupported = TCTCheckSystemInfoFeatureSupported(TETHERING_BLUETOOTH_FEATURE, API_NAMESPACE);
+
+ connection_h hConenctionHandle = NULL;
+ connection_cellular_state_e eState;
+
+ nRet = connection_create(&hConenctionHandle);
+ if ( false == g_bTelephonyIssupportedFeature && false == bWifiFeatureSupported && false == bBtFeatureSupported && false == bEthernetFeatureSupported )
+ {
+ if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+ {
+ FPRINTF("[Line: %d][%s] connection_create API call returned mismatch %s error for unsupported telephony feature\\n", __LINE__, API_NAMESPACE, ConnectionGetError(nRet));
+ g_bTelephonySkipExecutionWithFail = true;
+ }
+ else
+ {
+ FPRINTF("[Line: %d][%s] connection_create API call correctly returned %s error for unsupported telephony feature\\n", __LINE__, API_NAMESPACE, ConnectionGetError(nRet));
+ g_bTelephonySkipExecutionWithPass = true;
+ }
+ return;
+ }
+
+ if ( nRet != CONNECTION_ERROR_NONE )
+ {
+ FPRINTF("[Line: %d][%s] Startup failed on connection create API returned error %s\\n", __LINE__, API_NAMESPACE, ConnectionGetError(nRet));
+ g_bTelephonyInit = false;
+ return;
+ }
+
+ if ( hConenctionHandle == NULL )
+ {
+ FPRINTF("[Line: %d][%s] Startup failed on connection create returned handle = NULL\\n", __LINE__, API_NAMESPACE);
+ g_bTelephonyInit = false;
+ return;
+ }
+
+ nRet = connection_get_cellular_state(hConenctionHandle, &eState);
+ if ( nRet != CONNECTION_ERROR_NONE )
+ {
+ FPRINTF("[Line: %d][%s] Startup failed on get cellular state\\n", __LINE__, API_NAMESPACE);
+ g_bTelephonyInit = false;
+ return;
+ }
+ if (eState == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE)
+ {
+ FPRINTF("[Line: %d][%s] Cellular state is out of service\\n", __LINE__, API_NAMESPACE);
+ g_bTelephonySkipExecutionWithPass = true;
+ return;
+ }
+
+ if ( hConenctionHandle != NULL )
+ {
+ connection_destroy(hConenctionHandle);
+ }
+
#if DEBUG
FPRINTF("[Line : %d][%s] telephony_init successful in startup\\n", __LINE__, API_NAMESPACE);
#endif
return;
}
+ bool bWifiFeatureSupported = TCTCheckSystemInfoFeatureSupported(WIFI_FEATURE, API_NAMESPACE);
+ bool bEthernetFeatureSupported = TCTCheckSystemInfoFeatureSupported(ETHERNET_FEATURE, API_NAMESPACE);
+ bool bBtFeatureSupported = TCTCheckSystemInfoFeatureSupported(TETHERING_BLUETOOTH_FEATURE, API_NAMESPACE);
+
+ connection_h hConenctionHandle = NULL;
+ connection_cellular_state_e eState;
+
+ nRet = connection_create(&hConenctionHandle);
+ if ( false == g_bTelephonyIssupportedFeature && false == bWifiFeatureSupported && false == bBtFeatureSupported && false == bEthernetFeatureSupported )
+ {
+ if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+ {
+ FPRINTF("[Line: %d][%s] connection_create API call returned mismatch %s error for unsupported telephony feature\\n", __LINE__, API_NAMESPACE, ConnectionGetError(nRet));
+ g_bTelephonySkipExecutionWithFail = true;
+ }
+ else
+ {
+ FPRINTF("[Line: %d][%s] connection_create API call correctly returned %s error for unsupported telephony feature\\n", __LINE__, API_NAMESPACE, ConnectionGetError(nRet));
+ g_bTelephonySkipExecutionWithPass = true;
+ }
+ return;
+ }
+
+ if ( nRet != CONNECTION_ERROR_NONE )
+ {
+ FPRINTF("[Line: %d][%s] Startup failed on connection create API returned error %s\\n", __LINE__, API_NAMESPACE, ConnectionGetError(nRet));
+ g_bTelephonyInit = false;
+ return;
+ }
+
+ if ( hConenctionHandle == NULL )
+ {
+ FPRINTF("[Line: %d][%s] Startup failed on connection create returned handle = NULL\\n", __LINE__, API_NAMESPACE);
+ g_bTelephonyInit = false;
+ return;
+ }
+
+ nRet = connection_get_cellular_state(hConenctionHandle, &eState);
+ if ( nRet != CONNECTION_ERROR_NONE )
+ {
+ FPRINTF("[Line: %d][%s] Startup failed on get cellular state\\n", __LINE__, API_NAMESPACE);
+ g_bTelephonyInit = false;
+ return;
+ }
+ if (eState == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE)
+ {
+ FPRINTF("[Line: %d][%s] Cellular state is out of service\\n", __LINE__, API_NAMESPACE);
+ g_bTelephonySkipExecutionWithPass = true;
+ return;
+ }
+
+ if ( hConenctionHandle != NULL )
+ {
+ connection_destroy(hConenctionHandle);
+ }
+
#if DEBUG
FPRINTF("[Line : %d][%s] telephony_init successful in startup\\n", __LINE__, API_NAMESPACE);
#endif
return;
}
+ bool bWifiFeatureSupported = TCTCheckSystemInfoFeatureSupported(WIFI_FEATURE, API_NAMESPACE);
+ bool bEthernetFeatureSupported = TCTCheckSystemInfoFeatureSupported(ETHERNET_FEATURE, API_NAMESPACE);
+ bool bBtFeatureSupported = TCTCheckSystemInfoFeatureSupported(TETHERING_BLUETOOTH_FEATURE, API_NAMESPACE);
+
+ connection_h hConenctionHandle = NULL;
+ connection_cellular_state_e eState;
+
+ nRet = connection_create(&hConenctionHandle);
+ if ( false == g_bTelephonyIssupportedFeature && false == bWifiFeatureSupported && false == bBtFeatureSupported && false == bEthernetFeatureSupported )
+ {
+ if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+ {
+ FPRINTF("[Line: %d][%s] connection_create API call returned mismatch %s error for unsupported telephony feature\\n", __LINE__, API_NAMESPACE, ConnectionGetError(nRet));
+ g_bTelephonySkipExecutionWithFail = true;
+ }
+ else
+ {
+ FPRINTF("[Line: %d][%s] connection_create API call correctly returned %s error for unsupported telephony feature\\n", __LINE__, API_NAMESPACE, ConnectionGetError(nRet));
+ g_bTelephonySkipExecutionWithPass = true;
+ }
+ return;
+ }
+
+ if ( nRet != CONNECTION_ERROR_NONE )
+ {
+ FPRINTF("[Line: %d][%s] Startup failed on connection create API returned error %s\\n", __LINE__, API_NAMESPACE, ConnectionGetError(nRet));
+ g_bTelephonyInit = false;
+ return;
+ }
+
+ if ( hConenctionHandle == NULL )
+ {
+ FPRINTF("[Line: %d][%s] Startup failed on connection create returned handle = NULL\\n", __LINE__, API_NAMESPACE);
+ g_bTelephonyInit = false;
+ return;
+ }
+
+ nRet = connection_get_cellular_state(hConenctionHandle, &eState);
+ if ( nRet != CONNECTION_ERROR_NONE )
+ {
+ FPRINTF("[Line: %d][%s] Startup failed on get cellular state\\n", __LINE__, API_NAMESPACE);
+ g_bTelephonyInit = false;
+ return;
+ }
+ if (eState == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE)
+ {
+ FPRINTF("[Line: %d][%s] Cellular state is out of service\\n", __LINE__, API_NAMESPACE);
+ g_bTelephonySkipExecutionWithPass = true;
+ return;
+ }
+
+ if ( hConenctionHandle != NULL )
+ {
+ connection_destroy(hConenctionHandle);
+ }
+
#if DEBUG
FPRINTF("[Line : %d][%s] telephony_init successful in startup\\n", __LINE__, API_NAMESPACE);
#endif