upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 07:58:32 +0000 (16:58 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 07:58:32 +0000 (16:58 +0900)
CMakeLists.txt
capi-telephony-sim.pc.in
debian/changelog
debian/control
include/sim.h
packaging/capi-telephony-sim.spec
src/sim.c
test/sim_get_cphs_operator_name_test.c [new file with mode: 0644]
test/sim_get_msin_test.c [new file with mode: 0644]

index ecb1bcf..9e42ac5 100755 (executable)
@@ -8,6 +8,7 @@ SET(description "Telephony SIM Framework")
 SET(service "telephony")
 SET(submodule "sim")
 SET(dependents "dlog tapi glib-2.0 vconf capi-base-common")
+SET(pc_dependents "capi-base-common")
 SET(deb_dependents "dlog-dev libslp-tapi-dev libglib2.0-dev libvconf-dev capi-base-common-dev")
 
 SET(Services 
@@ -93,9 +94,8 @@ INSTALL(
         )
 
 SET(PC_NAME ${fw_name})
-SET(PC_REQUIRED ${dependents})
+SET(PC_REQUIRED ${pc_dependents})
 SET(PC_LDFLAGS -l${fw_name})
-SET(PC_CFLAGS -I\${includedir}/${service})
 
 CONFIGURE_FILE(
     capi-telephony-sim.pc.in
index 9b898b7..8731238 100644 (file)
@@ -11,5 +11,4 @@ Description: @PACKAGE_DESCRIPTION@
 Version: @VERSION@
 Requires: @PC_REQUIRED@ 
 Libs: -L${libdir} @PC_LDFLAGS@
-Cflags: -I${includedir} @PC_CFLAGS@
-
+Cflags: -I${includedir}
index 25a182c..5ab3d50 100644 (file)
@@ -1,7 +1,23 @@
+capi-telephony-sim (0.1.0-12) unstable; urgency=low
+
+  * Correct dependent packages
+  * Git: api/sim
+  * Tag: capi-telephony-sim_0.1.0-12
+
+ -- ByungWoo Lee <bw1212.lee@samsung.com>  Thu, 15 Mar 2012 13:32:00 +0900
+  
+capi-telephony-sim (0.1.0-11) unstable; urgency=low
+
+  * Add new APIs(sim_get_msin, sim_get_cphs_operator_name),related TCs and test code
+  * Git: api/sim
+  * Tag: capi-telephony-sim_0.1.0-11
+
+ -- Kyeongchul Kim <kyeongchul.kim@samsung.com>  Wed, 07 Mar 2012 13:54:07 +0900
+
 capi-telephony-sim (0.1.0-10) unstable; urgency=low
 
   * Convert internal symbol to static
-  * Git: slp/api/sim
+  * Git: api/sim
   * Tag: capi-telephony-sim_0.1.0-10 
 
  -- ByungWoo Lee <bw1212.lee@samsung.com>  Mon, 20 Feb 2012 15:54:30 +0900
index 044074a..245f421 100644 (file)
@@ -2,17 +2,17 @@
 Source: capi-telephony-sim
 Section: libs
 Priority: extra
-Maintainer: Kangho Hur <kangho.hur@samsung.com>, ByungWoo Lee <bw1212.lee@samsung.com>
+Maintainer: Kangho Hur <kangho.hur@samsung.com>, ByungWoo Lee <bw1212.lee@samsung.com>, kyeongchul.kim <kyeongchul.kim@samsung.com>, JaYoung Gu <jygu@samsung.com>
 Build-Depends: debhelper (>= 5), dlog-dev, libslp-tapi-dev, libglib2.0-dev, libvconf-dev, capi-base-common-dev
 
 Package: capi-telephony-sim
 Architecture: any
-Depends: ${shilbs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: A Telephony SIM library in Tizen Natvie API
 
 Package: capi-telephony-sim-dev
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-telephony-sim (= ${Source-Version}), dlog-dev, libslp-tapi-dev, libglib2.0-dev, libvconf-dev, capi-base-common-dev
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-telephony-sim (= ${Source-Version}), capi-base-common-dev
 Description: A Telephony SIM library in Tizen Natvie API (DEV)
 
 Package: capi-telephony-sim-dbg
index 7bce0d2..575ad2c 100755 (executable)
@@ -119,6 +119,24 @@ int sim_get_mcc(char **mcc);
 int sim_get_mnc(char **mnc);
 
 /**
+ * @brief Gets the Mobile Subscription Identification Number (MSIN) of SIM provider.
+ * @details This function gets Mobile Subscription Identification Number embedded in SIM card.
+ *
+ * @remarks @c msin must be released with free() by you.
+ * @param[out] msin The  Mobile Subscription Identification Number
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #SIM_ERROR_NONE Successful
+ * @retval #SIM_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SIM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SIM_ERROR_OPERATION_FAILED Operation failed
+ * @retval #SIM_ERROR_NOT_AVAILABLE SIM is not available
+ * @pre The SIM state must be #SIM_STATE_AVAILABLE.
+ * @see        sim_get_state()
+ *
+ */
+int sim_get_msin(char **msin);
+
+/**
  * @brief Gets the Service Provider Name (SPN) of SIM card.
  * @details This function gets Service Provider Name embedded in SIM card.
  * If this value is not stored in SIM card, NULL will be returned.
@@ -136,6 +154,24 @@ int sim_get_mnc(char **mnc);
 int sim_get_spn(char **spn);
 
 /**
+ * @brief Gets the Operator Name String (ONS) of Common PCN Handset Specification (CPHS) in SIM card.
+ * @details This function gets the full name and the short name of CPHS operator embedded in SIM card.
+ * If this value is not stored in SIM card, NULL will be returned.
+ * @remarks @c full_name and @c short_name must be released with free() by you.
+ * @param[out] full_name The full name of CPHS operator
+ * @param[out] short_name The short name of CPHS operator
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #SIM_ERROR_NONE Successful
+ * @retval #SIM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SIM_ERROR_OPERATION_FAILED Operation failed
+ * @retval #SIM_ERROR_NOT_AVAILABLE SIM is not available
+ * @pre The SIM state must be #SIM_STATE_AVAILABLE.
+ * @see        sim_get_state()
+ *
+ */
+int sim_get_cphs_operator_name(char** full_name, char** short_name);
+
+/**
  * @brief Gets the state of SIM.
  *
  * @param[out] sim_state The current state of SIM
index 122c33c..536f1d6 100644 (file)
@@ -1,7 +1,7 @@
 Name:       capi-telephony-sim
 Summary:    Telephony SIM Framework
 Version:    0.1.0
-Release:    1
+Release:    12
 Group:      TO_BE/FILLED_IN
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
@@ -31,9 +31,8 @@ Requires: %{name} = %{version}-%{release}
 
 
 %build
-FULLVER=%{version}
-MAJORVER=`echo ${FULLVER} | cut -d '.' -f 1`
-cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
 
 
 make %{?jobs:-j%jobs}
@@ -48,10 +47,11 @@ rm -rf %{buildroot}
 
 
 %files
-%{_libdir}/libcapi-telephony-sim.so*
+%{_libdir}/libcapi-telephony-sim.so.*
 
 %files devel
 %{_includedir}/telephony/sim.h
 %{_libdir}/pkgconfig/*.pc
+%{_libdir}/libcapi-telephony-sim.so
 
 
index 23263c3..fb24a09 100644 (file)
--- a/src/sim.c
+++ b/src/sim.c
@@ -191,6 +191,49 @@ int sim_get_mnc(char** mnc)
 }
 
 
+int sim_get_msin(char** msin)
+{
+       TelSimImsiInfo_t sim_imsi_info;
+       int error_code = SIM_ERROR_NONE;
+       int card_changed = 0;
+       TelSimCardStatus_t sim_card_state = 0x00;
+
+       SIM_CHECK_INPUT_PARAMETER(msin);
+       SIM_INIT();
+
+       if( tel_get_sim_init_info(&sim_card_state, &card_changed) != 0
+               || sim_card_state != TAPI_SIM_STATUS_SIM_INIT_COMPLETED )
+       {
+               LOGE("[%s] NOT_AVAILABLE(0x%08x)", __FUNCTION__, SIM_ERROR_NOT_AVAILABLE);
+               error_code = SIM_ERROR_NOT_AVAILABLE;
+       }
+       else
+       {
+               if( tel_get_sim_imsi(&sim_imsi_info) != 0 )
+               {
+                       LOGE("[%s] OPERATION_FAILED(0x%08x)", __FUNCTION__, SIM_ERROR_OPERATION_FAILED);
+                       error_code = SIM_ERROR_OPERATION_FAILED;
+               }
+               else
+               {
+                       *msin = (char*)malloc(sizeof(char) * (TAPI_SIM_MSIN_CODE_LEN+1));
+                       if( *msin == NULL )
+                       {
+                               LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __FUNCTION__, SIM_ERROR_OUT_OF_MEMORY);
+                               error_code = SIM_ERROR_OUT_OF_MEMORY;
+                       }
+                       else
+                       {
+                               strncpy(*msin, sim_imsi_info.szMsin, TAPI_SIM_MSIN_CODE_LEN+1);
+                       }
+               }
+       }
+
+       tel_deinit();
+       return error_code;
+}
+
+
 int sim_get_spn(char** spn)
 {
        int error_code = SIM_ERROR_NONE;
@@ -232,6 +275,66 @@ int sim_get_spn(char** spn)
 }
 
 
+int sim_get_cphs_operator_name(char** full_name, char** short_name)
+{
+       TelSimCphsLocalInfo_t cphs_info;
+       int error_code = SIM_ERROR_NONE;
+       int card_changed = 0;
+       TelSimCardStatus_t sim_card_state = 0x00;
+
+       SIM_CHECK_INPUT_PARAMETER(full_name);
+       SIM_CHECK_INPUT_PARAMETER(short_name);
+       SIM_INIT();
+
+       if( tel_get_sim_init_info(&sim_card_state, &card_changed) != 0
+               || sim_card_state != TAPI_SIM_STATUS_SIM_INIT_COMPLETED )
+       {
+               LOGE("[%s] NOT_AVAILABLE(0x%08x)", __FUNCTION__, SIM_ERROR_NOT_AVAILABLE);
+               error_code = SIM_ERROR_NOT_AVAILABLE;
+       }
+       else
+       {
+               if( tel_get_sim_cphs_info(&cphs_info) != 0 )
+               {
+                       LOGE("[%s] OPERATION_FAILED(0x%08x)", __FUNCTION__, SIM_ERROR_OPERATION_FAILED);
+                       error_code = SIM_ERROR_OPERATION_FAILED;
+               }
+               else
+               {
+                       if(cphs_info.opname.NameLength)
+                       {
+                               *full_name = strndup((const char*)cphs_info.opname.OperatorName, cphs_info.opname.NameLength);
+                               if(*full_name == NULL)
+                               {
+                                       LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __FUNCTION__, SIM_ERROR_OUT_OF_MEMORY);
+                                       error_code = SIM_ERROR_OUT_OF_MEMORY;
+                               }
+                       }
+                       else
+                       {
+                               *full_name = NULL;
+                       }
+
+                       if(cphs_info.opshortform.ShortNameLength)
+                       {
+                               *short_name = strndup((const char*)cphs_info.opshortform.OperatorShortName, cphs_info.opshortform.ShortNameLength);
+                               if(*short_name == NULL)
+                               {
+                                       LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __FUNCTION__, SIM_ERROR_OUT_OF_MEMORY);
+                                       error_code = SIM_ERROR_OUT_OF_MEMORY;
+                               }
+                       }
+                       else
+                       {
+                               *short_name = NULL;
+                       }
+               }
+       }
+
+       tel_deinit();
+       return error_code;
+}
+
 int sim_get_state(sim_state_e* sim_state)
 {
        int card_changed = 0;
diff --git a/test/sim_get_cphs_operator_name_test.c b/test/sim_get_cphs_operator_name_test.c
new file mode 100644 (file)
index 0000000..f5a752c
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <sim.h>
+#include <stdlib.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_SIM_TEST"
+
+int main()
+{
+       int ret = 0;
+       char* full_name = NULL;
+       char* short_name = NULL;
+       int ret_value = sim_get_cphs_operator_name(&full_name, &short_name);
+
+       switch(ret_value)
+       {
+               case SIM_ERROR_NONE:
+                       ret = 0;
+                       if( full_name != NULL )
+                       {
+                               LOGI("CPHS full ONS is %s", full_name);
+                               free(full_name);
+                       }
+                       else
+                       {
+                               LOGI("CPHS full ONS is NULL");
+                       }
+
+                       if( short_name != NULL )
+                       {
+                               LOGI("CPHS short ONS is %s", short_name);
+                               free(short_name);
+                       }
+                       else
+                       {
+                               LOGI("CPHS short ONS is NULL");
+                       }
+                       break;
+               case SIM_ERROR_INVALID_PARAMETER:
+                       LOGE("Invalid parameter");
+                       ret = -1;
+                       break;
+               case SIM_ERROR_OPERATION_FAILED:
+                       LOGE("Cannot find SPN value");
+                       ret = -1;
+                       break;
+               case SIM_ERROR_NOT_AVAILABLE:
+                       LOGE("SIM is not available");
+                       ret = -1;
+                       break;
+               default:
+                       LOGE("Unexpected return value");
+                       ret = -1;
+                       break;
+       }
+
+
+       return ret;
+}
diff --git a/test/sim_get_msin_test.c b/test/sim_get_msin_test.c
new file mode 100644 (file)
index 0000000..a8530c1
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <sim.h>
+#include <stdlib.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_SIM_TEST"
+
+int main()
+{
+       int ret = 0;
+       char* msin = NULL;
+       int ret_value = sim_get_msin(&msin);
+
+       switch(ret_value)
+       {
+               case SIM_ERROR_NONE:
+                       LOGI("MSIN is %s", msin);
+                       ret = 0;
+                       free(msin);
+                       break;
+               case SIM_ERROR_OUT_OF_MEMORY:
+                       LOGE("Out of memory");
+                       ret = -1;
+                       break;
+               case SIM_ERROR_INVALID_PARAMETER:
+                       LOGE("Invalid parameter");
+                       ret = -1;
+                       break;
+               case SIM_ERROR_OPERATION_FAILED:
+                       LOGE("Can not get MNC value");
+                       ret = -1;
+                       break;
+               case SIM_ERROR_NOT_AVAILABLE:
+                       LOGE("SIM is not available");
+                       ret = -1;
+                       break;
+               default:
+                       LOGE("Unexpected return value");
+                       ret = -1;
+                       break;
+       }
+
+       return ret;
+}