#include #include #include #include #include #include "board/config.h" #include "board/bpreader.h" #include "util/dprintf.h" #include "util/hexstr.h" void bpreader_config_load(struct bpreader_config *cfg, const wchar_t *filename) { assert(cfg != NULL); assert(filename != NULL); cfg->enable = GetPrivateProfileIntW(L"reader", L"enable", 1, filename); cfg->port = GetPrivateProfileIntW(L"reader", L"port", 0, filename); GetPrivateProfileStringW( L"reader", L"access_code", L"00000000000000000000", cfg->access_code, _countof(cfg->access_code), filename); GetPrivateProfileStringW( L"reader", L"chip_id", L"00000000000000000000000000000000", cfg->chip_id, _countof(cfg->chip_id), filename); HRESULT hr = wstr_to_bytes(cfg->access_code, 20, cfg->access_code_bytes, sizeof(cfg->access_code_bytes)); if (FAILED(hr)) { dprintf("Reader: wstr_to_bytes 1 failed! 0x%lX", hr); } hr = wstr_to_bytes(cfg->chip_id, 32, cfg->chip_id_bytes, sizeof(cfg->chip_id_bytes)); if (FAILED(hr)) { dprintf("Reader: wstr_to_bytes 2 failed! 0x%lX", hr); } } void usio_config_load(struct usio_config *cfg, const wchar_t *filename) { assert(cfg != NULL); assert(filename != NULL); cfg->enable = GetPrivateProfileIntW(L"usio", L"enable", 1, filename); } void qr_config_load(struct qr_config *cfg, const wchar_t *filename) { assert(cfg != NULL); assert(filename != NULL); cfg->enable = GetPrivateProfileIntW(L"qr", L"enable", 1, filename); cfg->port = GetPrivateProfileIntW(L"qr", L"port", 0, filename); }