21 void *
bt_open(
const char *device ,
const char* unused)
24 HANDLE
handle = CreateFileA(device ?:
BT, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
25 return handle != INVALID_HANDLE_VALUE ? handle : NULL;
41 if (!WriteFile(handle, buf, count, &dwBytesWritten, NULL))
44 return dwBytesWritten;
60 if (!ReadFile(handle, buf, count, &dwBytesRead, NULL))
82 FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
83 NULL, GetLastError(), 0, (
wchar_t*)&buf, 0, NULL);
85 return buf ? *buf : L
"Error in printing error";
int bt_write(void *handle, const u8 *buf, size_t count)
writes buf[1] till buf[count - 2] to device
void bt_close(void *handle)
calls CloseHandle on argument
const wchar_t * bt_error(void *fd_)
Returns an error string describing the last error occured.
int bt_read(void *handle, u8 *buf, size_t count, int milliseconds)
writes buf[1] till buf[count - 2] to device
void * bt_open(const char *device, const char *unused)
opens COM Porte described by device. NULL leads to default action