blfwk::UsbHidPeripheral Class Reference

Represents a USB HID peripheral. More...

`#include <UsbHidPeripheral.h>`

Inheritance diagram for blfwk::UsbHidPeripheral:
[legend]
Collaboration diagram for blfwk::UsbHidPeripheral:
[legend]

## Public Types

enum | _usbhid_contants { kDefault_Vid = 0x15a2, kDefault_Pid = 0x0073 }
| Constants. More...
Public Types inherited from blfwk::Peripheral
enum | _host_peripheral_types { kHostPeripheralType_None, kHostPeripheralType_UART, kHostPeripheralType_BUSPAL_UART, kHostPeripheralType_USB_HID, kHostPeripheralType_SIM }

## Public Member Functions

| UsbHidPeripheral ()
| Default constructor. More...
| UsbHidPeripheral (unsigned short vendor_id, unsigned short product_id, const char *serial_number)
| Parameterized constructor. More...
virtual | ~UsbHidPeripheral ()
| Destructor.
virtual status_t | read (uint8_t *buffer, uint32_t requestedBytes, uint32_t *actualBytes, uint32_t timeoutMS)
| Read bytes. More...
virtual status_t | write (const uint8_t *buffer, uint32_t byteCount)
| Write bytes. This is a do nothing function implemented here to satisfy abstract base class requirements. This function is not used. The write(buffer, count, timeout) function is used in this child class instead of the write(buffer, cout) function declared in the base class.
status_t | write (const uint8_t *buffer, uint32_t byteCount, uint32_t timeoutMS)
| Write bytes. More...
unsigned short | getVendorId ()
| Return USB Vendor ID.
unsigned short | getProductId ()
| Return USB Product ID.
const wchar_t * | getSerialNumber ()
| Return USB Serial Number.

## Detailed Description

Represents a USB HID peripheral.

Interface class for objects that provide the source for commands or sink for responses.

## Member Enumeration Documentation

enum blfwk::UsbHidPeripheral::_usbhid_contants

Constants.

Enumerator
kDefault_Vid | Freescale VID.
kDefault_Pid | PID for KL25Z48M.

## Constructor & Destructor Documentation

UsbHidPeripheral::UsbHidPeripheral | ( |  | ) |

Default constructor.

Uses vendor_id = kDefault_Vid and product_id = kDefault_Pid.

UsbHidPeripheral::UsbHidPeripheral | ( | unsigned short | vendor_id,
|  | unsigned short | product_id,
|  | const char * | serial_number
| ) |  |

Parameterized constructor.

Parameters

  vendor_id | The Vendor ID of the USB HID device.
  product_id | The Product ID of the USB HID device.
  serial_number | The Serial Number of the USB HID device.

## Member Function Documentation

status_t UsbHidPeripheral::read | ( | uint8_t * | buffer,
|  | uint32_t | requestedBytes,
|  | uint32_t * | actualBytes,
|  | uint32_t | timeoutMS
| ) |  |

virtual

Read bytes.

Parameters

  buffer | Pointer to buffer
  requestedBytes | Number of bytes to read
  timeoutMs | Time in milliseconds to wait for read to complete.
  actualBytes | Number of bytes actually read.

Implements blfwk::Peripheral.

status_t UsbHidPeripheral::write | ( | const uint8_t * | buffer,
|  | uint32_t | byteCount,
|  | uint32_t | timeoutMS
| ) |  |

Write bytes.

Parameters

  buffer | Pointer to buffer to write
  byteCount | Number of bytes to write
  timeoutMs | Time in milliseconds to wait for write to complete.

The documentation for this class was generated from the following files:

- UsbHidPeripheral.h
- UsbHidPeripheral.cpp