summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRavi kumar Veeramally <ravikumar.veeramally@linux.intel.com>2012-12-11 16:02:11 +0100
committerFrederic PAUT <frederic.paut@linux.intel.com>2012-12-11 16:02:11 +0100
commit6eea69a09e1ebf058b3bdf3e80663d71d2d7a45e (patch)
tree6caf5c7ce458aa385b6b0c2de35665c0879ac8b2 /lib
parent4e41558d2d7a31d0cdcdd2d101472d899ccb5b2d (diff)
downloadneardal-6eea69a09e1ebf058b3bdf3e80663d71d2d7a45e.tar.gz
neardal-6eea69a09e1ebf058b3bdf3e80663d71d2d7a45e.tar.bz2
neardal-6eea69a09e1ebf058b3bdf3e80663d71d2d7a45e.zip
support for neard radio mode
Diffstat (limited to 'lib')
-rw-r--r--lib/neardal.c4
-rw-r--r--lib/neardal.h2
-rw-r--r--lib/neardal_adapter.c20
-rw-r--r--lib/neardal_adapter.h1
4 files changed, 27 insertions, 0 deletions
diff --git a/lib/neardal.c b/lib/neardal.c
index 29e85e5..3c3eaa9 100644
--- a/lib/neardal.c
+++ b/lib/neardal.c
@@ -393,6 +393,9 @@ void neardal_free_adapter(neardal_adapter *adapter)
/* Freeing adapter name */
g_free(adapter->name);
+ /* Freeing adapter mode */
+ g_free(adapter->mode);
+
/* Freeing protocols list */
ct = 0;
while (ct < adapter->nbProtocols)
@@ -440,6 +443,7 @@ errorCode_t neardal_get_adapter_properties(const char *adpName,
*adapter = adpClient;
adpClient->name = g_strdup(adpProp->name);
+ adpClient->mode = g_strdup(adpProp->mode);
adpClient->polling = (short) adpProp->polling;
adpClient->powered = (short) adpProp->powered;
diff --git a/lib/neardal.h b/lib/neardal.h
index 52a82c5..5e8d331 100644
--- a/lib/neardal.h
+++ b/lib/neardal.h
@@ -47,6 +47,8 @@ extern "C" {
typedef struct {
/*! \brief DBus interface adapter name (as identifier) */
char *name;
+/*! \brief Neard adapter NFC radio mode */
+ char *mode;
/*! \brief Neard adapter polling already active ? */
short polling;
/*! \brief Neard adapter powered ? */
diff --git a/lib/neardal_adapter.c b/lib/neardal_adapter.c
index 9ea4dc2..8d1de76 100644
--- a/lib/neardal_adapter.c
+++ b/lib/neardal_adapter.c
@@ -172,6 +172,7 @@ static void neardal_adp_prv_cb_property_changed(orgNeardAdp *proxy,
DevProp *devProp = NULL;
gchar **array = NULL;
GVariant *gvalue = NULL;
+ gsize mode_len;
(void) proxy; /* remove warning */
(void) user_data; /* remove warning */
@@ -190,6 +191,19 @@ static void neardal_adp_prv_cb_property_changed(orgNeardAdp *proxy,
goto exit;
}
+ NEARDAL_TRACEF(" arg_unnamed_arg0 : %s\n", arg_unnamed_arg0);
+
+ if (!strcmp(arg_unnamed_arg0, "Mode")) {
+ if (adpProp->mode != NULL) {
+ g_free(adpProp->mode);
+ adpProp->mode = NULL;
+ }
+
+ adpProp->mode = g_strdup(g_variant_get_string(gvalue, &mode_len));
+ clientValue = adpProp->mode;
+ NEARDAL_TRACEF("neardalMgr.mode=%s\n", adpProp->mode);
+ }
+
if (!strcmp(arg_unnamed_arg0, "Polling")) {
adpProp->polling = g_variant_get_boolean(gvalue);
clientValue = GUINT_TO_POINTER(adpProp->polling);
@@ -383,6 +397,10 @@ static errorCode_t neardal_adp_prv_read_properties(AdpProp *adpProp)
if (tmpOut != NULL)
adpProp->powered = g_variant_get_boolean(tmpOut);
+ tmpOut = g_variant_lookup_value(tmp, "Mode", G_VARIANT_TYPE_STRING);
+ if (tmpOut != NULL)
+ adpProp->mode = g_variant_dup_string(tmpOut, &len);
+
tmpOut = g_variant_lookup_value(tmp, "Protocols",
G_VARIANT_TYPE_ARRAY);
if (tmpOut != NULL) {
@@ -546,6 +564,8 @@ static void neardal_adp_prv_free(AdpProp **adpProp)
(*adpProp)->proxy = NULL;
}
g_free((*adpProp)->name);
+ if ((*adpProp)->mode != NULL)
+ g_free((*adpProp)->mode);
if ((*adpProp)->protocols != NULL)
g_strfreev((*adpProp)->protocols);
g_free((*adpProp));
diff --git a/lib/neardal_adapter.h b/lib/neardal_adapter.h
index e74e17e..2b0745a 100644
--- a/lib/neardal_adapter.h
+++ b/lib/neardal_adapter.h
@@ -39,6 +39,7 @@ typedef struct {
Adapter interface */
gchar *name; /* DBus interface name
(as id) */
+ gchar *mode; /* NFC radio mode */
void *parent;
gboolean polling; /* adapter polling active ? */
gboolean powered; /* adapter powered ? */