2018-11-21 01:26:11 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "hook/iobuf.h"
|
|
|
|
|
2019-10-19 19:51:10 +00:00
|
|
|
#include "iccard/felica.h"
|
|
|
|
#include "iccard/mifare.h"
|
|
|
|
|
2018-11-21 01:26:11 +00:00
|
|
|
struct sg_nfc_ops {
|
2019-10-19 19:51:10 +00:00
|
|
|
HRESULT (*poll)(void *ctx);
|
|
|
|
HRESULT (*get_aime_id)(void *ctx, uint8_t *luid, size_t nbytes);
|
|
|
|
HRESULT (*get_felica_id)(void *ctx, uint64_t *IDm);
|
|
|
|
|
|
|
|
// TODO Banapass, AmuseIC
|
2018-11-21 01:26:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct sg_nfc {
|
|
|
|
const struct sg_nfc_ops *ops;
|
|
|
|
void *ops_ctx;
|
|
|
|
uint8_t addr;
|
2023-12-03 17:45:42 +00:00
|
|
|
unsigned int gen;
|
2019-10-19 19:51:10 +00:00
|
|
|
struct felica felica;
|
|
|
|
struct mifare mifare;
|
2018-11-21 01:26:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void sg_nfc_init(
|
|
|
|
struct sg_nfc *nfc,
|
|
|
|
uint8_t addr,
|
|
|
|
const struct sg_nfc_ops *ops,
|
2023-12-03 17:45:42 +00:00
|
|
|
unsigned int gen,
|
2018-11-21 01:26:11 +00:00
|
|
|
void *ops_ctx);
|
|
|
|
|
|
|
|
void sg_nfc_transact(
|
|
|
|
struct sg_nfc *nfc,
|
2019-10-26 22:25:04 +00:00
|
|
|
struct iobuf *res_frame,
|
2018-11-21 01:26:11 +00:00
|
|
|
const void *req_bytes,
|
|
|
|
size_t req_nbytes);
|