feat: add FFI layer, protocol tests, mock transport, README
- FFI: eskin_open/close/read_register/write_register for C/C++/Python - Protocol: encode/decode tests with golden bytes verification - Stream: implement PollingSampleCollector producing FingerSample - Register: add parse_combined_forces/parse_module_errors - Transport: add MockSerialTransport for testing - Include: add C header file eskin_ffi.h - Examples: C++ and Python usage examples - README: full usage guide for Rust/C++/Python - Exclude docs/ from repo (internal only)
This commit is contained in:
67
include/eskin_ffi.h
Normal file
67
include/eskin_ffi.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#ifndef ESkin_FFI_H
|
||||
#define ESkin_FFI_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void* EskinDeviceHandle;
|
||||
|
||||
typedef struct {
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
uint16_t patch;
|
||||
} EskinSdkVersion;
|
||||
|
||||
typedef enum {
|
||||
ESkinSuccess = 0,
|
||||
ESkinInvalidPointer = 1,
|
||||
ESkinDeviceNotFound = 2,
|
||||
ESkinDeviceAlreadyOpen = 3,
|
||||
ESkinNotInitialized = 4,
|
||||
ESkinAlreadyStreaming = 5,
|
||||
ESkinNotStreaming = 6,
|
||||
ESkinConfigError = 7,
|
||||
ESkinIoError = 8,
|
||||
ESkinTimeout = 9,
|
||||
ESkinChannelClosed = 10,
|
||||
ESkinInternalError = 11,
|
||||
ESkinBufferOverflow = 12,
|
||||
ESkinInvalidParameter = 13,
|
||||
ESkinCrcError = 14,
|
||||
ESkinFrameError = 15,
|
||||
ESkinProtocolError = 16,
|
||||
ESkinDeviceError = 17,
|
||||
} EskinSdkErrorCode;
|
||||
|
||||
EskinSdkVersion eskin_version(void);
|
||||
|
||||
EskinDeviceHandle eskin_open(const char* path, const void* config);
|
||||
EskinSdkErrorCode eskin_close(EskinDeviceHandle handle);
|
||||
|
||||
EskinSdkErrorCode eskin_read_register(
|
||||
EskinDeviceHandle handle,
|
||||
uint32_t addr,
|
||||
uint16_t length,
|
||||
uint8_t* buf,
|
||||
uint32_t buf_len,
|
||||
uint32_t* actual_len
|
||||
);
|
||||
|
||||
EskinSdkErrorCode eskin_write_register(
|
||||
EskinDeviceHandle handle,
|
||||
uint32_t addr,
|
||||
const uint8_t* data,
|
||||
uint16_t data_len,
|
||||
uint16_t* return_count
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user