BlocksProtocol::HostPacketDecoder< Handler > Struct Template Reference
juce_blocks_basics » protocol

Parses data packets from a BLOCKS device, and translates them into callbacks on a handler object. More...

## Static Public Member Functions

static void | processNextPacket (Handler &handler, TopologyIndex deviceIndex, const void *data, int size)
static uint32 | getMessageType (Packed7BitArrayReader &reader)
static bool | processNextMessage (Handler &handler, Packed7BitArrayReader &reader, MessageFromDevice messageType, TopologyIndex deviceIndex, PacketTimestamp packetTimestamp)
static bool | handleTopology (Handler &handler, Packed7BitArrayReader &reader, bool newTopology)
static bool | handleTopologyEnd (Handler &handler, Packed7BitArrayReader &reader)
static void | handleTopologyDevice (Handler &handler, Packed7BitArrayReader &reader)
static void | handleTopologyConnection (Handler &handler, Packed7BitArrayReader &reader)
static bool | handleVersion (Handler &handler, Packed7BitArrayReader &reader)
static bool | handleName (Handler &handler, Packed7BitArrayReader &reader)
static bool | handleTouch (Handler &handler, Packed7BitArrayReader &reader, TopologyIndex deviceIndex, PacketTimestamp packetTimestamp, bool isStart, bool isEnd)
static bool | handleTouchWithVelocity (Handler &handler, Packed7BitArrayReader &reader, TopologyIndex deviceIndex, PacketTimestamp packetTimestamp, bool isStart, bool isEnd)
static void | handleTouch (Handler &handler, TopologyIndex deviceIndex, uint32 timestamp, TouchIndex touchIndex, TouchPosition position, TouchVelocity velocity, bool isStart, bool isEnd)
static bool | handleButtonDownOrUp (Handler &handler, Packed7BitArrayReader &reader, TopologyIndex deviceIndex, PacketTimestamp packetTimestamp, bool isDown)
static bool | handleCustomMessage (Handler &handler, Packed7BitArrayReader &reader, TopologyIndex deviceIndex, PacketTimestamp packetTimestamp)
static bool | handlePacketACK (Handler &handler, Packed7BitArrayReader &reader, TopologyIndex deviceIndex)
static bool | handleFirmwareUpdateACK (Handler &handler, Packed7BitArrayReader &reader, TopologyIndex deviceIndex)
static bool | handleConfigMessage (Handler &handler, Packed7BitArrayReader &reader, TopologyIndex deviceIndex)
static bool | handleLogMessage (Handler &handler, Packed7BitArrayReader &reader, TopologyIndex deviceIndex)

## Detailed Description

### template<typename Handler>
struct BlocksProtocol::HostPacketDecoder< Handler >

Parses data packets from a BLOCKS device, and translates them into callbacks on a handler object.

## Member Function Documentation

## processNextPacket()

template<typename Handler >

static void BlocksProtocol::HostPacketDecoder< Handler >::processNextPacket | ( | Handler & | handler,
|  | TopologyIndex | deviceIndex,
|  | const void * | data,
|  | int | size
| ) |  |

static

References BlocksProtocol::IntegerWithBitSize< numBits >::bits, BlocksProtocol::Packed7BitArrayReader::checksumIsOK(), BlocksProtocol::HostPacketDecoder< Handler >::getMessageType(), BlocksProtocol::Packed7BitArrayReader::getRemainingBits(), int(), jassertfalse, BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage(), and BlocksProtocol::Packed7BitArrayReader::read().

## getMessageType()

template<typename Handler >

static uint32 BlocksProtocol::HostPacketDecoder< Handler >::getMessageType | ( | Packed7BitArrayReader & | reader | ) |

static

References BlocksProtocol::IntegerWithBitSize< numBits >::bits, BlocksProtocol::Packed7BitArrayReader::getRemainingBits(), and BlocksProtocol::Packed7BitArrayReader::read().

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextPacket().

## processNextMessage()

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader,
|  | MessageFromDevice | messageType,
|  | TopologyIndex | deviceIndex,
|  | PacketTimestamp | packetTimestamp
| ) |  |

static

References BlocksProtocol::configMessage, BlocksProtocol::controlButtonDown, BlocksProtocol::controlButtonUp, BlocksProtocol::deviceName, BlocksProtocol::deviceTopology, BlocksProtocol::deviceTopologyEnd, BlocksProtocol::deviceTopologyExtend, BlocksProtocol::deviceVersion, BlocksProtocol::firmwareUpdateACK, BlocksProtocol::HostPacketDecoder< Handler >::handleButtonDownOrUp(), BlocksProtocol::HostPacketDecoder< Handler >::handleConfigMessage(), BlocksProtocol::HostPacketDecoder< Handler >::handleCustomMessage(), BlocksProtocol::HostPacketDecoder< Handler >::handleFirmwareUpdateACK(), BlocksProtocol::HostPacketDecoder< Handler >::handleLogMessage(), BlocksProtocol::HostPacketDecoder< Handler >::handleName(), BlocksProtocol::HostPacketDecoder< Handler >::handlePacketACK(), BlocksProtocol::HostPacketDecoder< Handler >::handleTopology(), BlocksProtocol::HostPacketDecoder< Handler >::handleTopologyEnd(), BlocksProtocol::HostPacketDecoder< Handler >::handleTouch(), BlocksProtocol::HostPacketDecoder< Handler >::handleTouchWithVelocity(), BlocksProtocol::HostPacketDecoder< Handler >::handleVersion(), jassertfalse, BlocksProtocol::logMessage, BlocksProtocol::packetACK, BlocksProtocol::programEventMessage, BlocksProtocol::touchEnd, BlocksProtocol::touchEndWithVelocity, BlocksProtocol::touchMove, BlocksProtocol::touchMoveWithVelocity, BlocksProtocol::touchStart, and BlocksProtocol::touchStartWithVelocity.

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextPacket().

## handleTopology()

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::handleTopology | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader,
|  | bool | newTopology
| ) |  |

static

References BlocksProtocol::IntegerWithBitSize< numBits >::bits, BlocksProtocol::IntegerWithBitSize< 8 >::bits, BlocksProtocol::Packed7BitArrayReader::getRemainingBits(), BlocksProtocol::HostPacketDecoder< Handler >::handleTopologyConnection(), BlocksProtocol::HostPacketDecoder< Handler >::handleTopologyDevice(), int(), jassertfalse, BlocksProtocol::Packed7BitArrayReader::read(), BlocksProtocol::topologyConnectionInfo, and BlocksProtocol::topologyDeviceInfo.

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage().

## handleTopologyEnd()

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::handleTopologyEnd | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader
| ) |  |

static

References jassertfalse, and BlocksProtocol::Packed7BitArrayReader::read().

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage().

## handleTopologyDevice()

template<typename Handler >

static void BlocksProtocol::HostPacketDecoder< Handler >::handleTopologyDevice | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader
| ) |  |

static

References BlocksProtocol::DeviceStatus::batteryCharging, BlocksProtocol::DeviceStatus::batteryLevel, BlocksProtocol::BlockStringData< MaxSize >::data, BlocksProtocol::DeviceStatus::index, BlocksProtocol::BlockStringData< MaxSize >::length, BlocksProtocol::BlockStringData< 16 >::maxLength, BlocksProtocol::Packed7BitArrayReader::read(), BlocksProtocol::Packed7BitArrayReader::readBits(), and BlocksProtocol::DeviceStatus::serialNumber.

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::handleTopology().

## handleTopologyConnection()

template<typename Handler >

static void BlocksProtocol::HostPacketDecoder< Handler >::handleTopologyConnection | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader
| ) |  |

static

References BlocksProtocol::DeviceConnection::device1, BlocksProtocol::DeviceConnection::device2, BlocksProtocol::DeviceConnection::port1, BlocksProtocol::DeviceConnection::port2, BlocksProtocol::Packed7BitArrayReader::read(), and BlocksProtocol::Packed7BitArrayReader::readBits().

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::handleTopology().

## handleVersion()

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::handleVersion | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader
| ) |  |

static

References BlocksProtocol::BlockStringData< MaxSize >::data, BlocksProtocol::DeviceVersion::index, BlocksProtocol::BlockStringData< MaxSize >::length, BlocksProtocol::Packed7BitArrayReader::readBits(), and BlocksProtocol::DeviceVersion::version.

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage().

## handleName()

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::handleName | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader
| ) |  |

static

References BlocksProtocol::BlockStringData< MaxSize >::data, BlocksProtocol::DeviceName::index, BlocksProtocol::BlockStringData< MaxSize >::length, BlocksProtocol::DeviceName::name, and BlocksProtocol::Packed7BitArrayReader::readBits().

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage().

## handleTouch() [1/2]

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::handleTouch | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader,
|  | TopologyIndex | deviceIndex,
|  | PacketTimestamp | packetTimestamp,
|  | bool | isStart,
|  | bool | isEnd
| ) |  |

static

References BlocksProtocol::IntegerWithBitSize< numBits >::bits, BlocksProtocol::IntegerWithBitSize< numBits >::get(), BlocksProtocol::Packed7BitArrayReader::getRemainingBits(), int(), jassertfalse, BlocksProtocol::Packed7BitArrayReader::read(), and BlocksProtocol::touchMessage.

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::handleTouchWithVelocity(), and BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage().

## handleTouchWithVelocity()

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::handleTouchWithVelocity | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader,
|  | TopologyIndex | deviceIndex,
|  | PacketTimestamp | packetTimestamp,
|  | bool | isStart,
|  | bool | isEnd
| ) |  |

static

References BlocksProtocol::IntegerWithBitSize< numBits >::bits, BlocksProtocol::IntegerWithBitSize< numBits >::get(), BlocksProtocol::Packed7BitArrayReader::getRemainingBits(), BlocksProtocol::HostPacketDecoder< Handler >::handleTouch(), int(), jassertfalse, BlocksProtocol::Packed7BitArrayReader::read(), and BlocksProtocol::touchMessageWithVelocity.

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage().

## handleTouch() [2/2]

template<typename Handler >

static void BlocksProtocol::HostPacketDecoder< Handler >::handleTouch | ( | Handler & | handler,
|  | TopologyIndex | deviceIndex,
|  | uint32 | timestamp,
|  | TouchIndex | touchIndex,
|  | TouchPosition | position,
|  | TouchVelocity | velocity,
|  | bool | isStart,
|  | bool | isEnd
| ) |  |

static

## handleButtonDownOrUp()

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::handleButtonDownOrUp | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader,
|  | TopologyIndex | deviceIndex,
|  | PacketTimestamp | packetTimestamp,
|  | bool | isDown
| ) |  |

static

References BlocksProtocol::IntegerWithBitSize< numBits >::bits, BlocksProtocol::controlButtonMessage, BlocksProtocol::IntegerWithBitSize< numBits >::get(), BlocksProtocol::Packed7BitArrayReader::getRemainingBits(), int(), jassertfalse, and BlocksProtocol::Packed7BitArrayReader::read().

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage().

## handleCustomMessage()

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::handleCustomMessage | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader,
|  | TopologyIndex | deviceIndex,
|  | PacketTimestamp | packetTimestamp
| ) |  |

static

References BlocksProtocol::IntegerWithBitSize< numBits >::bits, BlocksProtocol::IntegerWithBitSize< numBits >::get(), BlocksProtocol::Packed7BitArrayReader::getRemainingBits(), int(), jassertfalse, BlocksProtocol::programEventMessage, and BlocksProtocol::Packed7BitArrayReader::read().

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage().

## handlePacketACK()

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::handlePacketACK | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader,
|  | TopologyIndex | deviceIndex
| ) |  |

static

References BlocksProtocol::IntegerWithBitSize< numBits >::bits, BlocksProtocol::Packed7BitArrayReader::getRemainingBits(), int(), jassertfalse, BlocksProtocol::packetACK, and BlocksProtocol::Packed7BitArrayReader::read().

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage().

## handleFirmwareUpdateACK()

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::handleFirmwareUpdateACK | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader,
|  | TopologyIndex | deviceIndex
| ) |  |

static

References BlocksProtocol::IntegerWithBitSize< numBits >::bits, BlocksProtocol::Packed7BitArrayReader::getRemainingBits(), jassertfalse, and BlocksProtocol::Packed7BitArrayReader::read().

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage().

## handleConfigMessage()

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::handleConfigMessage | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader,
|  | TopologyIndex | deviceIndex
| ) |  |

static

References BlocksProtocol::factorySyncEnd, BlocksProtocol::factorySyncReset, BlocksProtocol::IntegerWithBitSize< numBits >::get(), max(), min(), BlocksProtocol::Packed7BitArrayReader::read(), BlocksProtocol::setConfig, and BlocksProtocol::updateConfig.

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage().

## handleLogMessage()

template<typename Handler >

static bool BlocksProtocol::HostPacketDecoder< Handler >::handleLogMessage | ( | Handler & | handler,
|  | Packed7BitArrayReader & | reader,
|  | TopologyIndex | deviceIndex
| ) |  |

static

References BlocksProtocol::Packed7BitArrayReader::getRemainingBits(), and BlocksProtocol::Packed7BitArrayReader::read().

Referenced by BlocksProtocol::HostPacketDecoder< Handler >::processNextMessage().

The documentation for this struct was generated from the following file:

- juce_HostPacketDecoder.h