Documentation
¶
Index ¶
- func GenerateDynamic(schemaName string, schemaText string) (map[string]DecoderFunction, error)
- func ReadMessage(schemaName string, msgDefs map[string]MessageSpecification, data []byte) (map[string]interface{}, error)
- type CdrReader
- func (r *CdrReader) Boolean() (bool, error)
- func (r *CdrReader) BooleanArray(length int) ([]bool, error)
- func (r *CdrReader) ByteLength() int
- func (r *CdrReader) DecodedBytes() int
- func (r *CdrReader) Float32() (JSONFloat32, error)
- func (r *CdrReader) Float32Array(length int) ([]JSONFloat32, error)
- func (r *CdrReader) Float64() (JSONFloat64, error)
- func (r *CdrReader) Float64Array(length int) ([]JSONFloat64, error)
- func (r *CdrReader) Int16() (int16, error)
- func (r *CdrReader) Int16Array(length int) ([]int16, error)
- func (r *CdrReader) Int32() (int32, error)
- func (r *CdrReader) Int32Array(length int) ([]int32, error)
- func (r *CdrReader) Int64() (int64, error)
- func (r *CdrReader) Int64Array(length int) ([]int64, error)
- func (r *CdrReader) Int8() (int8, error)
- func (r *CdrReader) Int8Array(length int) ([]int8, error)
- func (r *CdrReader) SequenceLength() (uint32, error)
- func (r *CdrReader) String() (string, error)
- func (r *CdrReader) StringArray(length int) ([]string, error)
- func (r *CdrReader) StringRaw(length int) (string, error)
- func (r *CdrReader) Uint16() (uint16, error)
- func (r *CdrReader) Uint16Array(length int) ([]uint16, error)
- func (r *CdrReader) Uint32() (uint32, error)
- func (r *CdrReader) Uint32Array(length int) ([]uint32, error)
- func (r *CdrReader) Uint64() (uint64, error)
- func (r *CdrReader) Uint64Array(length int) ([]uint64, error)
- func (r *CdrReader) Uint8() (uint8, error)
- func (r *CdrReader) Uint8Array(length int) ([]uint8, error)
- type Constant
- type DecoderFunction
- type Field
- type JSONFloat32
- type JSONFloat64
- type MessageSpecification
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateDynamic ¶
func GenerateDynamic(schemaName string, schemaText string) (map[string]DecoderFunction, error)
GenerateDynamic converts a ROS2 concatenated message definition into a map of message parsers.
func ReadMessage ¶
func ReadMessage(schemaName string, msgDefs map[string]MessageSpecification, data []byte) (map[string]interface{}, error)
ReadMessage deserializes a ROS2 message from bytes.
Types ¶
type CdrReader ¶
type CdrReader struct {
// contains filtered or unexported fields
}
CdrReader parses values from CDR data.
func NewCdrReader ¶
NewCdrReader creates a new CdrReader instance.
func (*CdrReader) BooleanArray ¶
BooleanArray reads an array of booleans.
func (*CdrReader) ByteLength ¶
ByteLength returns the number of bytes in the CDR data.
func (*CdrReader) DecodedBytes ¶
DecodedBytes returns the number of bytes that have been decoded.
func (*CdrReader) Float32 ¶
func (r *CdrReader) Float32() (JSONFloat32, error)
Float32 reads a 32-bit floating point number.
func (*CdrReader) Float32Array ¶
func (r *CdrReader) Float32Array(length int) ([]JSONFloat32, error)
Float32Array reads an array of float32 values.
func (*CdrReader) Float64 ¶
func (r *CdrReader) Float64() (JSONFloat64, error)
Float64 reads a 64-bit floating point number.
func (*CdrReader) Float64Array ¶
func (r *CdrReader) Float64Array(length int) ([]JSONFloat64, error)
Float64Array reads an array of float64 values.
func (*CdrReader) Int16Array ¶
Int16Array reads an array of int16 values.
func (*CdrReader) Int32Array ¶
Int32Array reads an array of int32 values.
func (*CdrReader) Int64Array ¶
Int64Array reads an array of int64 values.
func (*CdrReader) SequenceLength ¶
SequenceLength reads a 32-bit unsigned integer.
func (*CdrReader) StringArray ¶
StringArray reads an array of strings.
func (*CdrReader) Uint16Array ¶
Uint16Array reads an array of uint16 values.
func (*CdrReader) Uint32Array ¶
Uint32Array reads an array of uint32 values.
func (*CdrReader) Uint64Array ¶
Uint64Array reads an array of uint64 values.
type DecoderFunction ¶
DecoderFunction is a function that decodes ROS2 message data.
type JSONFloat32 ¶
type JSONFloat32 float32
JSONFloat32 is a float32 that marshals to a string, handling inf and nan. TODO: inf would be represented as +Inf in JSON, and unmarshalling of that will result in a string at the moment, but that should not hurt anything at the moment.
func (JSONFloat32) MarshalJSON ¶
func (j JSONFloat32) MarshalJSON() ([]byte, error)
type JSONFloat64 ¶
type JSONFloat64 float64
JSONFloat64 is a float64 that marshals to a string, handling inf and nan. TODO: inf would be represented as +Inf in JSON, and unmarshalling of that will result in a string at the moment, but that should not hurt anything at the moment.
func (JSONFloat64) MarshalJSON ¶
func (j JSONFloat64) MarshalJSON() ([]byte, error)