|
|
|
|
|
|
|
|
#define println USBHost::println_ |
|
|
#define println USBHost::println_ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t KeyboardController::idVendor() |
|
|
|
|
|
{ |
|
|
|
|
|
if (device != nullptr) return device->idVendor; |
|
|
|
|
|
if (btdevice != nullptr) return btdevice->idVendor; |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
uint16_t KeyboardController::idProduct() |
|
|
|
|
|
{ |
|
|
|
|
|
if (device != nullptr) return device->idProduct; |
|
|
|
|
|
if (btdevice != nullptr) return btdevice->idProduct; |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const uint8_t *KeyboardController::manufacturer() |
|
|
|
|
|
{ |
|
|
|
|
|
if ((device != nullptr) && (device->strbuf != nullptr)) return &device->strbuf->buffer[device->strbuf->iStrings[strbuf_t::STR_ID_MAN]]; |
|
|
|
|
|
if ((btdevice != nullptr) && (btdevice->strbuf != nullptr)) return &btdevice->strbuf->buffer[btdevice->strbuf->iStrings[strbuf_t::STR_ID_MAN]]; |
|
|
|
|
|
return nullptr; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const uint8_t *KeyboardController::product() |
|
|
|
|
|
{ |
|
|
|
|
|
if ((device != nullptr) && (device->strbuf != nullptr)) return &device->strbuf->buffer[device->strbuf->iStrings[strbuf_t::STR_ID_PROD]]; |
|
|
|
|
|
if ((btdevice != nullptr) && (btdevice->strbuf != nullptr)) return &btdevice->strbuf->buffer[btdevice->strbuf->iStrings[strbuf_t::STR_ID_PROD]]; |
|
|
|
|
|
return nullptr; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const uint8_t *KeyboardController::serialNumber() |
|
|
|
|
|
{ |
|
|
|
|
|
if ((device != nullptr) && (device->strbuf != nullptr)) return &device->strbuf->buffer[device->strbuf->iStrings[strbuf_t::STR_ID_SERIAL]]; |
|
|
|
|
|
if ((btdevice != nullptr) && (btdevice->strbuf != nullptr)) return &btdevice->strbuf->buffer[btdevice->strbuf->iStrings[strbuf_t::STR_ID_SERIAL]]; |
|
|
|
|
|
return nullptr; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KeyboardController::init() |
|
|
void KeyboardController::init() |
|
|
|
|
|
|
|
|
void KeyboardController::release_bluetooth() |
|
|
void KeyboardController::release_bluetooth() |
|
|
{ |
|
|
{ |
|
|
//btdevice = nullptr; |
|
|
//btdevice = nullptr; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//***************************************************************************** |
|
|
//***************************************************************************** |
|
|
// Some simple query functions depend on which interface we are using... |
|
|
// Some simple query functions depend on which interface we are using... |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
if (device != nullptr) return device->idVendor; |
|
|
if (device != nullptr) return device->idVendor; |
|
|
if (mydevice != nullptr) return mydevice->idVendor; |
|
|
if (mydevice != nullptr) return mydevice->idVendor; |
|
|
|
|
|
if (btdevice != nullptr) return btdevice->idVendor; |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
if (device != nullptr) return device->idProduct; |
|
|
if (device != nullptr) return device->idProduct; |
|
|
if (mydevice != nullptr) return mydevice->idProduct; |
|
|
if (mydevice != nullptr) return mydevice->idProduct; |
|
|
|
|
|
if (btdevice != nullptr) return btdevice->idProduct; |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const uint8_t *KeyboardController::manufacturer() |
|
|
const uint8_t *KeyboardController::manufacturer() |
|
|
{ |
|
|
{ |
|
|
if ((device != nullptr) && (device->strbuf != nullptr)) return &device->strbuf->buffer[device->strbuf->iStrings[strbuf_t::STR_ID_MAN]]; |
|
|
if ((device != nullptr) && (device->strbuf != nullptr)) return &device->strbuf->buffer[device->strbuf->iStrings[strbuf_t::STR_ID_MAN]]; |
|
|
|
|
|
if ((btdevice != nullptr) && (btdevice->strbuf != nullptr)) return &btdevice->strbuf->buffer[btdevice->strbuf->iStrings[strbuf_t::STR_ID_MAN]]; |
|
|
if ((mydevice != nullptr) && (mydevice->strbuf != nullptr)) return &mydevice->strbuf->buffer[mydevice->strbuf->iStrings[strbuf_t::STR_ID_MAN]]; |
|
|
if ((mydevice != nullptr) && (mydevice->strbuf != nullptr)) return &mydevice->strbuf->buffer[mydevice->strbuf->iStrings[strbuf_t::STR_ID_MAN]]; |
|
|
return nullptr; |
|
|
return nullptr; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
if ((device != nullptr) && (device->strbuf != nullptr)) return &device->strbuf->buffer[device->strbuf->iStrings[strbuf_t::STR_ID_PROD]]; |
|
|
if ((device != nullptr) && (device->strbuf != nullptr)) return &device->strbuf->buffer[device->strbuf->iStrings[strbuf_t::STR_ID_PROD]]; |
|
|
if ((mydevice != nullptr) && (mydevice->strbuf != nullptr)) return &mydevice->strbuf->buffer[mydevice->strbuf->iStrings[strbuf_t::STR_ID_PROD]]; |
|
|
if ((mydevice != nullptr) && (mydevice->strbuf != nullptr)) return &mydevice->strbuf->buffer[mydevice->strbuf->iStrings[strbuf_t::STR_ID_PROD]]; |
|
|
|
|
|
if ((btdevice != nullptr) && (btdevice->strbuf != nullptr)) return &btdevice->strbuf->buffer[btdevice->strbuf->iStrings[strbuf_t::STR_ID_PROD]]; |
|
|
return nullptr; |
|
|
return nullptr; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
if ((device != nullptr) && (device->strbuf != nullptr)) return &device->strbuf->buffer[device->strbuf->iStrings[strbuf_t::STR_ID_SERIAL]]; |
|
|
if ((device != nullptr) && (device->strbuf != nullptr)) return &device->strbuf->buffer[device->strbuf->iStrings[strbuf_t::STR_ID_SERIAL]]; |
|
|
if ((mydevice != nullptr) && (mydevice->strbuf != nullptr)) return &mydevice->strbuf->buffer[mydevice->strbuf->iStrings[strbuf_t::STR_ID_SERIAL]]; |
|
|
if ((mydevice != nullptr) && (mydevice->strbuf != nullptr)) return &mydevice->strbuf->buffer[mydevice->strbuf->iStrings[strbuf_t::STR_ID_SERIAL]]; |
|
|
|
|
|
if ((btdevice != nullptr) && (btdevice->strbuf != nullptr)) return &btdevice->strbuf->buffer[btdevice->strbuf->iStrings[strbuf_t::STR_ID_SERIAL]]; |
|
|
return nullptr; |
|
|
return nullptr; |
|
|
} |
|
|
} |
|
|
|
|
|
|