The BLOCKS SDK
BlocksProtocol Namespace Reference

Namespaces

 SpecialMessageFromHost
 Messages that the host may send to a device that do not have the usual message format.
 

Classes

struct  IntegerWithBitSize
 Helper class to define an integer with a specific bit size. More...
 
struct  Packed7BitArrayBuilder
 This helper class allocates a block of 7-bit bytes and can push sequences of bits into it. More...
 
struct  Packed7BitArrayReader
 This helper class reads from a block of 7-bit bytes as sequences of bits. More...
 
struct  BlockStringData
 Structure for generic block data. More...
 
struct  BlockSerialNumber
 Structure describing a block's serial number. More...
 
struct  DeviceStatus
 Structure for the device status. More...
 
struct  DeviceConnection
 Structure for the device connection. More...
 
struct  DeviceVersion
 Structure for the device version. More...
 
struct  DeviceName
 Structure used for the device name. More...
 
struct  TouchPosition
 The coordinates of a touch. More...
 
struct  TouchVelocity
 The velocities for each dimension of a touch. More...
 
struct  HostPacketBuilder
 Helper class for constructing a packet for sending to a BLOCKS device. More...
 
struct  HostPacketDecoder
 Parses data packets from a BLOCKS device, and translates them into callbacks on a handler object. More...
 

Typedefs

using ProtocolVersion = IntegerWithBitSize< 8 >
 
using PacketTimestamp = IntegerWithBitSize< 32 >
 A timestamp for a packet, in milliseconds since device boot-up. More...
 
using PacketTimestampOffset = IntegerWithBitSize< 5 >
 This relative timestamp is for use inside a packet, and it represents a number of milliseconds that should be added to the packet's timestamp. More...
 
using MessageType = IntegerWithBitSize< 7 >
 This is the first item in a BLOCKS message, identifying the message type. More...
 
using TopologyIndex = juce::uint8
 This is a type of index identifier used to refer to a block within a group. More...
 
using DeviceCount = IntegerWithBitSize< 7 >
 
using ConnectionCount = IntegerWithBitSize< 8 >
 
using BatteryLevel = IntegerWithBitSize< 5 >
 Battery charge level. More...
 
using BatteryCharging = IntegerWithBitSize< 1 >
 Battery charger connection flag. More...
 
using ConnectorPort = IntegerWithBitSize< 5 >
 ConnectorPort is an index, starting at 0 for the leftmost port on the top edge, and going clockwise. More...
 
using VersionNumber = BlockStringData< 21 >
 
using BlockName = BlockStringData< 33 >
 
using TouchIndex = IntegerWithBitSize< 5 >
 The index of a touch, i.e. More...
 
using PacketCounter = IntegerWithBitSize< 10 >
 
using DeviceCommand = IntegerWithBitSize< 9 >
 
using ConfigCommand = IntegerWithBitSize< 4 >
 
using ConfigItemIndex = IntegerWithBitSize< 8 >
 
using ConfigItemValue = IntegerWithBitSize< 32 >
 
using ControlButtonID = IntegerWithBitSize< 12 >
 An ID for a control-block button type. More...
 
using RotaryDialIndex = IntegerWithBitSize< 7 >
 
using RotaryDialAngle = IntegerWithBitSize< 14 >
 
using RotaryDialDelta = IntegerWithBitSize< 14 >
 
using PacketIndex = IntegerWithBitSize< 16 >
 
using DataChangeCommand = IntegerWithBitSize< 3 >
 
using ByteCountFew = IntegerWithBitSize< 4 >
 
using ByteCountMany = IntegerWithBitSize< 8 >
 
using ByteValue = IntegerWithBitSize< 8 >
 
using ByteSequenceContinues = IntegerWithBitSize< 1 >
 
using FirmwareUpdateACKCode = IntegerWithBitSize< 7 >
 
using FirmwareUpdateACKDetail = IntegerWithBitSize< 32 >
 
using FirmwareUpdatePacketSize = IntegerWithBitSize< 7 >
 

Enumerations

enum class  MessageFromDevice {
  deviceTopology = 0x01 , packetACK = 0x02 , firmwareUpdateACK = 0x03 , deviceTopologyExtend = 0x04 ,
  deviceTopologyEnd = 0x05 , deviceVersion = 0x06 , deviceName = 0x07 , touchStart = 0x10 ,
  touchMove = 0x11 , touchEnd = 0x12 , touchStartWithVelocity = 0x13 , touchMoveWithVelocity = 0x14 ,
  touchEndWithVelocity = 0x15 , configMessage = 0x18 , controlButtonDown = 0x20 , controlButtonUp = 0x21 ,
  programEventMessage = 0x28 , logMessage = 0x30
}
 Messages that a device may send to the host. More...
 
enum class  MessageFromHost {
  deviceCommandMessage = 0x01 , sharedDataChange = 0x02 , programEventMessage = 0x03 , firmwareUpdatePacket = 0x04 ,
  configMessage = 0x10 , factoryReset = 0x11 , blockReset = 0x12 , setName = 0x20
}
 Messages that the host may send to a device. More...
 
enum  DeviceCommands {
  beginAPIMode = 0x00 , requestTopologyMessage = 0x01 , endAPIMode = 0x02 , ping = 0x03 ,
  debugMode = 0x04 , saveProgramAsDefault = 0x05
}
 
enum  ConfigCommands {
  setConfig = 0x00 , requestConfig = 0x01 , requestFactorySync = 0x02 , requestUserSync = 0x03 ,
  updateConfig = 0x04 , updateUserConfig = 0x05 , setConfigState = 0x06 , factorySyncEnd = 0x07 ,
  clusterConfigSync = 0x08 , factorySyncReset = 0x09
}
 
enum  DataChangeCommands {
  endOfPacket = 0 , endOfChanges = 1 , skipBytesFew = 2 , skipBytesMany = 3 ,
  setSequenceOfBytes = 4 , setFewBytesWithValue = 5 , setFewBytesWithLastValue = 6 , setManyBytesWithValue = 7
}
 
enum  BitSizes {
  topologyMessageHeader = (int) MessageType::bits + (int) ProtocolVersion::bits + (int) DeviceCount::bits + (int) ConnectionCount::bits , topologyDeviceInfo = (int) BlockSerialNumber::maxLength * 7 + (int) BatteryLevel::bits + (int) BatteryCharging::bits , topologyConnectionInfo = topologyIndexBits + (int) ConnectorPort::bits + topologyIndexBits + (int) ConnectorPort::bits , typeDeviceAndTime = (int) MessageType::bits + (int) PacketTimestampOffset::bits ,
  touchMessage = (int) typeDeviceAndTime + (int) TouchIndex::bits + (int) TouchPosition::bits , touchMessageWithVelocity = (int) touchMessage + (int) TouchVelocity::bits , programEventMessage = (int) MessageType::bits + 32 * numProgramMessageInts , programEventMessage = 0x28 ,
  programEventMessage = 0x03 , packetACK = (int) MessageType::bits + (int) PacketCounter::bits , packetACK = 0x02 , firmwareUpdateACK = (int) MessageType::bits + (int) FirmwareUpdateACKCode::bits + (int) FirmwareUpdateACKDetail::bits ,
  firmwareUpdateACK = 0x03 , controlButtonMessage = (int) typeDeviceAndTime + (int) ControlButtonID::bits , configSetMessage = (int) MessageType::bits + (int) ConfigCommand::bits + (int) ConfigItemIndex::bits + (int) ConfigItemValue::bits , configRespMessage = (int) MessageType::bits + (int) ConfigCommand::bits + (int) ConfigItemIndex::bits + ((int) ConfigItemValue::bits * 3) ,
  configSyncEndMessage = (int) MessageType::bits + (int) ConfigCommand::bits
}
 Contains the number of bits required to encode various items in the packets. More...
 

Typedef Documentation

◆ ProtocolVersion

◆ PacketTimestamp

A timestamp for a packet, in milliseconds since device boot-up.

◆ PacketTimestampOffset

This relative timestamp is for use inside a packet, and it represents a number of milliseconds that should be added to the packet's timestamp.

◆ MessageType

This is the first item in a BLOCKS message, identifying the message type.

◆ TopologyIndex

using BlocksProtocol::TopologyIndex = typedef juce::uint8

This is a type of index identifier used to refer to a block within a group.

It refers to the index of a device in the list of devices that was most recently sent via a topology change message (It's not a global UID for a block unit). NB: to send a message to all devices, pass the getDeviceIndexForBroadcast() value.

◆ DeviceCount

◆ ConnectionCount

◆ BatteryLevel

Battery charge level.

◆ BatteryCharging

Battery charger connection flag.

◆ ConnectorPort

ConnectorPort is an index, starting at 0 for the leftmost port on the top edge, and going clockwise.

◆ VersionNumber

◆ BlockName

◆ TouchIndex

The index of a touch, i.e.

finger number.

◆ PacketCounter

◆ DeviceCommand

◆ ConfigCommand

◆ ConfigItemIndex

◆ ConfigItemValue

◆ ControlButtonID

An ID for a control-block button type.

◆ RotaryDialIndex

◆ RotaryDialAngle

◆ RotaryDialDelta

◆ PacketIndex

◆ DataChangeCommand

◆ ByteCountFew

◆ ByteCountMany

◆ ByteValue

◆ ByteSequenceContinues

◆ FirmwareUpdateACKCode

◆ FirmwareUpdateACKDetail

◆ FirmwareUpdatePacketSize

Enumeration Type Documentation

◆ MessageFromDevice

Messages that a device may send to the host.

Enumerator
deviceTopology 
packetACK 
firmwareUpdateACK 
deviceTopologyExtend 
deviceTopologyEnd 
deviceVersion 
deviceName 
touchStart 
touchMove 
touchEnd 
touchStartWithVelocity 
touchMoveWithVelocity 
touchEndWithVelocity 
configMessage 
controlButtonDown 
controlButtonUp 
programEventMessage 
logMessage 

◆ MessageFromHost

Messages that the host may send to a device.

Enumerator
deviceCommandMessage 
sharedDataChange 
programEventMessage 
firmwareUpdatePacket 
configMessage 
factoryReset 
blockReset 
setName 

◆ DeviceCommands

Enumerator
beginAPIMode 
requestTopologyMessage 
endAPIMode 
ping 
debugMode 
saveProgramAsDefault 

◆ ConfigCommands

Enumerator
setConfig 
requestConfig 
requestFactorySync 
requestUserSync 
updateConfig 
updateUserConfig 
setConfigState 
factorySyncEnd 
clusterConfigSync 
factorySyncReset 

◆ DataChangeCommands

Enumerator
endOfPacket 
endOfChanges 
skipBytesFew 
skipBytesMany 
setSequenceOfBytes 
setFewBytesWithValue 
setFewBytesWithLastValue 
setManyBytesWithValue 

◆ BitSizes

Contains the number of bits required to encode various items in the packets.

Enumerator
topologyMessageHeader 
topologyDeviceInfo 
topologyConnectionInfo 
typeDeviceAndTime 
touchMessage 
touchMessageWithVelocity 
programEventMessage 
programEventMessage 
programEventMessage 
packetACK 
packetACK 
firmwareUpdateACK 
firmwareUpdateACK 
controlButtonMessage 
configSetMessage 
configRespMessage 
configSyncEndMessage