summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi kumar Veeramally <ravikumar.veeramally@linux.intel.com>2013-02-08 14:01:48 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2013-02-11 09:29:13 +0100
commit9e926fbc38ae53388f628c65f72f0da14cd8f5c8 (patch)
tree94371621c6f5bb51d6f45200751174b5041bcb77
parent702a4dc5f5ec21a18efa6c01a0494b4a47499e14 (diff)
downloadneard-9e926fbc38ae53388f628c65f72f0da14cd8f5c8.tar.gz
neard-9e926fbc38ae53388f628c65f72f0da14cd8f5c8.tar.bz2
neard-9e926fbc38ae53388f628c65f72f0da14cd8f5c8.zip
near: Rename struct name bt_data to carrier_data
To be more generic, renaming structure name from bt_data to carrier_data.
-rw-r--r--include/ndef.h4
-rw-r--r--src/agent.c49
-rw-r--r--src/bluetooth.c6
-rw-r--r--src/ndef.c8
-rw-r--r--src/near.h11
5 files changed, 40 insertions, 38 deletions
diff --git a/include/ndef.h b/include/ndef.h
index 061877b..c4ca76f 100644
--- a/include/ndef.h
+++ b/include/ndef.h
@@ -25,7 +25,7 @@
#include <near/tag.h>
struct near_ndef_record;
-struct bt_data;
+struct carrier_data;
struct near_ndef_message {
size_t length;
@@ -65,7 +65,7 @@ struct near_ndef_message *near_ndef_prepare_uri_record(uint8_t identifier,
struct near_ndef_message *near_ndef_prepare_handover_record(char* type_name,
struct near_ndef_record *record,
uint8_t carriers,
- struct bt_data *remote);
+ struct carrier_data *remote);
struct near_ndef_message *
near_ndef_prepare_smartposter_record(uint8_t uri_identifier,
diff --git a/src/agent.c b/src/agent.c
index 99c3a9c..79c2cc9 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -241,17 +241,17 @@ static enum carrier_power_state string2cps(const char *state)
return CPS_UNKNOWN;
}
-static struct bt_data *parse_reply(DBusMessage *reply)
+static struct carrier_data *parse_reply(DBusMessage *reply)
{
DBusMessageIter args;
DBusMessageIter data;
- struct bt_data *bt_data;
+ struct carrier_data *c_data;
- bt_data = g_try_new0(struct bt_data, 1);
- if (bt_data == NULL)
+ c_data = g_try_new0(struct carrier_data, 1);
+ if (c_data == NULL)
return NULL;
- bt_data->state = CPS_UNKNOWN;
+ c_data->state = CPS_UNKNOWN;
dbus_message_iter_init(reply, &args);
dbus_message_iter_recurse(&args, &data);
@@ -279,8 +279,8 @@ static struct bt_data *parse_reply(DBusMessage *reply)
dbus_message_iter_get_basic(&value, &state);
- bt_data->state = string2cps(state);
- if (bt_data->state == CPS_UNKNOWN)
+ c_data->state = string2cps(state);
+ if (c_data->state == CPS_UNKNOWN)
goto failed;
} else if (strcasecmp(key, "EIR") == 0) {
int size;
@@ -296,15 +296,15 @@ static struct bt_data *parse_reply(DBusMessage *reply)
if (size > UINT8_MAX || size < 8)
goto failed;
- memcpy(bt_data->data, oob_data, size);
- bt_data->size = size;
- bt_data->type = BT_MIME_V2_1;
+ memcpy(c_data->data, oob_data, size);
+ c_data->size = size;
+ c_data->type = BT_MIME_V2_1;
} else if (strcasecmp(key, "nokia.com:bt") == 0) {
int size;
void *oob_data;
/* prefer EIR over nokia.com:bt */
- if (bt_data->type == BT_MIME_V2_1)
+ if (c_data->type == BT_MIME_V2_1)
continue;
dbus_message_iter_recurse(&value, &array);
@@ -314,22 +314,22 @@ static struct bt_data *parse_reply(DBusMessage *reply)
if (size > UINT8_MAX || size < 8)
goto failed;
- memcpy(bt_data->data, oob_data, size);
- bt_data->size = size;
- bt_data->type = BT_MIME_V2_1;
+ memcpy(c_data->data, oob_data, size);
+ c_data->size = size;
+ c_data->type = BT_MIME_V2_1;
}
dbus_message_iter_next(&data);
}
/* State can be present only if EIR or nokia.com:bt is also present */
- if (bt_data->state != CPS_UNKNOWN && bt_data->size == 0)
+ if (c_data->state != CPS_UNKNOWN && c_data->size == 0)
goto failed;
- return bt_data;
+ return c_data;
failed:
- g_free(bt_data);
+ g_free(c_data);
return NULL;
}
@@ -339,7 +339,7 @@ static const char *cps2string[] = {
"activating",
};
-static void prepare_bt_data(DBusMessage *message, struct bt_data *data)
+static void prepare_bt_data(DBusMessage *message, struct carrier_data *data)
{
DBusMessageIter iter;
DBusMessageIter dict;
@@ -373,12 +373,13 @@ static void prepare_bt_data(DBusMessage *message, struct bt_data *data)
near_dbus_dict_close(&iter, &dict);
}
-struct bt_data *__near_agent_handover_request_data(struct bt_data *data)
+struct carrier_data *__near_agent_handover_request_data(
+ struct carrier_data *data)
{
DBusMessage *message;
DBusMessage *reply;
DBusError error;
- struct bt_data *bt_data_reply;
+ struct carrier_data *data_reply;
DBG("agent %s", handover_agent_path ? : "not present");
@@ -410,16 +411,16 @@ struct bt_data *__near_agent_handover_request_data(struct bt_data *data)
return NULL;
}
- bt_data_reply = parse_reply(reply);
+ data_reply = parse_reply(reply);
dbus_message_unref(reply);
- DBG("OOB data %p", bt_data_reply);
+ DBG("OOB data %p", data_reply);
- return bt_data_reply;
+ return data_reply;
}
-int __near_agent_handover_push_data(struct bt_data *data)
+int __near_agent_handover_push_data(struct carrier_data *data)
{
DBusMessage *message;
DBusMessage *reply;
diff --git a/src/bluetooth.c b/src/bluetooth.c
index 9bf1e38..72fd81f 100644
--- a/src/bluetooth.c
+++ b/src/bluetooth.c
@@ -678,7 +678,7 @@ static void bt_parse_eir(uint8_t *eir_data, uint16_t eir_data_len,
* mime_properties is a bitmask and should reflect the fields found in
* the incoming oob.
*/
-int __near_bluetooth_parse_oob_record(struct bt_data *data,
+int __near_bluetooth_parse_oob_record(struct carrier_data *data,
uint16_t *mime_properties,
near_bool_t pair)
{
@@ -846,9 +846,9 @@ done:
* mime_props is a bitmask we use to add or not specific fields in the
* oob frame (e.g.: OOB keys)
* */
-struct bt_data *__near_bluetooth_local_get_properties(uint16_t mime_props)
+struct carrier_data *__near_bluetooth_local_get_properties(uint16_t mime_props)
{
- struct bt_data *data = NULL;
+ struct carrier_data *data = NULL;
uint8_t offset;
char hash[OOB_SP_SIZE];
diff --git a/src/ndef.c b/src/ndef.c
index ad0ba9b..0b5f354 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -1338,7 +1338,7 @@ fail:
return NULL;
}
-static void correct_eir_len(struct bt_data *data)
+static void correct_eir_len(struct carrier_data *data)
{
/*
* Android 4.1 BUG - OOB EIR length should be in LE, but is in BE.
@@ -1369,7 +1369,7 @@ parse_mime_type(struct near_ndef_record *record, uint8_t *ndef_data,
{
struct near_ndef_mime_payload *mime = NULL;
int err = 0;
- struct bt_data data;
+ struct carrier_data data;
DBG("");
@@ -1810,9 +1810,9 @@ static uint16_t near_get_carrier_properties(struct near_ndef_record *record,
struct near_ndef_message *near_ndef_prepare_handover_record(char *type_name,
struct near_ndef_record *record,
uint8_t carriers,
- struct bt_data *remote)
+ struct carrier_data *remote)
{
- struct bt_data *local = NULL;
+ struct carrier_data *local = NULL;
struct near_ndef_message *hs_msg = NULL;
struct near_ndef_message *ac_msg = NULL;
struct near_ndef_message *cr_msg = NULL;
diff --git a/src/near.h b/src/near.h
index 28b170c..c152436 100644
--- a/src/near.h
+++ b/src/near.h
@@ -178,7 +178,7 @@ void __near_plugin_cleanup(void);
#define OOB_PROPS_COD 0x08
#define OOB_PROPS_SP (OOB_PROPS_SP_HASH | OOB_PROPS_SP_RANDOM)
-struct bt_data {
+struct carrier_data {
uint8_t type;
uint8_t size;
enum carrier_power_state state;
@@ -189,10 +189,10 @@ int __near_bluetooth_init(void);
void __near_bluetooth_cleanup(void);
void __near_bluetooth_legacy_start(void);
void __near_bluetooth_legacy_stop(void);
-int __near_bluetooth_parse_oob_record(struct bt_data *data,
+int __near_bluetooth_parse_oob_record(struct carrier_data *data,
uint16_t *properties, near_bool_t pair);
int __near_bluetooth_pair(void *data);
-struct bt_data *__near_bluetooth_local_get_properties(uint16_t mime_props);
+struct carrier_data *__near_bluetooth_local_get_properties(uint16_t mime_props);
void __near_agent_ndef_parse_records(GList *records);
int __near_agent_ndef_register(const char *sender, const char *path,
@@ -203,8 +203,9 @@ int __near_agent_handover_register(const char *sender, const char *path);
int __near_agent_handover_unregister(const char *sender, const char *path);
near_bool_t __near_agent_handover_registered(void);
-struct bt_data *__near_agent_handover_request_data(struct bt_data *data);
-int __near_agent_handover_push_data(struct bt_data *data);
+struct carrier_data *__near_agent_handover_request_data(
+ struct carrier_data *data);
+int __near_agent_handover_push_data(struct carrier_data *data);
int __near_agent_init(void);
void __near_agent_cleanup(void);