BlocksProtocol Namespace Reference
juce_blocks_basics » protocol

## Namespaces

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

## Classes

struct | BlockSerialNumber
| Structure describing a block's serial number. More...
struct | BlockStringData
| Structure for generic block data. More...
struct | DeviceConnection
| Structure for the device connection. More...
struct | DeviceName
| Structure used for the device name. More...
struct | DeviceStatus
| Structure for the device status. More...
struct | DeviceVersion
| Structure for the device version. 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...
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 | TouchPosition
| The coordinates of a touch. More...
struct | TouchVelocity
| The velocities for each dimension of a touch. 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 = 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

MessageFromDevice {
MessageFromDevice::deviceTopology = 0x01, packetACK = 0x02, firmwareUpdateACK = 0x03, MessageFromDevice::deviceTopologyExtend = 0x04,
MessageFromDevice::deviceTopologyEnd = 0x05, MessageFromDevice::deviceVersion = 0x06, MessageFromDevice::deviceName = 0x07, MessageFromDevice::touchStart = 0x10,
MessageFromDevice::touchMove = 0x11, MessageFromDevice::touchEnd = 0x12, MessageFromDevice::touchStartWithVelocity = 0x13, MessageFromDevice::touchMoveWithVelocity = 0x14,
MessageFromDevice::touchEndWithVelocity = 0x15, MessageFromDevice::configMessage = 0x18, MessageFromDevice::controlButtonDown = 0x20, MessageFromDevice::controlButtonUp = 0x21,
programEventMessage = 0x28, MessageFromDevice::logMessage = 0x30
}

| Messages that a device may send to the host. More...
enum | MessageFromHost { MessageFromHost::deviceCommandMessage = 0x01, MessageFromHost::sharedDataChange = 0x02, programEventMessage = 0x03, MessageFromHost::firmwareUpdatePacket = 0x04, MessageFromHost::configMessage = 0x10, MessageFromHost::factoryReset = 0x11, MessageFromHost::blockReset = 0x12, MessageFromHost::setName = 0x20 }
| Messages that the host may send to a device. More...

enum

ConfigItemId {
midiStartChannel = 0, midiEndChannel = 1, midiUseMPE = 2, pitchBendRange = 3,
octave = 4, transpose = 5, slideCC = 6, slideMode = 7,
octaveTopology = 8, midiChannelRange = 9, MPEZone = 40, velocitySensitivity = 10,
glideSensitivity = 11, slideSensitivity = 12, pressureSensitivity = 13, liftSensitivity = 14,
fixedVelocity = 15, fixedVelocityValue = 16, pianoMode = 17, glideLock = 18,
glideLockEnable = 19, mode = 20, volume = 21, scale = 22,
hideMode = 23, chord = 24, arpPattern = 25, tempo = 26,
key = 27, autoTransposeToKey = 28, xTrackingMode = 30, yTrackingMode = 31,
zTrackingMode = 32, gammaCorrection = 33, globalKeyColour = 34, rootKeyColour = 35,
brightness = 36, user0 = 64, user1 = 65, user2 = 66,
user3 = 67, user4 = 68, user5 = 69, user6 = 70,
user7 = 71, user8 = 72, user9 = 73, user10 = 74,
user11 = 75, user12 = 76, user13 = 77, user14 = 78,
user15 = 79, user16 = 80, user17 = 81, user18 = 82,
user19 = 83, user20 = 84, user21 = 85, user22 = 86,
user23 = 87, user24 = 88, user25 = 89, user26 = 90,
user27 = 91, user28 = 92, user29 = 93, user30 = 94,
user31 = 95
}

| Configuration Item Identifiers. 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

using BlocksProtocol::ProtocolVersion = typedef IntegerWithBitSize<8>

## PacketTimestamp

using BlocksProtocol::PacketTimestamp = typedef IntegerWithBitSize<32>

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

## PacketTimestampOffset

using BlocksProtocol::PacketTimestampOffset = typedef 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.

## MessageType

using BlocksProtocol::MessageType = typedef IntegerWithBitSize<7>

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

## TopologyIndex

using BlocksProtocol::TopologyIndex = typedef 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

using BlocksProtocol::DeviceCount = typedef IntegerWithBitSize<7>

## ConnectionCount

using BlocksProtocol::ConnectionCount = typedef IntegerWithBitSize<8>

## BatteryLevel

using BlocksProtocol::BatteryLevel = typedef IntegerWithBitSize<5>

Battery charge level.

## BatteryCharging

using BlocksProtocol::BatteryCharging = typedef IntegerWithBitSize<1>

Battery charger connection flag.

## ConnectorPort

using BlocksProtocol::ConnectorPort = typedef IntegerWithBitSize<5>

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

## VersionNumber

using BlocksProtocol::VersionNumber = typedef BlockStringData<21>

## BlockName

using BlocksProtocol::BlockName = typedef BlockStringData<33>

## TouchIndex

using BlocksProtocol::TouchIndex = typedef IntegerWithBitSize<5>

The index of a touch, i.e.

finger number.

## PacketCounter

using BlocksProtocol::PacketCounter = typedef IntegerWithBitSize<10>

## DeviceCommand

using BlocksProtocol::DeviceCommand = typedef IntegerWithBitSize<9>

## ConfigCommand

using BlocksProtocol::ConfigCommand = typedef IntegerWithBitSize<4>

## ConfigItemIndex

using BlocksProtocol::ConfigItemIndex = typedef IntegerWithBitSize<8>

## ConfigItemValue

using BlocksProtocol::ConfigItemValue = typedef IntegerWithBitSize<32>

## ControlButtonID

using BlocksProtocol::ControlButtonID = typedef IntegerWithBitSize<12>

An ID for a control-block button type.

## RotaryDialIndex

using BlocksProtocol::RotaryDialIndex = typedef IntegerWithBitSize<7>

## RotaryDialAngle

using BlocksProtocol::RotaryDialAngle = typedef IntegerWithBitSize<14>

## RotaryDialDelta

using BlocksProtocol::RotaryDialDelta = typedef IntegerWithBitSize<14>

## PacketIndex

using BlocksProtocol::PacketIndex = typedef IntegerWithBitSize<16>

## DataChangeCommand

using BlocksProtocol::DataChangeCommand = typedef IntegerWithBitSize<3>

## ByteCountFew

using BlocksProtocol::ByteCountFew = typedef IntegerWithBitSize<4>

## ByteCountMany

using BlocksProtocol::ByteCountMany = typedef IntegerWithBitSize<8>

## ByteValue

using BlocksProtocol::ByteValue = typedef IntegerWithBitSize<8>

## ByteSequenceContinues

using BlocksProtocol::ByteSequenceContinues = typedef IntegerWithBitSize<1>

## FirmwareUpdateACKCode

using BlocksProtocol::FirmwareUpdateACKCode = typedef IntegerWithBitSize<7>

## FirmwareUpdateACKDetail

using BlocksProtocol::FirmwareUpdateACKDetail = typedef IntegerWithBitSize<32>

## FirmwareUpdatePacketSize

using BlocksProtocol::FirmwareUpdatePacketSize = typedef IntegerWithBitSize<7>

## Enumeration Type Documentation

## MessageFromDevice

enum BlocksProtocol::MessageFromDevice

strong

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

enum BlocksProtocol::MessageFromHost

strong

Messages that the host may send to a device.

Enumerator
deviceCommandMessage |
sharedDataChange |
programEventMessage |
firmwareUpdatePacket |
configMessage |
factoryReset |
blockReset |
setName |

## ConfigItemId

enum BlocksProtocol::ConfigItemId

Configuration Item Identifiers.

Enumerator
midiStartChannel |
midiEndChannel |
midiUseMPE |
pitchBendRange |
octave |
transpose |
slideCC |
slideMode |
octaveTopology |
midiChannelRange |
MPEZone |
velocitySensitivity |
glideSensitivity |
slideSensitivity |
pressureSensitivity |
liftSensitivity |
fixedVelocity |
fixedVelocityValue |
pianoMode |
glideLock |
glideLockEnable |
mode |
volume |
scale |
hideMode |
chord |
arpPattern |
tempo |
key |
autoTransposeToKey |
xTrackingMode |
yTrackingMode |
zTrackingMode |
gammaCorrection |
globalKeyColour |
rootKeyColour |
brightness |
user0 |
user1 |
user2 |
user3 |
user4 |
user5 |
user6 |
user7 |
user8 |
user9 |
user10 |
user11 |
user12 |
user13 |
user14 |
user15 |
user16 |
user17 |
user18 |
user19 |
user20 |
user21 |
user22 |
user23 |
user24 |
user25 |
user26 |
user27 |
user28 |
user29 |
user30 |
user31 |

## DeviceCommands

enum BlocksProtocol::DeviceCommands

Enumerator
beginAPIMode |
requestTopologyMessage |
endAPIMode |
ping |
debugMode |
saveProgramAsDefault |

## ConfigCommands

enum BlocksProtocol::ConfigCommands

Enumerator
setConfig |
requestConfig |
requestFactorySync |
requestUserSync |
updateConfig |
updateUserConfig |
setConfigState |
factorySyncEnd |
clusterConfigSync |
factorySyncReset |

## DataChangeCommands

enum BlocksProtocol::DataChangeCommands

Enumerator
endOfPacket |
endOfChanges |
skipBytesFew |
skipBytesMany |
setSequenceOfBytes |
setFewBytesWithValue |
setFewBytesWithLastValue |
setManyBytesWithValue |

## BitSizes

enum BlocksProtocol::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 |