Update plugin
authorGuillaume Zajac <guillaume.zajac@linux.intel.com>
Tue, 12 Mar 2013 17:13:39 +0000 (18:13 +0100)
committerwootak.jung <wootak.jung@samsung.com>
Sun, 24 Mar 2013 06:50:43 +0000 (15:50 +0900)
Create missing objects
Use new libtcore APIs

Change-Id: Ia289b3a605117427e2003ca15ccb29417d5ed4a4

22 files changed:
CMakeLists.txt
include/at_call.h
include/at_gps.h [new file with mode: 0644]
include/at_modem.h
include/at_network.h
include/at_ps.h
include/at_sap.h [new file with mode: 0644]
include/at_sat.h [new file with mode: 0644]
include/at_sim.h
include/at_sms.h
include/at_ss.h
src/at_call.c
src/at_gps.c [new file with mode: 0644]
src/at_modem.c
src/at_network.c
src/at_phonebook.c
src/at_ps.c
src/at_sap.c [new file with mode: 0644]
src/at_sat.c [new file with mode: 0644]
src/at_sim.c
src/at_sms.c
src/at_ss.c

index ee2414e..ced1bde 100644 (file)
@@ -35,6 +35,9 @@ SET(SRCS
        src/at_ps.c
        src/at_sms.c
        src/at_ss.c
+       src/at_sat.c
+       src/at_sap.c
+       src/at_gps.c
 )
 
 # library build
index f04f01a..72d3111 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __AT_CALL_H__
 #define __AT_CALL_H__
 
-gboolean at_call_init(TcorePlugin *p);
-void at_call_exit(TcorePlugin *p);
+gboolean at_call_init(TcorePlugin *cp);
+void at_call_exit(TcorePlugin *cp);
 
 #endif
diff --git a/include/at_gps.h b/include/at_gps.h
new file mode 100644 (file)
index 0000000..7b5baec
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * tel-plugin-at_standard
+ *
+ * Copyright (c) 2012 Intel Corporation. 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.
+ */
+
+#ifndef __AT_GPS_H__
+#define __AT_GPS_H__
+
+gboolean at_gps_init(TcorePlugin *cp);
+void at_gps_exit(TcorePlugin *cp);
+
+#endif
\ No newline at end of file
index 60eeab1..75f8331 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __AT_MODEM_H__
 #define __AT_MODEM_H__
 
-gboolean at_modem_init(TcorePlugin *p);
-void at_modem_exit(TcorePlugin *p);
+gboolean at_modem_init(TcorePlugin *cp);
+void at_modem_exit(TcorePlugin *cp);
 
 #endif
index 2848b4a..4499171 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __AT_NETWORK_H__
 #define __AT_NETWORK_H__
 
-gboolean at_network_init(TcorePlugin *p);
-void at_network_exit(TcorePlugin *p);
+gboolean at_network_init(TcorePlugin *cp);
+void at_network_exit(TcorePlugin *cp);
 
 #endif
index 13f2487..40ea991 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __AT_PS_H__
 #define __AT_PS_H__
 
-gboolean at_ps_init(TcorePlugin *p);
-void at_ps_exit(TcorePlugin *p);
+gboolean at_ps_init(TcorePlugin *cp);
+void at_ps_exit(TcorePlugin *cp);
 
 #endif
diff --git a/include/at_sap.h b/include/at_sap.h
new file mode 100644 (file)
index 0000000..4d4760b
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * tel-plugin-at_standard
+ *
+ * Copyright (c) 2012 Intel Corporation. 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.
+ */
+
+#ifndef __AT_SAP_H__
+#define __AT_SAP_H__
+
+gboolean at_sap_init(TcorePlugin *cp);
+void at_sap_exit(TcorePlugin *cp);
+
+#endif
\ No newline at end of file
diff --git a/include/at_sat.h b/include/at_sat.h
new file mode 100644 (file)
index 0000000..bc4ca11
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * tel-plugin-at_standard
+ *
+ * Copyright (c) 2012 Intel Corporation. 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.
+ */
+
+#ifndef __AT_SAT_H__
+#define __AT_SAT_H__
+
+gboolean at_sat_init(TcorePlugin *cp);
+void at_sat_exit(TcorePlugin *cp);
+
+#endif
\ No newline at end of file
index e69de29..8fdb963 100644 (file)
@@ -0,0 +1,25 @@
+/*
+ * tel-plugin-at_standard
+ *
+ * Copyright (c) 2012 Intel Corporation. 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.
+ */
+
+#ifndef __AT_SIM_H__
+#define __AT_SIM_H__
+
+gboolean at_sim_init(TcorePlugin *cp);
+void at_sim_exit(TcorePlugin *cp);
+
+#endif
\ No newline at end of file
index 00f63bb..a287996 100644 (file)
@@ -19,7 +19,7 @@
 #ifndef __AT_SMS_H__
 #define __AT_SMS_H__
 
-gboolean at_sms_init(TcorePlugin *p);
-void at_sms_exit(TcorePlugin *p);
+gboolean at_sms_init(TcorePlugin *cp);
+void at_sms_exit(TcorePlugin *cp);
 
 #endif
index e69de29..7314116 100644 (file)
@@ -0,0 +1,25 @@
+/*
+ * tel-plugin-at_standard
+ *
+ * Copyright (c) 2012 Intel Corporation. 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.
+ */
+
+#ifndef __AT_SS_H__
+#define __AT_SS_H__
+
+gboolean at_ss_init(TcorePlugin *cp);
+void at_ss_exit(TcorePlugin *cp);
+
+#endif
\ No newline at end of file
index 98b1497..0bb45a2 100644 (file)
 #include <glib.h>
 
 #include <tcore.h>
-#include <hal.h>
-#include <core_object.h>
-#include <plugin.h>
-#include <queue.h>
 #include <server.h>
+#include <plugin.h>
+#include <core_object.h>
 #include <co_call.h>
 
 #include "at_call.h"
@@ -125,27 +123,31 @@ static struct tcore_call_operations call_ops = {
        .set_sound_noise_reduction = NULL,
 };
 
-gboolean at_call_init(TcorePlugin *p)
+gboolean at_call_init(TcorePlugin *cp)
 {
-       CoreObject *co = NULL;
+       CoreObject *co;
+       Server *server;
 
-       co = tcore_call_new(p, "call", &call_ops, NULL);
-       if (NULL == co)
+       co = tcore_call_new(cp, &call_ops, NULL);
+       if (co == NULL)
                return FALSE;
 
+       server = tcore_plugin_ref_server(cp);
+       tcore_server_add_template_object(server, co);
+
        return TRUE;
 }
 
-void at_call_exit(TcorePlugin *p)
+void at_call_exit(TcorePlugin *cp)
 {
        CoreObject *co;
 
-       if (NULL == p)
+       if (cp == NULL)
                return;
 
-       co = tcore_plugin_ref_core_object(p, "call");
-       if (NULL == co)
+       co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_CALL);
+       if (co == NULL)
                return;
 
-       tcore_call_free(co);
+       tcore_object_free(co);
 }
diff --git a/src/at_gps.c b/src/at_gps.c
new file mode 100644 (file)
index 0000000..50b3b2a
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * tel-plugin-at_standard
+ *
+ * Copyright (c) 2012 Intel Corporation. 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 <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <core_object.h>
+#include <co_gps.h>
+
+#include "at_gps.h"
+
+gboolean at_gps_init(TcorePlugin *cp)
+{
+       CoreObject *co;
+       Server *server;
+
+       co = tcore_gps_new(cp, NULL, NULL);
+       if (co == NULL)
+               return FALSE;
+
+       server = tcore_plugin_ref_server(cp);
+       tcore_server_add_template_object(server, co);
+
+       return TRUE;
+}
+
+void at_gps_exit(TcorePlugin *cp)
+{
+       CoreObject *co;
+
+       if (cp == NULL)
+               return;
+
+       co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_GPS);
+       if (co == NULL)
+               return;
+
+       tcore_object_free(co);
+}
index d78ceb3..afef19d 100644 (file)
@@ -22,8 +22,9 @@
 #include <glib.h>
 
 #include <tcore.h>
-#include <core_object.h>
+#include <server.h>
 #include <plugin.h>
+#include <core_object.h>
 #include <co_modem.h>
 
 #include "user_request.h"
@@ -57,27 +58,31 @@ static struct tcore_modem_operations modem_ops = {
        .get_flight_mode = NULL,
 };
 
-gboolean at_modem_init(TcorePlugin *p)
+gboolean at_modem_init(TcorePlugin *cp)
 {
        CoreObject *co;
+       Server *server;
 
-       co = tcore_modem_new(p, "modem", &modem_ops, NULL);
-       if (NULL == co)
+       co = tcore_modem_new(cp, &modem_ops, NULL);
+       if (co == NULL)
                return FALSE;
 
+       server = tcore_plugin_ref_server(cp);
+       tcore_server_add_template_object(server, co);
+
        return TRUE;
 }
 
-void at_modem_exit(TcorePlugin *p)
+void at_modem_exit(TcorePlugin *cp)
 {
        CoreObject *co;
 
-       if (NULL == p)
+       if (cp == NULL)
                return;
 
-       co = tcore_plugin_ref_core_object(p, "modem");
-       if (NULL == co)
+       co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_MODEM);
+       if (co == NULL)
                return;
 
-       tcore_modem_free(co);
+       tcore_object_free(co);
 }
index 5f76aca..87dd5f2 100644 (file)
 #include <glib.h>
 
 #include <tcore.h>
-#include <hal.h>
-#include <core_object.h>
+#include <server.h>
 #include <plugin.h>
-#include <queue.h>
+#include <core_object.h>
 #include <co_network.h>
-#include <server.h>
-
-#include "at.h"
-#include "user_request.h"
 
 #include "at_network.h"
 
@@ -75,27 +70,31 @@ static struct tcore_network_operations network_ops = {
        .get_mode = NULL,
 };
 
-gboolean at_network_init(TcorePlugin *plugin)
+gboolean at_network_init(TcorePlugin *cp)
 {
        CoreObject *co;
+       Server *server;
 
-       co = tcore_network_new(plugin, "umts_network", &network_ops, NULL);
-       if (NULL == co)
+       co = tcore_network_new(cp, &network_ops, NULL);
+       if (co == NULL)
                return FALSE;
 
+       server = tcore_plugin_ref_server(cp);
+       tcore_server_add_template_object(server, co);
+
        return TRUE;
 }
 
-void at_network_exit(TcorePlugin *plugin)
+void at_network_exit(TcorePlugin *cp)
 {
        CoreObject *co;
 
-       if (NULL == plugin)
+       if (cp == NULL)
                return;
 
-       co = tcore_plugin_ref_core_object(plugin, "umts_network");
-       if (NULL == co)
+       co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_NETWORK);
+       if (co == NULL)
                return;
 
-       tcore_network_free(co);
+       tcore_object_free(co);
 }
index db75680..bd73438 100644 (file)
@@ -19,8 +19,9 @@
 #include <glib.h>
 
 #include <tcore.h>
-#include <core_object.h>
+#include <server.h>
 #include <plugin.h>
+#include <core_object.h>
 #include <co_phonebook.h>
 
 #include "at_phonebook.h"
@@ -67,11 +68,15 @@ static struct tcore_phonebook_operations phonebook_ops = {
 gboolean at_phonebook_init(TcorePlugin *cp)
 {
        CoreObject *co;
+       Server *server;
 
-       co = tcore_phonebook_new(cp, "phonebook", &phonebook_ops, NULL);
+       co = tcore_phonebook_new(cp, &phonebook_ops, NULL);
        if (co == NULL)
                return FALSE;
 
+       server = tcore_plugin_ref_server(cp);
+       tcore_server_add_template_object(server, co);
+
        return TRUE;
 }
 
@@ -79,10 +84,13 @@ void at_phonebook_exit(TcorePlugin *cp)
 {
        CoreObject *co;
 
-       co = tcore_plugin_ref_core_object(cp, "phonebook");
+       if (cp == NULL)
+               return;
+
+       co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_PHONEBOOK);
        if (co == NULL)
                return;
 
-       tcore_phonebook_free(co);
+       tcore_object_free(co);
 }
 
index bb362d1..5cd0ec2 100644 (file)
@@ -52,7 +52,8 @@ static void on_confirmation_ps_message_send(TcorePending *p, gboolean result,
        dbg("Sending %s", (result == TRUE) ? "OK" : "FAIL");
 }
 
-static void notify_context_deactivated(CoreObject *co_ps, unsigned int cid)
+static void notify_context_status_changed(CoreObject *co_ps, unsigned int cid,
+                                               enum ps_data_call_status status)
 {
        struct tnoti_ps_call_status data_resp = {0};
        TcorePlugin *p = tcore_object_ref_plugin(co_ps);
@@ -61,7 +62,7 @@ static void notify_context_deactivated(CoreObject *co_ps, unsigned int cid)
        dbg("Enter");
 
        data_resp.context_id = cid;
-       data_resp.state = PS_DATA_CALL_NOT_CONNECTED;
+       data_resp.state = status;
 
        tcore_server_send_notification(server, co_ps, TNOTI_PS_CALL_STATUS,
                                        sizeof(struct tnoti_ps_call_status),
@@ -70,7 +71,64 @@ static void notify_context_deactivated(CoreObject *co_ps, unsigned int cid)
        dbg("Exit");
 }
 
-static void on_setup_netif(CoreObject *co_ps, const char *netif_name,
+static void on_unmount_netif(CoreObject *co_ps, const char *netif_name,
+                               void *user_data)
+{
+       CoreObject *ps_context = user_data;
+       char *ifname;
+
+       dbg("Enter");
+
+       ifname = tcore_context_get_ipv4_devname(ps_context);
+
+       if (tcore_util_netif(ifname, FALSE) != TCORE_RETURN_SUCCESS)
+               dbg("disabling network interface failed");
+
+       dbg("Exit");
+}
+
+static void on_response_set_pdp_context_deactivate(TcorePending *p,
+                                                       int data_len,
+                                                       const void *data,
+                                                       void *user_data)
+{
+       CoreObject *co_ps = tcore_pending_ref_core_object(p);
+       TcoreHal *h = tcore_object_get_hal(co_ps);
+       const TcoreATResponse *resp = data;
+       CoreObject *ps_context = user_data;
+       unsigned int cid = tcore_context_get_id(ps_context);
+
+       dbg("Enter");
+
+       /*
+        * AT+CGACT = 0 is returning NO CARRIER or an error. Just test if the
+        * response contains NO CARRIER else decode CME error.
+        */
+       if (resp->lines != NULL) {
+               const char *line;
+
+               line = (const char *)resp->lines->data;
+               if (g_strcmp0(line, "NO CARRIER") != 0) {
+                       /* TODO: Decode CME error */
+                       err("%s", line);
+                       err("Context %d has not been deactivated", cid);
+
+                       goto out;
+               }
+
+       }
+
+       notify_context_status_changed(co_ps, cid, PS_DATA_CALL_NOT_CONNECTED);
+
+       if (tcore_hal_setup_netif(h, co_ps, on_unmount_netif, ps_context, cid,
+                                       FALSE) != TCORE_RETURN_SUCCESS)
+               err("Failed to disable network interface");
+
+out:
+       dbg("Exit");
+}
+
+static void on_mount_netif(CoreObject *co_ps, const char *netif_name,
                                void *user_data)
 {
        CoreObject *ps_context = user_data;
@@ -82,6 +140,8 @@ static void on_setup_netif(CoreObject *co_ps, const char *netif_name,
        dbg("devname = [%s]", netif_name);
 
        tcore_context_set_ipv4_devname(ps_context, netif_name);
+       if (tcore_util_netif(netif_name, TRUE) != TCORE_RETURN_SUCCESS)
+               dbg("disabling network interface failed");
 
        server = tcore_plugin_ref_server(tcore_object_ref_plugin(co_ps));
 
@@ -111,14 +171,14 @@ static void on_response_get_pdp_address(TcorePending *p, int data_len,
 
        dbg("Enter");
 
-       if (NULL == resp->final_response) {
+       if (resp->final_response == NULL) {
                err("Response NOK");
                goto error;
        }
 
        dbg("Response OK");
 
-       if (NULL == resp->lines) {
+       if (resp->lines == NULL) {
                err("Invalid response line");
                goto error;
        }
@@ -146,8 +206,8 @@ static void on_response_get_pdp_address(TcorePending *p, int data_len,
 
        tcore_context_set_ipv4_dns(ps_context, "8.8.8.8", "8.8.4.4");
 
-       if (tcore_hal_setup_netif(h, co_ps, on_setup_netif, ps_context, cid)
-                                       == TCORE_RETURN_SUCCESS)
+       if (tcore_hal_setup_netif(h, co_ps, on_mount_netif, ps_context, cid,
+                                       TRUE) == TCORE_RETURN_SUCCESS)
                goto out;
 
 error:
@@ -156,7 +216,6 @@ error:
 
 out:
        tcore_at_tok_free(tokens);
-
        dbg("Exit");
 }
 
@@ -184,42 +243,6 @@ static void get_pdp_address(CoreObject *co_ps, CoreObject *ps_context)
        dbg("Exit");
 }
 
-static void on_response_set_pdp_context_deactivate(TcorePending *p,
-                                                       int data_len,
-                                                       const void *data,
-                                                       void *user_data)
-{
-       CoreObject *co_ps = tcore_pending_ref_core_object(p);
-       const TcoreATResponse *resp = data;
-       CoreObject *ps_context = user_data;
-       unsigned int cid = tcore_context_get_id(ps_context);
-
-       dbg("Enter");
-
-       /*
-        * AT+CGACT = 0 is returning NO CARRIER or an error. Just test if the
-        * response contains NO CARRIER else decode CME error.
-        */
-       if (resp->lines != NULL) {
-               const char *line;
-
-               line = (const char *)resp->lines->data;
-               if (g_strcmp0(line, "NO CARRIER") != 0) {
-                       /* TODO: Decode CME error */
-                       err("%s", line);
-                       err("Context %d has not been deactivated", cid);
-
-                       goto out;
-               }
-
-       }
-
-       notify_context_deactivated(co_ps, cid);
-
-out:
-       dbg("Exit");
-}
-
 static void on_response_set_pdp_context_activate(TcorePending *p, int data_len,
                                                        const void *data,
                                                        void *user_data)
@@ -238,7 +261,7 @@ static void on_response_set_pdp_context_activate(TcorePending *p, int data_len,
 
                /* TODO: Manage CME errors */
                err("Response NOK");
-               notify_context_deactivated(co_ps, cid);
+               notify_context_status_changed(co_ps, cid, PS_DATA_CALL_NOT_CONNECTED);
        }
 
        dbg("Exit");
@@ -270,7 +293,7 @@ static TReturn set_pdp_context(CoreObject *co_ps, CoreObject *ps_context,
                                        on_confirmation_ps_message_send, NULL)
                                        != TCORE_RETURN_SUCCESS) {
                err("Failed to prepare and send AT request");
-               notify_context_deactivated(co_ps, cid);
+               notify_context_status_changed(co_ps, cid, PS_DATA_CALL_NOT_CONNECTED);
                ret =  TCORE_RETURN_FAILURE;
        }
 
@@ -287,23 +310,24 @@ static void on_response_define_pdp_context(TcorePending *p, int data_len,
 {
        const TcoreATResponse *resp = data;
        CoreObject *ps_context = user_data;
+       unsigned int cid = tcore_context_get_id(ps_context);
        CoreObject *co_ps = tcore_pending_ref_core_object(p);
 
        dbg("Enter");
 
        if (resp->success) {
                dbg("Response OK");
-               set_pdp_context(co_ps, ps_context, ACTIVATE);
+               notify_context_status_changed(co_ps, cid, PS_DATA_CALL_CTX_DEFINED);
        } else {
-               unsigned int cid = tcore_context_get_id(ps_context);
                err("Response NOK");
-               notify_context_deactivated(co_ps, cid);
+               notify_context_status_changed(co_ps, cid, PS_DATA_CALL_NOT_CONNECTED);
        }
 
        dbg("Exit");
 }
 
-static TReturn define_pdp_context(CoreObject *co_ps, CoreObject *ps_context)
+static TReturn define_pdp_context(CoreObject *co_ps, CoreObject *ps_context,
+                                       void *user_data)
 {
        char *apn = NULL;
        char *cmd_str = NULL;
@@ -370,10 +394,9 @@ static TReturn define_pdp_context(CoreObject *co_ps, CoreObject *ps_context)
        err("Failed to prepare and send AT request");
 
 error:
-       notify_context_deactivated(co_ps, cid);
+       notify_context_status_changed(co_ps, cid, PS_DATA_CALL_NOT_CONNECTED);
 
 out:
-
        dbg("Exit");
 
        return ret;
@@ -391,7 +414,7 @@ static gboolean on_cgev_notification(CoreObject *co_ps, const void *data,
 
        dbg("Enter");
 
-       if (NULL == line)
+       if (line == NULL)
                goto out;
 
        dbg("Lines->data :%s", line);
@@ -413,7 +436,12 @@ static gboolean on_cgev_notification(CoreObject *co_ps, const void *data,
        cid = (unsigned int)atoi(noti_data);
        dbg("Context %d deactivated", cid);
 
-       notify_context_deactivated(co_ps, cid);
+       notify_context_status_changed(co_ps, cid, PS_DATA_CALL_NOT_CONNECTED);
+
+       /*
+        * TODO Implement core object PS API to retreive context by ID to get
+        * network interface name and disable it.
+        */
 
 out:
        tcore_at_tok_free(tokens);
@@ -426,7 +454,7 @@ out:
 static TReturn activate_ps_context(CoreObject *co_ps, CoreObject *ps_context,
                                        void *user_data)
 {
-       return define_pdp_context(co_ps, ps_context);
+       return set_pdp_context(co_ps, ps_context, ACTIVATE);
 }
 
 static TReturn deactivate_ps_context(CoreObject *co_ps, CoreObject *ps_context,
@@ -436,34 +464,38 @@ static TReturn deactivate_ps_context(CoreObject *co_ps, CoreObject *ps_context,
 }
 
 static struct tcore_ps_operations ps_ops = {
+       .define_context = define_pdp_context,
        .activate_context = activate_ps_context,
        .deactivate_context = deactivate_ps_context
 };
 
-gboolean at_ps_init(TcorePlugin *p)
+gboolean at_ps_init(TcorePlugin *cp)
 {
-       CoreObject *co_ps;
+       CoreObject *co = NULL;
        Server *server;
 
-       co_ps = tcore_ps_new(p, "umts_ps", &ps_ops, NULL);
-       if (NULL == co_ps)
+       co = tcore_ps_new(cp, &ps_ops, NULL);
+       if (co == NULL)
                return FALSE;
 
-       tcore_object_add_callback(co_ps, "+CGEV", on_cgev_notification, NULL);
+       tcore_object_add_callback(co, "+CGEV", on_cgev_notification, NULL);
 
-       server = tcore_plugin_ref_server(p);
-       tcore_server_add_template_object(server, co_ps);
+       server = tcore_plugin_ref_server(cp);
+       tcore_server_add_template_object(server, co);
 
        return TRUE;
 }
 
-void at_ps_exit(TcorePlugin *p)
+void at_ps_exit(TcorePlugin *cp)
 {
-       CoreObject *co_ps;
+       CoreObject *co;
+
+       if (cp == NULL)
+               return;
 
-       co_ps = tcore_plugin_ref_core_object(p, "umts_ps");
-       if (NULL == co_ps)
+       co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_PS);
+       if (co == NULL)
                return;
 
-       tcore_ps_free(co_ps);
+       tcore_object_free(co);
 }
diff --git a/src/at_sap.c b/src/at_sap.c
new file mode 100644 (file)
index 0000000..37bd789
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * tel-plugin-at_standard
+ *
+ * Copyright (c) 2012 Intel Corporation. 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 <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <core_object.h>
+#include <co_sap.h>
+
+#include "at_sap.h"
+
+gboolean at_sap_init(TcorePlugin *cp)
+{
+       CoreObject *co;
+       Server *server;
+
+       co = tcore_sap_new(cp, NULL, NULL);
+       if (co == NULL)
+               return FALSE;
+
+       server = tcore_plugin_ref_server(cp);
+       tcore_server_add_template_object(server, co);
+
+       return TRUE;
+}
+
+void at_sap_exit(TcorePlugin *cp)
+{
+       CoreObject *co;
+
+       if (cp == NULL)
+               return;
+
+       co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_SAP);
+       if (co == NULL)
+               return;
+
+       tcore_object_free(co);
+}
diff --git a/src/at_sat.c b/src/at_sat.c
new file mode 100644 (file)
index 0000000..d20f75d
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * tel-plugin-at_standard
+ *
+ * Copyright (c) 2012 Intel Corporation. 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 <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <core_object.h>
+#include <co_sat.h>
+
+#include "at_sat.h"
+
+gboolean at_sat_init(TcorePlugin *cp)
+{
+       CoreObject *co;
+       Server *server;
+
+       co = tcore_sat_new(cp, NULL, NULL);
+       if (co == NULL)
+               return FALSE;
+
+       server = tcore_plugin_ref_server(cp);
+       tcore_server_add_template_object(server, co);
+
+       return TRUE;
+}
+
+void at_sat_exit(TcorePlugin *cp)
+{
+       CoreObject *co;
+
+       if (cp == NULL)
+               return;
+
+       co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_SAT);
+       if (co == NULL)
+               return;
+
+       tcore_object_free(co);
+}
index e69de29..b6a3f12 100644 (file)
@@ -0,0 +1,61 @@
+/*
+ * tel-plugin-at_standard
+ *
+ * Copyright (c) 2012 Intel Corporation. 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 <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <core_object.h>
+#include <co_sim.h>
+
+#include "at_sim.h"
+
+gboolean at_sim_init(TcorePlugin *cp)
+{
+       CoreObject *co;
+       Server *server;
+
+       co = tcore_sim_new(cp, NULL, NULL);
+       if (co == NULL)
+               return FALSE;
+
+       server = tcore_plugin_ref_server(cp);
+       tcore_server_add_template_object(server, co);
+
+       return TRUE;
+}
+
+void at_sim_exit(TcorePlugin *cp)
+{
+       CoreObject *co;
+
+       if (cp == NULL)
+               return;
+
+       co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_SIM);
+       if (co == NULL)
+               return;
+
+       tcore_object_free(co);
+}
index 2fc2728..e1bcef7 100644 (file)
@@ -27,7 +27,6 @@
 #include <server.h>
 #include <plugin.h>
 #include <core_object.h>
-
 #include <co_sms.h>
 
 #include "at_sms.h"
@@ -143,24 +142,31 @@ static struct tcore_sms_operations sms_ops = {
        .send_cdma_msg = send_cdma_msg,
 };
 
-gboolean at_sms_init(TcorePlugin *p)
+gboolean at_sms_init(TcorePlugin *cp)
 {
-       CoreObject *co_sms;
+       CoreObject *co;
+       Server *server;
 
-       co_sms = tcore_sms_new(p, "umts_sms", &sms_ops, NULL);
-       if (NULL == co_sms)
+       co = tcore_sms_new(cp, &sms_ops, NULL);
+       if (co == NULL)
                return FALSE;
 
+       server = tcore_plugin_ref_server(cp);
+       tcore_server_add_template_object(server, co);
+
        return TRUE;
 }
 
-void at_sms_exit(TcorePlugin *p)
+void at_sms_exit(TcorePlugin *cp)
 {
-       CoreObject *co_sms;
+       CoreObject *co;
+
+       if (cp == NULL)
+               return;
 
-       co_sms = tcore_plugin_ref_core_object(p, "umts_sms");
-       if (NULL == co_sms)
+       co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_SMS);
+       if (co == NULL)
                return;
 
-       tcore_sms_free(co_sms);
+       tcore_object_free(co);
 }
index e69de29..96018ab 100644 (file)
@@ -0,0 +1,62 @@
+/*
+ * tel-plugin-at_standard
+ *
+ * Copyright (c) 2012 Intel Corporation. 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 <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <core_object.h>
+#include <co_ss.h>
+
+#include "at_ss.h"
+
+gboolean at_ss_init(TcorePlugin *cp)
+{
+       CoreObject *co;
+       Server *server;
+
+       co = tcore_ss_new(cp, NULL, NULL);
+       if (co == NULL)
+               return FALSE;
+
+       server = tcore_plugin_ref_server(cp);
+       tcore_server_add_template_object(server, co);
+
+       return TRUE;
+}
+
+void at_ss_exit(TcorePlugin *cp)
+{
+       CoreObject *co;
+
+       if (cp == NULL)
+               return;
+
+       co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_SS);
+       if (co == NULL)
+               return;
+
+       tcore_object_free(co);
+}
+