Motion Master
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
mm::comm::spoe Namespace Reference

Classes

class  Device
 Handles TCP communication with SOMANET devices over SPoE. More...
 
class  DeviceParameterRefresher
 Concrete refresher that uploads parameters from a device. More...
 
struct  Message
 
struct  ServerInfo
 Contains information about the server's protocol version and monitoring mode. More...
 

Enumerations

enum class  SpoeMessageType : uint8_t {
  SDO_READ = 0x01 , SDO_WRITE = 0x02 , PDO_RXTX_FRAME , PDO_CONTROL = 0x04 ,
  SDO_BATCH_READ = 0x06 , FIRMWARE_UPDATE = 0x0B , FILE_READ = 0x0C , FILE_WRITE = 0x0D ,
  STATE_CONTROL , STATE_READ = 0x0F , PARAM_LIST = 0x13 , SERVER_INFO = 0x20
}
 Enumeration of SPoE message types used in the protocol. More...
 
enum class  SpoeMessageRequestStatus : uint8_t { OK = 0x00 , FIRST = 0x80 , MIDDLE = 0xC0 , LAST = 0x40 }
 Status codes representing the state of an SPoE request message. More...
 
enum class  SpoeMessageParamListErrorStatus : uint8_t { SUCCESS_ACK = 0x58 , ERR = 0x63 , BUSY_INDICATION = 0x28 }
 Error status codes returned when reading the parameter list via SPoE. More...
 
enum class  SpoeMessageSdoStatus : uint16_t {
  NO_ERR = 0x0000 , GENERIC = 0x0001 , NOT_FOUND = 0x0002 , READ_ONLY = 0x0003 ,
  WRITE_ONLY = 0x0004 , WRONG_TYPE = 0x0005 , INVALID_LIST = 0x0006 , INSUFFICIENT_BUFFER = 0x0007 ,
  VALUEINFO_UNAVAILABLE = 0x0008 , UNKNOWN_OR_UNSUPPORTED = 0x0009 , LOCAL_TRANSFER = 0x000A , UNSUPPORTED_ACCESS = 0x000B ,
  SI0_NOT_ZERO = 0x000C , SUB_NOT_FOUND = 0x000D
}
 Status codes returned during SDO (Service Data Object) read and write operations. More...
 
enum class  SpoeMessageFileErrorStatus : uint8_t {
  SUCCESS_ACK = 0x58 , UNDEFINED = 0x00 , NOT_FOUND = 0x01 , ACCESS_DENIED = 0x02 ,
  STORAGE_FULL = 0x03 , ILLEGAL_REQ = 0x04 , PACKET_NUMBER = 0x05 , ALREADY_EXISTS = 0x06 ,
  NO_USER = 0x07 , BOOTSTRAP_ONLY = 0x08 , NOT_BOOTSTRAP = 0x09 , NO_RIGHTS = 0x0A ,
  PROGRAM_ERROR = 0x0B , BUSY = 0x0C , FILENAME_LEN = 0x0D , TIMEOUT = 0x0E ,
  FLASH_BUSY = 0x28 , COMMUNICATION_BRIDGE_ERROR = 0x63
}
 Error status codes returned when reading or writing a file via SPoE message. More...
 
enum class  SpoeMessagePacketStatus : uint8_t { OK = 0x00 , FIRST = 0x80 , MIDDLE = 0xC0 , LAST = 0x40 }
 Packet status codes for SPoE messages. More...
 
enum class  PdoMode : uint8_t { NONE = 0 , MONITOR , CONTROL = 2 }
 Defines the modes for Process Data Object (PDO) communication over SPoE. More...
 

Functions

Message parseMessage (const std::vector< uint8_t > &buffer)
 Parses a raw SPoE message buffer into a structured SpoeMessage. More...
 
std::vector< uint8_t > serializeSpoeMessage (const Message &message)
 Serializes an SpoeMessage object into a byte buffer. More...
 
 NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE (Message, type, id, status, size, data)
 

Enumeration Type Documentation

◆ PdoMode

enum class mm::comm::spoe::PdoMode : uint8_t
strong

Defines the modes for Process Data Object (PDO) communication over SPoE.

  • NONE: No process or cyclic data exchange is available.
  • MONITOR: The device will only send RxPDO values; requests in messages will be ignored.
  • CONTROL: Both RxPDO and TxPDO data exchange is enabled.
Enumerator
NONE 

No process or cyclic data exchange available.

MONITOR 

Device sends RxPDO values only; incoming requests are ignored.

CONTROL 

Both RxPDO and TxPDO data exchange enabled.

◆ SpoeMessageFileErrorStatus

enum class mm::comm::spoe::SpoeMessageFileErrorStatus : uint8_t
strong

Error status codes returned when reading or writing a file via SPoE message.

Enumerator
SUCCESS_ACK 

Success Acknowledgement.

UNDEFINED 
NOT_FOUND 
ACCESS_DENIED 
STORAGE_FULL 
ILLEGAL_REQ 
PACKET_NUMBER 
ALREADY_EXISTS 
NO_USER 
BOOTSTRAP_ONLY 
NOT_BOOTSTRAP 
NO_RIGHTS 
PROGRAM_ERROR 
BUSY 
FILENAME_LEN 
TIMEOUT 
FLASH_BUSY 
COMMUNICATION_BRIDGE_ERROR 

◆ SpoeMessagePacketStatus

enum class mm::comm::spoe::SpoeMessagePacketStatus : uint8_t
strong

Packet status codes for SPoE messages.

This enum defines various status flags used to indicate the completeness and validity of a SPoE message, including support for segmented transfers.

Enumerator
OK 

Message is complete and valid.

FIRST 

First segment of a multi-part message.

MIDDLE 

Middle segment of a multi-part message.

LAST 

Last segment of a multi-part message.

◆ SpoeMessageParamListErrorStatus

Error status codes returned when reading the parameter list via SPoE.

Enumerator
SUCCESS_ACK 

Success Acknowledgement.

ERR 
BUSY_INDICATION 

◆ SpoeMessageRequestStatus

enum class mm::comm::spoe::SpoeMessageRequestStatus : uint8_t
strong

Status codes representing the state of an SPoE request message.

This enum indicates whether a message is complete, part of a segmented sequence, or contains an error.

Enumerator
OK 

Message is complete and valid.

FIRST 

First segment of a multi-part message.

MIDDLE 

Middle segment of a multi-part message.

LAST 

Last segment of a multi-part message.

◆ SpoeMessageSdoStatus

enum class mm::comm::spoe::SpoeMessageSdoStatus : uint16_t
strong

Status codes returned during SDO (Service Data Object) read and write operations.

These codes represent the result of accessing parameters on the SPoE device.

Enumerator
NO_ERR 

Success Acknowledgement.

GENERIC 
NOT_FOUND 
READ_ONLY 
WRITE_ONLY 
WRONG_TYPE 
INVALID_LIST 
INSUFFICIENT_BUFFER 
VALUEINFO_UNAVAILABLE 
UNKNOWN_OR_UNSUPPORTED 
LOCAL_TRANSFER 
UNSUPPORTED_ACCESS 
SI0_NOT_ZERO 
SUB_NOT_FOUND 

◆ SpoeMessageType

enum class mm::comm::spoe::SpoeMessageType : uint8_t
strong

Enumeration of SPoE message types used in the protocol.

Each message type corresponds to a specific operation or request within the SPoE communication protocol.

Note
This is specified in the "Ethernet interface definition" document.
Enumerator
SDO_READ 

Read a Service Data Object (SDO) value.

SDO_WRITE 

Write a value to a Service Data Object (SDO).

PDO_RXTX_FRAME 

Transmit or receive a Process Data Object (PDO) frame.

PDO_CONTROL 

Control or configure PDO behavior.

SDO_BATCH_READ 

Read multiple SDOs in a single request.

FIRMWARE_UPDATE 

Perform firmware update operation.

FILE_READ 

Read a file from the device.

FILE_WRITE 

Write a file to the device.

STATE_CONTROL 

Control the state of the device (e.g., INIT, PREOP).

STATE_READ 

Read the current state of the device.

PARAM_LIST 

Request a full list of parameters.

SERVER_INFO 

Request information about the server or device.

Function Documentation

◆ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE()

mm::comm::spoe::NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE ( Message  ,
type  ,
id  ,
status  ,
size  ,
data   
)

◆ parseMessage()

Message mm::comm::spoe::parseMessage ( const std::vector< uint8_t > &  buffer)

Parses a raw SPoE message buffer into a structured SpoeMessage.

This function interprets the first 7 bytes of the buffer as the message header, extracting the type, sequence ID, status, and payload size. If the size field is greater than zero, it also extracts the payload data.

Parameters
bufferThe raw byte buffer containing the SPoE message. Must be at least 7 bytes long to contain the header.
Returns
A structured representation of the parsed SPoE message.
Exceptions
std::runtime_errorIf the buffer is smaller than the required header size.
See also
SpoeMessage, SpoeMessageType

◆ serializeSpoeMessage()

std::vector< uint8_t > mm::comm::spoe::serializeSpoeMessage ( const Message message)

Serializes an SpoeMessage object into a byte buffer.

This function converts the provided SpoeMessage into a byte array, which can be sent over a network. The SpoeMessage type, ID, status, size, and any associated data are serialized into the buffer in a specific format expected by the receiving device.

Parameters
messageThe SpoeMessage object to serialize.
Returns
A std::vector<uint8_t> containing the serialized byte buffer.
See also
SpoeMessage, SpoeMessageType