2022-01-04 08:46:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
struct touch_config {
|
|
|
|
bool enable;
|
|
|
|
};
|
|
|
|
|
2022-01-05 07:03:55 +00:00
|
|
|
enum touch_cmd {
|
2022-01-08 07:25:42 +00:00
|
|
|
CMD_GET_SYNC_BOARD_VER = 0xa0,
|
2022-01-05 07:03:55 +00:00
|
|
|
CMD_STARTUP = 0x72,
|
2022-01-08 07:25:42 +00:00
|
|
|
CMD_GET_UNIT_BOARD_VER = 0xa8,
|
2022-01-08 02:16:33 +00:00
|
|
|
CMD_MYSTERY1 = 0xa2,
|
|
|
|
CMD_MYSTERY2 = 0x94,
|
|
|
|
CMD_START_AUTO_SCAN = 0xc9,
|
|
|
|
CMD_BEGIN_WRITE = 0x77,
|
|
|
|
CMD_NEXT_WRITE = 0x20
|
2022-01-05 07:03:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct touch_req {
|
2022-01-08 02:16:33 +00:00
|
|
|
uint8_t side; // COM3 or COM4
|
|
|
|
uint8_t cmd; // First byte is the command byte
|
|
|
|
uint8_t data[256]; // rest of the data goes here
|
|
|
|
uint8_t data_length; // Size of the data including command byte
|
2022-01-05 07:03:55 +00:00
|
|
|
};
|
|
|
|
|
2022-01-08 02:16:33 +00:00
|
|
|
// The checksum is only calculated when we're about to send it so
|
|
|
|
// it's not part of any of these structs. Just note that the last
|
|
|
|
// byte of every response is a checksum
|
2022-01-05 07:03:55 +00:00
|
|
|
struct touch_input_frame {
|
2022-01-08 02:16:33 +00:00
|
|
|
uint8_t cmd;
|
|
|
|
uint8_t data1[24];
|
|
|
|
uint8_t data2[9];
|
|
|
|
uint8_t count;
|
|
|
|
uint8_t checksum;
|
|
|
|
};
|
|
|
|
|
2022-01-08 07:25:42 +00:00
|
|
|
struct touch_resp_get_sync_board_ver {
|
2022-01-08 02:16:33 +00:00
|
|
|
uint8_t cmd;
|
2022-01-08 07:25:42 +00:00
|
|
|
char version[6];
|
2022-01-08 02:16:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct touch_resp_startup {
|
2022-01-08 07:25:42 +00:00
|
|
|
char data[80];
|
2022-01-08 02:16:33 +00:00
|
|
|
};
|
|
|
|
|
2022-01-08 07:25:42 +00:00
|
|
|
struct touch_resp_get_unit_board_ver {
|
2022-01-08 02:16:33 +00:00
|
|
|
uint8_t cmd;
|
2022-01-08 07:25:42 +00:00
|
|
|
uint8_t version[43];
|
2022-01-08 02:16:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct touch_resp_mystery1 {
|
|
|
|
uint8_t cmd;
|
|
|
|
uint8_t data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct touch_resp_mystery2 {
|
|
|
|
uint8_t cmd;
|
|
|
|
uint8_t data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct touch_resp_start_auto {
|
|
|
|
uint8_t cmd;
|
|
|
|
uint8_t data;
|
|
|
|
uint8_t checksum;
|
|
|
|
struct touch_input_frame frame;
|
2022-01-05 07:03:55 +00:00
|
|
|
};
|
|
|
|
|
2022-01-04 08:46:30 +00:00
|
|
|
HRESULT touch_hook_init(const struct touch_config *cfg);
|