diff options
-rw-r--r-- | include/tag.h | 4 | ||||
-rw-r--r-- | plugins/mifare.c | 4 | ||||
-rw-r--r-- | plugins/nfctype1.c | 8 | ||||
-rw-r--r-- | plugins/nfctype2.c | 12 | ||||
-rw-r--r-- | plugins/nfctype3.c | 8 | ||||
-rw-r--r-- | plugins/nfctype4.c | 8 | ||||
-rw-r--r-- | src/adapter.c | 4 | ||||
-rw-r--r-- | src/near.h | 2 | ||||
-rw-r--r-- | src/tag.c | 9 |
9 files changed, 30 insertions, 29 deletions
diff --git a/include/tag.h b/include/tag.h index 4b2e02c..4ec5b6a 100644 --- a/include/tag.h +++ b/include/tag.h @@ -63,9 +63,9 @@ struct near_tag_driver { uint16_t type; int priority; - int (*read_tag)(uint32_t adapter_idx, uint32_t target_idx, + int (*read)(uint32_t adapter_idx, uint32_t target_idx, near_tag_io_cb cb); - int (*add_ndef)(uint32_t adapter_idx, uint32_t target_idx, + int (*write)(uint32_t adapter_idx, uint32_t target_idx, struct near_ndef_message *ndef, near_tag_io_cb cb); int (*check_presence)(uint32_t adapter_idx, uint32_t target_idx, diff --git a/plugins/mifare.c b/plugins/mifare.c index f72a797..a2e5b3b 100644 --- a/plugins/mifare.c +++ b/plugins/mifare.c @@ -45,7 +45,7 @@ * */ /* Prototype */ -int mifare_read_tag(uint32_t adapter_idx, uint32_t target_idx, +int mifare_read(uint32_t adapter_idx, uint32_t target_idx, near_tag_io_cb cb, enum near_tag_sub_type tgt_subtype); /* MIFARE command set */ @@ -620,7 +620,7 @@ out_err: * On sector 0x10, App. directory is on block 0x40, 0x41 & 0x42 * On reading, we ignore the CRC. */ -int mifare_read_tag(uint32_t adapter_idx, uint32_t target_idx, +int mifare_read(uint32_t adapter_idx, uint32_t target_idx, near_tag_io_cb cb, enum near_tag_sub_type tgt_subtype) { struct mifare_cookie *cookie; diff --git a/plugins/nfctype1.c b/plugins/nfctype1.c index 1e67ea0..37757c3 100644 --- a/plugins/nfctype1.c +++ b/plugins/nfctype1.c @@ -314,7 +314,7 @@ out_err: * This cmd is common to static and dynamic targets * This should allow to get the HR0 byte */ -static int nfctype1_read_tag(uint32_t adapter_idx, +static int nfctype1_read(uint32_t adapter_idx, uint32_t target_idx, near_tag_io_cb cb) { struct type1_cmd t1_cmd; @@ -470,7 +470,7 @@ out: * Write NDEF Message data * Write NMN = E1h as the last byte to be written */ -static int nfctype1_write_tag(uint32_t adapter_idx, uint32_t target_idx, +static int nfctype1_write(uint32_t adapter_idx, uint32_t target_idx, struct near_ndef_message *ndef, near_tag_io_cb cb) { @@ -558,8 +558,8 @@ out: static struct near_tag_driver type1_driver = { .type = NFC_PROTO_JEWEL, .priority = NEAR_TAG_PRIORITY_DEFAULT, - .read_tag = nfctype1_read_tag, - .add_ndef = nfctype1_write_tag, + .read = nfctype1_read, + .write = nfctype1_write, .check_presence = nfctype1_check_presence, }; diff --git a/plugins/nfctype2.c b/plugins/nfctype2.c index 068a2eb..027993d 100644 --- a/plugins/nfctype2.c +++ b/plugins/nfctype2.c @@ -39,7 +39,7 @@ #include <near/ndef.h> #include <near/tlv.h> -extern int mifare_read_tag(uint32_t adapter_idx, uint32_t target_idx, +extern int mifare_read(uint32_t adapter_idx, uint32_t target_idx, near_tag_io_cb cb, enum near_tag_sub_type tgt_subtype); #define CMD_READ 0x30 @@ -264,7 +264,7 @@ static int nfctype2_read_meta(uint32_t adapter_idx, uint32_t target_idx, meta_recv, cookie); } -static int nfctype2_read_tag(uint32_t adapter_idx, +static int nfctype2_read(uint32_t adapter_idx, uint32_t target_idx, near_tag_io_cb cb) { int err; @@ -282,7 +282,7 @@ static int nfctype2_read_tag(uint32_t adapter_idx, /* Specific Mifare read access */ case NEAR_TAG_NFC_T2_MIFARE_CLASSIC_1K: case NEAR_TAG_NFC_T2_MIFARE_CLASSIC_4K: - err= mifare_read_tag( adapter_idx, target_idx, + err= mifare_read( adapter_idx, target_idx, cb, tgt_subtype); break; @@ -389,7 +389,7 @@ out: return err; } -static int nfctype2_write_tag(uint32_t adapter_idx, uint32_t target_idx, +static int nfctype2_write(uint32_t adapter_idx, uint32_t target_idx, struct near_ndef_message *ndef, near_tag_io_cb cb) { @@ -484,8 +484,8 @@ out: static struct near_tag_driver type2_driver = { .type = NFC_PROTO_MIFARE, .priority = NEAR_TAG_PRIORITY_DEFAULT, - .read_tag = nfctype2_read_tag, - .add_ndef = nfctype2_write_tag, + .read = nfctype2_read, + .write = nfctype2_write, .check_presence = nfctype2_check_presence, }; diff --git a/plugins/nfctype3.c b/plugins/nfctype3.c index 5e42476..4ae7eab 100644 --- a/plugins/nfctype3.c +++ b/plugins/nfctype3.c @@ -390,7 +390,7 @@ out: return err; } -static int nfctype3_read_tag(uint32_t adapter_idx, +static int nfctype3_read(uint32_t adapter_idx, uint32_t target_idx, near_tag_io_cb cb) { struct type3_cmd cmd; @@ -601,7 +601,7 @@ out: return err; } -static int nfctype3_write_tag(uint32_t adapter_idx, uint32_t target_idx, +static int nfctype3_write(uint32_t adapter_idx, uint32_t target_idx, struct near_ndef_message *ndef, near_tag_io_cb cb) { @@ -686,8 +686,8 @@ out: static struct near_tag_driver type1_driver = { .type = NFC_PROTO_FELICA, .priority = NEAR_TAG_PRIORITY_DEFAULT, - .read_tag = nfctype3_read_tag, - .add_ndef = nfctype3_write_tag, + .read = nfctype3_read, + .write = nfctype3_write, .check_presence = nfctype3_check_presence, }; diff --git a/plugins/nfctype4.c b/plugins/nfctype4.c index 19c20b1..da37231 100644 --- a/plugins/nfctype4.c +++ b/plugins/nfctype4.c @@ -547,7 +547,7 @@ out_err: return t4_cookie_release(err, cookie); } -static int nfctype4_read_tag(uint32_t adapter_idx, +static int nfctype4_read(uint32_t adapter_idx, uint32_t target_idx, near_tag_io_cb cb) { struct t4_cookie *cookie; @@ -679,7 +679,7 @@ out: return err; } -static int nfctype4_write_tag(uint32_t adapter_idx, uint32_t target_idx, +static int nfctype4_write(uint32_t adapter_idx, uint32_t target_idx, struct near_ndef_message *ndef, near_tag_io_cb cb) { struct near_tag *tag; @@ -753,8 +753,8 @@ out_err: static struct near_tag_driver type4_driver = { .type = NFC_PROTO_ISO14443, .priority = NEAR_TAG_PRIORITY_DEFAULT, - .read_tag = nfctype4_read_tag, - .add_ndef = nfctype4_write_tag, + .read = nfctype4_read, + .write = nfctype4_write, .check_presence = nfctype4_check_presence, }; diff --git a/src/adapter.c b/src/adapter.c index 48ea0a8..f7f124e 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -639,7 +639,7 @@ static int publish_sp_record(DBusMessage *msg, void *data) return __push_ndef_queue(data, ndef); } -static void __add_ndef_cb(uint32_t adapter_idx, uint32_t target_idx, int status) +static void __write_cb(uint32_t adapter_idx, uint32_t target_idx, int status) { struct near_adapter *adapter; @@ -953,7 +953,7 @@ static void tag_read_cb(uint32_t adapter_idx, uint32_t target_idx, int status) g_free(ndef->data); g_free(ndef); - err = __near_tag_add_ndef(tag, ndef_with_header, __add_ndef_cb); + err = __near_tag_write(tag, ndef_with_header, __write_cb); if (err < 0) { g_free(ndef_with_header->data); g_free(ndef_with_header); @@ -117,7 +117,7 @@ struct near_tag *__near_tag_new(uint32_t adapter_idx, uint32_t target_idx, uint8_t *data, size_t data_length); void __near_tag_free(struct near_tag *tag); int __near_tag_read(struct near_tag *tag, near_tag_io_cb cb); -int __near_tag_add_ndef(struct near_tag *tag, +int __near_tag_write(struct near_tag *tag, struct near_ndef_message *ndef, near_tag_io_cb cb); int __near_tag_check_presence(struct near_tag *tag, near_tag_io_cb cb); @@ -731,7 +731,7 @@ int near_tag_driver_register(struct near_tag_driver *driver) { DBG(""); - if (driver->read_tag == NULL) + if (driver->read == NULL) return -EINVAL; driver_list = g_slist_insert_sorted(driver_list, driver, cmp_prio); @@ -758,13 +758,14 @@ int __near_tag_read(struct near_tag *tag, near_tag_io_cb cb) DBG("driver type 0x%x", driver->type); if (driver->type == tag->type) - return driver->read_tag(tag->adapter_idx, tag->target_idx, cb); + return driver->read(tag->adapter_idx, tag->target_idx, + cb); } return 0; } -int __near_tag_add_ndef(struct near_tag *tag, +int __near_tag_write(struct near_tag *tag, struct near_ndef_message *ndef, near_tag_io_cb cb) { @@ -778,7 +779,7 @@ int __near_tag_add_ndef(struct near_tag *tag, DBG("driver type 0x%x", driver->type); if (driver->type == tag->type) - return driver->add_ndef(tag->adapter_idx, tag->target_idx, + return driver->write(tag->adapter_idx, tag->target_idx, ndef, cb); } |