uint8_t *data;
};
-enum near_ndef_handover_carrier {
- NEAR_CARRIER_BLUETOOTH,
- NEAR_CARRIER_WIFI,
-};
+/* near_ndef_handover_carrier*/
+#define NEAR_CARRIER_EMPTY 0x00
+#define NEAR_CARRIER_BLUETOOTH 0x01 /* bit 0 */
+#define NEAR_CARRIER_WIFI 0x02 /* bit 1 */
+#define NEAR_CARRIER_UNKNOWN 0x80 /* Bit 7 */
int near_ndef_count_records(uint8_t *ndef_in, size_t ndef_in_length,
uint8_t record_type);
struct near_ndef_message *near_ndef_prepare_handover_record(char* type_name,
struct near_ndef_record *record,
- enum near_ndef_handover_carrier carrier);
+ uint8_t carriers);
struct near_ndef_message *
near_ndef_prepare_smartposter_record(uint8_t uri_identifier,
*/
struct near_ndef_message *near_ndef_prepare_handover_record(char* type_name,
struct near_ndef_record *record,
- enum near_ndef_handover_carrier carrier)
+ uint8_t carriers)
+
{
uint8_t *oob_data = NULL;
int oob_size;
if (ac_msg == NULL)
goto fail;
- switch (carrier) {
- case NEAR_CARRIER_BLUETOOTH:
+ if (carriers & NEAR_CARRIER_BLUETOOTH) {
/* Retrieve the bluetooth settings */
oob_data = __near_bluetooth_local_get_properties(&oob_size);
if (oob_data == NULL) {
goto fail;
near_ndef_set_mb_me(bt_msg->data, FALSE, TRUE);
+ }
- break;
-
- case NEAR_CARRIER_WIFI:
+ if (carriers & NEAR_CARRIER_WIFI) {
+ /* TODO LATER */
goto fail;
}
*/
hs_msg->data[NDEF_PAYLOAD_LENGTH_OFFSET] = hs_length;
- /* Fill the message .... */
- near_ndef_set_mb_me(hs_msg->data, TRUE, FALSE);
+ if (carriers == NEAR_CARRIER_EMPTY)
+ near_ndef_set_mb_me(hs_msg->data, TRUE, TRUE);
+ else
+ near_ndef_set_mb_me(hs_msg->data, TRUE, FALSE);
/* Add version */
hs_msg->data[hs_msg->offset++] = HANDOVER_VERSION;
static struct near_ndef_message *build_ho_record(DBusMessage *msg)
{
char *carrier_type = NULL;
- enum near_ndef_handover_carrier carrier;
+ uint8_t carrier;
struct near_ndef_record *record = NULL;
DBG("");
return NULL;
}
+ carrier = NEAR_CARRIER_EMPTY;
if (g_strcmp0(carrier_type, "bluetooth") == 0)
- carrier = NEAR_CARRIER_BLUETOOTH;
- else if (g_strcmp0(carrier_type, "wifi") == 0)
- carrier = NEAR_CARRIER_WIFI;
- else {
+ carrier |= NEAR_CARRIER_BLUETOOTH;
+ if (g_strcmp0(carrier_type, "wifi") == 0)
+ carrier |= NEAR_CARRIER_WIFI;
+
+ if (carrier == NEAR_CARRIER_EMPTY) {
DBG("Invalid carrier name");
return NULL;
}