C++ Pixels Library For Windows
Enable communications with Pixels dice using Bluetooth Low Energy.
Loading...
Searching...
No Matches
MessageSerialization.h File Reference

Pixel messages serialization functions. More...

#include <memory>
#include <vector>
#include <type_traits>
#include "Messages.h"
Include dependency graph for MessageSerialization.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Systemic::Pixels
 A collection of C++ classes and types to scan for and connect to Pixels dice.
 

Functions

template<typename T , std::enable_if_t< std::is_base_of_v< Systemic::Pixels::Messages::PixelMessage, T >, int > = 0>
void Systemic::Pixels::Messages::Serialization::serializeMessage (const T &message, std::vector< uint8_t > &outData)
 Serialize a PixelMessage instance to binary data so it can be send to a Pixels die. More...
 
template<typename T , std::enable_if_t< std::is_base_of_v< Systemic::Pixels::Messages::PixelMessage, T >, int > = 0>
std::shared_ptr< const T > Systemic::Pixels::Messages::Serialization::deserializeMessage (const std::vector< uint8_t > &data)
 Deserialize some binary data received from a Pixels die to a PixelMessage. More...
 
std::shared_ptr< const PixelMessage > Systemic::Pixels::Messages::Serialization::deserializeMessage (const std::vector< uint8_t > &data)
 Deserialize some binary data received from a Pixels die to a PixelMessage. More...
 

Detailed Description

Pixel messages serialization functions.

Function Documentation

◆ deserializeMessage() [1/2]

template<typename T , std::enable_if_t< std::is_base_of_v< Systemic::Pixels::Messages::PixelMessage, T >, int > = 0>
std::shared_ptr< const T > Systemic::Pixels::Messages::Serialization::deserializeMessage ( const std::vector< uint8_t > &  data)

Deserialize some binary data received from a Pixels die to a PixelMessage.

Template Parameters
TThe expected type of PixelMessage.
Parameters
dataThe binary data.
Returns
The PixelMessage deserialized from the given binary data.
Note
It's usually best to call the non template overload.

◆ deserializeMessage() [2/2]

std::shared_ptr< const PixelMessage > Systemic::Pixels::Messages::Serialization::deserializeMessage ( const std::vector< uint8_t > &  data)

Deserialize some binary data received from a Pixels die to a PixelMessage.

Parameters
dataThe binary data.
Returns
The PixelMessage deserialized from the given binary data.

◆ serializeMessage()

template<typename T , std::enable_if_t< std::is_base_of_v< Systemic::Pixels::Messages::PixelMessage, T >, int > = 0>
void Systemic::Pixels::Messages::Serialization::serializeMessage ( const T &  message,
std::vector< uint8_t > &  outData 
)

Serialize a PixelMessage instance to binary data so it can be send to a Pixels die.

Template Parameters
TThe type of PixelMessage.
Parameters
messageThe PixelMessage instance.
outDataThe binary data serialized from the given message.