Represents an individual BLOCKS device.
Inherits juce::ReferenceCountedObject.
Public Member Functions | |
~Block () override | |
Destructor. More... | |
bool | operator== (const Block &other) const noexcept |
Two blocks are considered equal if they have the same UID. More... | |
bool | operator!= (const Block &other) const noexcept |
Two blocks are considered equal if they have the same UID. More... | |
virtual Type | getType () const =0 |
Returns the type of this device. More... | |
bool | isControlBlock () const |
Returns true if this a control block. More... | |
virtual juce::String | getDeviceDescription () const =0 |
Returns a human-readable description of this device type. More... | |
virtual float | getBatteryLevel () const =0 |
Returns the battery level in the range 0.0 to 1.0. More... | |
virtual bool | isBatteryCharging () const =0 |
Returns true if the battery is charging. More... | |
virtual bool | isConnected () const =0 |
Returns true if this block is connected and active. More... | |
virtual juce::Time | getConnectionTime () const =0 |
Returns the time this block object was connected to the topology. More... | |
virtual bool | isConnectedViaBluetooth () const =0 |
Returns true if this block or the master block this block is connected to, is connected via bluetooth. More... | |
virtual bool | isMasterBlock () const =0 |
Returns true if this block is directly connected to the application, as opposed to only being connected to a different block via a connection port. More... | |
virtual UID | getConnectedMasterUID () const =0 |
Returns the UID of the master block this block is connected to. More... | |
virtual int | getWidth () const =0 |
Returns the width of the device in logical device units. More... | |
virtual int | getHeight () const =0 |
Returns the height of the device in logical device units. More... | |
virtual bool | isHardwareBlock () const =0 |
Returns true if the device is a physical hardware block (i.e. More... | |
virtual float | getMillimetersPerUnit () const =0 |
Returns the length of one logical device unit as physical millimeters. More... | |
virtual BlockArea | getBlockAreaWithinLayout () const =0 |
Returns the area that this block covers within the layout of the group as a whole. More... | |
virtual int | getRotation () const =0 |
Returns the rotation of this block relative to the master block in 90 degree steps clockwise. More... | |
virtual LEDGrid * | getLEDGrid () const =0 |
If this block has a grid of LEDs, this will return an object to control it. More... | |
virtual LEDRow * | getLEDRow ()=0 |
If this block has a row of LEDs, this will return an object to control it. More... | |
virtual juce::Array< StatusLight * > | getStatusLights () const =0 |
If this block has any status LEDs, this will return an array of objects to control them. More... | |
virtual TouchSurface * | getTouchSurface () const =0 |
If this block has a pressure-sensitive surface, this will return an object to access its data. More... | |
virtual juce::Array< ControlButton * > | getButtons () const =0 |
If this block has any control buttons, this will return an array of objects to control them. More... | |
virtual bool | supportsGraphics () const =0 |
This returns true if the block supports generating graphics by drawing into a JUCE Graphics context. More... | |
virtual juce::Array< ConnectionPort > | getPorts () const =0 |
Returns a list of the connectors that this device has. More... | |
virtual juce::Result | setProgram (std::unique_ptr< Program >, ProgramPersistency persistency=ProgramPersistency::setAsTemp)=0 |
Sets the Program to run on this block. More... | |
virtual Program * | getProgram () const =0 |
Returns a pointer to the currently loaded program. More... | |
void | addProgramLoadedListener (ProgramLoadedListener *) |
Adds a new listener for program load completions. More... | |
void | removeProgramLoadedListener (ProgramLoadedListener *) |
Removes a listener for program load completions. More... | |
virtual void | sendProgramEvent (const ProgramEventMessage &)=0 |
Sends a message to the currently loaded program. More... | |
void | addProgramEventListener (ProgramEventListener *) |
Adds a new listener for custom program events from the block. More... | |
void | removeProgramEventListener (ProgramEventListener *) |
Removes a listener for custom program events from the block. More... | |
virtual juce::uint32 | getMemorySize ()=0 |
Returns the overall memory of the block. More... | |
virtual juce::uint32 | getHeapMemorySize ()=0 |
Returns the size of the data block that setDataByte and other functions can write to. More... | |
virtual void | setDataByte (size_t offset, juce::uint8 value)=0 |
Sets a single byte on the littlefoot heap. More... | |
virtual void | setDataBytes (size_t offset, const void *data, size_t num)=0 |
Sets multiple bytes on the littlefoot heap. More... | |
virtual void | setDataBits (juce::uint32 startBit, juce::uint32 numBits, juce::uint32 value)=0 |
Sets multiple bits on the littlefoot heap. More... | |
template<typename Type > | |
void | setData (juce::uint32 offset, Type value) |
Sets a single, 32 bit or less, value on the littlefoot heap. More... | |
virtual juce::uint8 | getDataByte (size_t offset)=0 |
Gets a byte from the littlefoot heap. More... | |
virtual void | saveProgramAsDefault ()=0 |
Sets the current program as the block's default state. More... | |
virtual void | resetProgramToDefault ()=0 |
Resets the loaded program to the block's default state. More... | |
void | addConfigItemListener (ConfigItemListener *) |
Adds a new listener for config item changes. More... | |
void | removeConfigItemListener (ConfigItemListener *) |
Removes a listener for config item changes. More... | |
virtual juce::uint32 | getMaxConfigIndex ()=0 |
Returns the maximum number of config items available. More... | |
virtual bool | isValidUserConfigIndex (juce::uint32 item)=0 |
Determine if this is a valid config item index. More... | |
virtual juce::int32 | getLocalConfigValue (juce::uint32 item)=0 |
Get local config item value. More... | |
virtual void | setLocalConfigValue (juce::uint32 item, juce::int32 value)=0 |
Set local config item value. More... | |
virtual void | setLocalConfigRange (juce::uint32 item, juce::int32 min, juce::int32 max)=0 |
Set local config item range. More... | |
virtual void | setLocalConfigItemActive (juce::uint32 item, bool isActive)=0 |
Set if config item is active or not. More... | |
virtual bool | isLocalConfigItemActive (juce::uint32 item)=0 |
Determine if config item is active or not. More... | |
virtual ConfigMetaData | getLocalConfigMetaData (juce::uint32 item)=0 |
Get config item metadata. More... | |
virtual void | requestFactoryConfigSync ()=0 |
Request sync of factory config with block. More... | |
virtual void | resetConfigListActiveStatus ()=0 |
Reset all items active status. More... | |
virtual void | factoryReset ()=0 |
Perform factory reset on Block. More... | |
virtual void | blockReset ()=0 |
Reset this Block. More... | |
virtual bool | setName (const juce::String &name)=0 |
Set Block name. More... | |
virtual void | setLogger (std::function< void(const Block &block, const juce::String &)> loggingCallback)=0 |
Allows the user to provide a function that will receive log messages from the block. More... | |
virtual bool | sendFirmwareUpdatePacket (const juce::uint8 *data, juce::uint8 size, std::function< void(juce::uint8, juce::uint32)> packetAckCallback)=0 |
Sends a firmware update packet to a block, and waits for a reply. More... | |
virtual void | addDataInputPortListener (DataInputPortListener *) |
Adds a new listener for the data input port. More... | |
virtual void | removeDataInputPortListener (DataInputPortListener *) |
Removes a listener for the data input port. More... | |
virtual void | sendMessage (const void *messageData, size_t messageSize)=0 |
Sends a message to the block. More... | |
Static Public Member Functions | |
static bool | isControlBlock (Block::Type) |
Returns true if Block::Type is a control block. More... | |
Public Attributes | |
const juce::String | serialNumber |
The Block's serial number. More... | |
juce::String | versionNumber |
The Block's version number. More... | |
juce::String | name |
The Block's name. More... | |
const UID | uid |
This Block's UID. More... | |
ProgramPersistency | programPersistency { ProgramPersistency::setAsTemp } |
Protected Member Functions | |
Block (const juce::String &serialNumberToUse) | |
Block (const juce::String &serial, const juce::String &version, const juce::String &name) | |
Protected Attributes | |
juce::ListenerList< ProgramLoadedListener > | programLoadedListeners |
juce::ListenerList< ProgramEventListener > | programEventListeners |
juce::ListenerList< ConfigItemListener > | configItemListeners |
juce::ListenerList< DataInputPortListener > | dataInputPortListeners |
Classes | |
struct | BlockArea |
A simple struct representing the area of a block. More... | |
struct | ConfigItemListener |
Listener interface to be informed of block config changes. More... | |
struct | ConfigMetaData |
Metadata for a given config item. More... | |
struct | ConnectionPort |
These are the edge-connectors that a device may have. More... | |
struct | DataInputPortListener |
Interface for objects listening to input data port. More... | |
struct | Program |
A program that can be loaded onto a block. More... | |
struct | ProgramEventListener |
Interface for objects listening to custom program events. More... | |
struct | ProgramEventMessage |
A message that can be sent to the currently loaded program. More... | |
struct | ProgramLoadedListener |
Listener interface to be informed of program loaded events. More... | |
Public Types | |
enum | Type { unknown = 0 , lightPadBlock , liveBlock , loopBlock , developerControlBlock , touchBlock , seaboardBlock , lumiKeysBlock } |
The different block types. More... | |
enum class | ProgramPersistency { setAsTemp , setAsDefault } |
Determines whether set program will be a temporary or default script saved to flash. More... | |
using | Ptr = juce::ReferenceCountedObjectPtr< Block > |
The Block class is reference-counted, so always use a Block::Ptr when you are keeping references to them. More... | |
using | Array = juce::ReferenceCountedArray< Block > |
The Block class is reference-counted, so Block::Array is useful when you are storing lists of them. More... | |
using | UID = juce::uint64 |
This type is used for the unique block identifier. More... | |
using | Timestamp = juce::uint32 |
This type is used for timestamping events. More... | |
|
override |
Destructor.
|
protected |
|
protected |
|
noexcept |
Two blocks are considered equal if they have the same UID.
References uid.
|
noexcept |
Two blocks are considered equal if they have the same UID.
References uid.
|
pure virtual |
Returns the type of this device.
bool Block::isControlBlock | ( | ) | const |
Returns true if this a control block.
|
static |
Returns true if Block::Type is a control block.
|
pure virtual |
Returns a human-readable description of this device type.
|
pure virtual |
Returns the battery level in the range 0.0 to 1.0.
|
pure virtual |
Returns true if the battery is charging.
|
pure virtual |
Returns true if this block is connected and active.
|
pure virtual |
Returns the time this block object was connected to the topology.
Only valid when isConnected == true.
|
pure virtual |
Returns true if this block or the master block this block is connected to, is connected via bluetooth.
Only valid when isConnected == true.
|
pure virtual |
Returns true if this block is directly connected to the application, as opposed to only being connected to a different block via a connection port.
|
pure virtual |
Returns the UID of the master block this block is connected to.
|
pure virtual |
Returns the width of the device in logical device units.
|
pure virtual |
Returns the height of the device in logical device units.
|
pure virtual |
Returns true if the device is a physical hardware block (i.e.
not a virtual block).
|
pure virtual |
Returns the length of one logical device unit as physical millimeters.
|
pure virtual |
Returns the area that this block covers within the layout of the group as a whole.
The coordinates are in logical block units, and are relative to the origin, which is the master block's top-left corner.
|
pure virtual |
Returns the rotation of this block relative to the master block in 90 degree steps clockwise.
|
pure virtual |
If this block has a grid of LEDs, this will return an object to control it.
Note that the pointer that is returned belongs to this object, and the caller must neither delete it or use it after the lifetime of this Block object has finished. If there are no LEDs, then this method will return nullptr.
|
pure virtual |
If this block has a row of LEDs, this will return an object to control it.
Note that the pointer that is returned belongs to this object, and the caller must neither delete it or use it after the lifetime of this Block object has finished. If there are no LEDs, then this method will return nullptr.
|
pure virtual |
|
pure virtual |
If this block has a pressure-sensitive surface, this will return an object to access its data.
Note that the pointer returned does is owned by this object, and the caller must neither delete it or use it after the lifetime of this Block object has finished. If the device is not touch-sensitive, then this method will return nullptr.
|
pure virtual |
|
pure virtual |
This returns true if the block supports generating graphics by drawing into a JUCE Graphics context.
This should only be true for virtual on-screen blocks; hardware blocks will instead use the LED Grid for visuals.
|
pure virtual |
Returns a list of the connectors that this device has.
|
pure virtual |
|
pure virtual |
Returns a pointer to the currently loaded program.
void Block::addProgramLoadedListener | ( | ProgramLoadedListener * | ) |
Adds a new listener for program load completions.
void Block::removeProgramLoadedListener | ( | ProgramLoadedListener * | ) |
Removes a listener for program load completions.
|
pure virtual |
Sends a message to the currently loaded program.
To receive the message the program must provide a littlefoot function called handleMessage with the following form:
void Block::addProgramEventListener | ( | ProgramEventListener * | ) |
Adds a new listener for custom program events from the block.
void Block::removeProgramEventListener | ( | ProgramEventListener * | ) |
Removes a listener for custom program events from the block.
|
pure virtual |
Returns the overall memory of the block.
|
pure virtual |
Returns the size of the data block that setDataByte and other functions can write to.
|
pure virtual |
Sets a single byte on the littlefoot heap.
Referenced by setData().
|
pure virtual |
Sets multiple bytes on the littlefoot heap.
|
pure virtual |
Sets multiple bits on the littlefoot heap.
void Block::setData | ( | juce::uint32 | offset, |
Type | value | ||
) |
Sets a single, 32 bit or less, value on the littlefoot heap.
References setDataByte().
|
pure virtual |
Gets a byte from the littlefoot heap.
|
pure virtual |
Sets the current program as the block's default state.
|
pure virtual |
Resets the loaded program to the block's default state.
void Block::addConfigItemListener | ( | ConfigItemListener * | ) |
Adds a new listener for config item changes.
void Block::removeConfigItemListener | ( | ConfigItemListener * | ) |
Removes a listener for config item changes.
|
pure virtual |
Returns the maximum number of config items available.
|
pure virtual |
Determine if this is a valid config item index.
|
pure virtual |
Get local config item value.
|
pure virtual |
Set local config item value.
|
pure virtual |
Set local config item range.
|
pure virtual |
Set if config item is active or not.
|
pure virtual |
Determine if config item is active or not.
|
pure virtual |
Get config item metadata.
|
pure virtual |
Request sync of factory config with block.
|
pure virtual |
Reset all items active status.
|
pure virtual |
Perform factory reset on Block.
|
pure virtual |
Reset this Block.
|
pure virtual |
Set Block name.
|
pure virtual |
Allows the user to provide a function that will receive log messages from the block.
|
pure virtual |
Sends a firmware update packet to a block, and waits for a reply.
Returns an error code.
|
virtual |
Adds a new listener for the data input port.
|
virtual |
Removes a listener for the data input port.
|
pure virtual |
Sends a message to the block.
using Block::Ptr = juce::ReferenceCountedObjectPtr<Block> |
The Block class is reference-counted, so always use a Block::Ptr when you are keeping references to them.
using Block::Array = juce::ReferenceCountedArray<Block> |
The Block class is reference-counted, so Block::Array is useful when you are storing lists of them.
using Block::UID = juce::uint64 |
This type is used for the unique block identifier.
using Block::Timestamp = juce::uint32 |
This type is used for timestamping events.
It represents a number of milliseconds since the block device was booted.
enum Block::Type |
The different block types.
|
strong |
const juce::String Block::serialNumber |
The Block's serial number.
juce::String Block::versionNumber |
The Block's version number.
juce::String Block::name |
The Block's name.
const UID Block::uid |
This Block's UID.
This will be globally unique, and remains constant for a particular device.
Referenced by operator!=(), and operator==().
ProgramPersistency Block::programPersistency { ProgramPersistency::setAsTemp } |
|
protected |
|
protected |
|
protected |
|
protected |