blfwk::UsbHidPacketizer Class Reference

Provides source and sink for packets that go over USB HID class. More...

`#include <UsbHidPacketizer.h>`

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

## Public Types

enum | _usbhid_contants { kReadFlushTimeoutMs = 100000, kPollAbortTimeoutMs = 0, kPollAbortTimeoutMs = 0, kPollPacketMaxRetryCnt = 50, kContinuousReadMargin = 2 }
| Constants.

## Public Member Functions

| UsbHidPacketizer (UsbHidPeripheral *peripheral, uint32_t readPacketTimeoutMs)
| Default Constructor.
virtual | ~UsbHidPacketizer ()
| Destructor.
virtual status_t | readPacket (uint8_t **packet, uint32_t *packetLength, packet_type_t packetType)
| Read a packet. More...
virtual status_t | writePacket (const uint8_t *packet, uint32_t byteCount, packet_type_t packetType)
| Write a packet. More...
virtual void | abortPacket ()
| Abort data phase.
virtual void | sync ()
| Send framing packet ack/nak.
virtual void | finalize ()
| Finalize.
virtual void | enableSimulatorPump ()
| Enable simulator command processor pump.
virtual void | pumpSimulator ()
| Pump simulator command processor.
virtual void | setAborted (bool aborted)
| Set aborted flag.
virtual uint32_t | getMaxPacketSize ()
| Returns the max packet size supported.
virtual UsbHidPeripheral * | getPeripheral ()
| Peripheral accessor.
Public Member Functions inherited from blfwk::Packetizer
| Packetizer (Peripheral *peripheral, uint32_t packetTimeoutMs)
standard_version_t | getVersion ()
| Get Framing Protocol Version.
uint16_t | getOptions ()
| Get Framing Protocol Options.
void | setAbortEnabled (bool isEnabled)
| Set abort packet check enable.
bool | isAbortEnabled ()
| Check if abort data phase is enabled.

## Protected Member Functions

virtual void | flushInput ()
| Flush input from device.
bool | pollForAbortPacket ()
| Poll overlapped read for receiver data phase abort.

## Protected Attributes

bl_hid_report_t | m_report
| Used for building and receiving the report.
bl_hid_report_t | m_abortReport
| Used for received abort report.
Protected Attributes inherited from blfwk::Packetizer
Peripheral * | m_peripheral
| Peripheral to send/receive bytes on.
standard_version_t | m_version
| Framing protocol version.
uint16_t | m_options
| Framing protocol options bitfield.
clock_t | m_startTime
| Beginning time of packet transaction.
uint32_t | m_packetTimeoutMs
bool | m_isAbortEnabled
| True if allowing abort packet. Not used by all packetizers.

## Detailed Description

Provides source and sink for packets that go over USB HID class.

## Member Function Documentation

status_t UsbHidPacketizer::readPacket | ( | uint8_t ** | packet,
|  | uint32_t * | packetLength,
|  | packet_type_t | packetType
| ) |  |

virtual

Read a packet.

Provides the address of a buffer containing the packet.

Parameters

  packet | Pointer location to write packet pointer
  packetLength | Number of bytes in returned packet

Implements blfwk::Packetizer.

status_t UsbHidPacketizer::writePacket | ( | const uint8_t * | packet,
|  | uint32_t | byteCount,
|  | packet_type_t | packetType
| ) |  |

virtual

Write a packet.

Parameters

  packet | Pointer to packet to write
  byteCount | Number of bytes in packet

Implements blfwk::Packetizer.

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

- UsbHidPacketizer.h
- UsbHidPacketizer.cpp