Callisto4Bootloader: ARK/platform_encoder_cbor.c File Reference

Callisto4Bootloader

Functions | Variables
platform_encoder_cbor.c File Reference
`#include "platform_encoder.h"`

Go to the source code of this file.

## Functions

static void | EncodeStructStart (stPayloadBuffer_t *pstPayload)
static void | EncodeStructEnd (stPayloadBuffer_t *pstPayload)
static void | EncodeArrayStart (stPayloadBuffer_t *pstPayload)
static void | EncodeArraySeparator (stPayloadBuffer_t *pstPayload)
static void | EncodeArrayEnd (stPayloadBuffer_t *pstPayload)
static void | EncodeFieldName (stPayloadBuffer_t *pstPayload, const uint8_t *pau8FieldName)
static void | EncodeFieldSeparator (stPayloadBuffer_t *pstPayload)
static void | EncodeBoolean (stPayloadBuffer_t *pstPayload, bool bValue)
static void | EncodeSignedInt (stPayloadBuffer_t *pstPayload, int64_t i64Value)
static void | EncodeUnsignedInt (stPayloadBuffer_t *pstPayload, uint64_t ui64Value)
static void | EncodeReal (stPayloadBuffer_t *pstPayload, double dValue)
static void | EncodeString (stPayloadBuffer_t *pstPayload, const uint8_t *pachString)
static bool | DecodeStructStart (stPayloadBuffer_t *pstPayload)
static bool | DecodeStructEnd (stPayloadBuffer_t *pstPayload)
static bool | DecodeArrayStart (stPayloadBuffer_t *pstPayload)
static bool | DecodeArraySeparator (stPayloadBuffer_t *pstPayload)
static bool | DecodeArrayEnd (stPayloadBuffer_t *pstPayload)
static bool | DecodeString (stPayloadBuffer_t *pstPayload, const uint8_t **ppau8String, uint32_t *puiStringLength)
static bool | DecodeFieldName (stPayloadBuffer_t *pstPayload, const uint8_t **pachFieldName, uint32_t *puiNameLength)
static bool | DecodeFieldSeparator (stPayloadBuffer_t *pstPayload)
static bool | DecodeBoolean (stPayloadBuffer_t *pstPayload, bool *pbValue)
static bool | DecodeSignedInt (stPayloadBuffer_t *pstPayload, int64_t *pi64Value)
static bool | DecodeUnsignedInt (stPayloadBuffer_t *pstPayload, uint64_t *pui64Value)
static bool | DecodeReal (stPayloadBuffer_t *pstPayload, double *pdValue)

## Variables

const stPayloadEncoder_t | stCBOREncoder
const stPayloadDecoder_t | stCBORDecoder

## Function Documentation

## ◆ DecodeArrayEnd()

static bool DecodeArrayEnd | ( | stPayloadBuffer_t * | pstPayload | ) |

static

Parse past an expected CBOR array end

Parameters

  [in] | pstPayload | Current payload

Returns
  true if it was as expected, else false

Definition at line 213 of file platform_encoder_cbor.c.

## ◆ DecodeArraySeparator()

static bool DecodeArraySeparator | ( | stPayloadBuffer_t * | pstPayload | ) |

static

Parse past an expected CBOR array separator

Parameters

  [in] | pstPayload | Current payload

Returns
  true if it was as expected, else false

Definition at line 200 of file platform_encoder_cbor.c.

## ◆ DecodeArrayStart()

static bool DecodeArrayStart | ( | stPayloadBuffer_t * | pstPayload | ) |

static

Parse past an expected CBOR array start

Parameters

  [in] | pstPayload | Current payload

Returns
  true if it was as expected, else false

Definition at line 187 of file platform_encoder_cbor.c.

## ◆ DecodeBoolean()

static bool DecodeBoolean | ( | stPayloadBuffer_t * | pstPayload,
|  | bool * | pbValue
| ) |  |

static

Grab a CBOR boolean value from the current payload

Parameters

  [in] | pstPayload | Current payload
  [out] | pbValue | Boolean value found

Returns
  true if it was as expected, else false

Definition at line 268 of file platform_encoder_cbor.c.

## ◆ DecodeFieldName()

static bool DecodeFieldName | ( | stPayloadBuffer_t * | pstPayload,
|  | const uint8_t ** | pachFieldName,
|  | uint32_t * | puiNameLength
| ) |  |

static

Grab a CBOR item name from the current payload

Parameters

  [in] | pstPayload | Current payload
  [out] | pau8FieldName | Item name found (note: not zero-terminated!)
  [out] | puiNameLength | Item name length

Returns
  true if it was as expected, else false

Definition at line 241 of file platform_encoder_cbor.c.

## ◆ DecodeFieldSeparator()

static bool DecodeFieldSeparator | ( | stPayloadBuffer_t * | pstPayload | ) |

static

Parse past an expected CBOR item separator

Parameters

  [in] | pstPayload | Current payload

Returns
  true if it was as expected, else false

Definition at line 254 of file platform_encoder_cbor.c.

## ◆ DecodeReal()

static bool DecodeReal | ( | stPayloadBuffer_t * | pstPayload,
|  | double * | pdValue
| ) |  |

static

Grab a CBOR real value from the current payload

Parameters

  [in] | pstPayload | Current payload
  [out] | pdValue | Real (double) value found

Returns
  true if it was as expected, else false

Definition at line 310 of file platform_encoder_cbor.c.

## ◆ DecodeSignedInt()

static bool DecodeSignedInt | ( | stPayloadBuffer_t * | pstPayload,
|  | int64_t * | pi64Value
| ) |  |

static

Grab a CBOR unsigned int from the current payload

Parameters

  [in] | pstPayload | Current payload
  [out] | pui64Value | Unsigned int value found

Returns
  true if it was as expected, else false

Definition at line 282 of file platform_encoder_cbor.c.

## ◆ DecodeString()

static bool DecodeString | ( | stPayloadBuffer_t * | pstPayload,
|  | const uint8_t ** | ppau8String,
|  | uint32_t * | puiStringLength
| ) |  |

static

Grab a CBOR string from the current payload

Parameters

  [in] | pstPayload | Current payload

Returns
  true if it was as expected, else false

Definition at line 226 of file platform_encoder_cbor.c.

## ◆ DecodeStructEnd()

static bool DecodeStructEnd | ( | stPayloadBuffer_t * | pstPayload | ) |

static

Parse past an expected CBOR struct end

Parameters

  [in] | pstPayload | Current payload

Returns
  true if it was as expected, else false

Definition at line 174 of file platform_encoder_cbor.c.

## ◆ DecodeStructStart()

static bool DecodeStructStart | ( | stPayloadBuffer_t * | pstPayload | ) |

static

Parse past an expected CBOR struct start

Parameters

  [in] | pstPayload | Current payload

Returns
  true if it was as expected, else false

Definition at line 161 of file platform_encoder_cbor.c.

## ◆ DecodeUnsignedInt()

static bool DecodeUnsignedInt | ( | stPayloadBuffer_t * | pstPayload,
|  | uint64_t * | pui64Value
| ) |  |

static

Grab a CBOR signed int from the current payload

Parameters

  [in] | pstPayload | Current payload
  [out] | pi64Value | Signed int value found

Returns
  true if it was as expected, else false

Definition at line 296 of file platform_encoder_cbor.c.

## ◆ EncodeArrayEnd()

static void EncodeArrayEnd | ( | stPayloadBuffer_t * | pstPayload | ) |

static

Finish sending an array out to a CBOR payload

Parameters

  [in] | pstPayload | Current payload

Definition at line 59 of file platform_encoder_cbor.c.

## ◆ EncodeArraySeparator()

static void EncodeArraySeparator | ( | stPayloadBuffer_t * | pstPayload | ) |

static

Send an array separator out to a CBOR payload

Parameters

  [in] | pstPayload | Current payload

Definition at line 48 of file platform_encoder_cbor.c.

## ◆ EncodeArrayStart()

static void EncodeArrayStart | ( | stPayloadBuffer_t * | pstPayload | ) |

static

Start sending an array out to a CBOR payload

Parameters

  [in] | pstPayload | Current payload

Definition at line 37 of file platform_encoder_cbor.c.

## ◆ EncodeBoolean()

static void EncodeBoolean | ( | stPayloadBuffer_t * | pstPayload,
|  | bool | bValue
| ) |  |

static

Send a boolean out to a CBOR payload

Parameters

  [in] | pstPayload | Current payload
  [in] | bValue | Boolean value to send

Definition at line 95 of file platform_encoder_cbor.c.

## ◆ EncodeFieldName()

static void EncodeFieldName | ( | stPayloadBuffer_t * | pstPayload,
|  | const uint8_t * | pau8FieldName
| ) |  |

static

Send an item identifier out to a CBOR payload

Parameters

  [in] | pstPayload | Current payload
  [in] | pau8FieldName | Item identifier/name

Definition at line 71 of file platform_encoder_cbor.c.

## ◆ EncodeFieldSeparator()

static void EncodeFieldSeparator | ( | stPayloadBuffer_t * | pstPayload | ) |

static

Send an item separator out to a CBOR payload

Parameters

  [in] | pstPayload | Current payload

Definition at line 83 of file platform_encoder_cbor.c.

## ◆ EncodeReal()

static void EncodeReal | ( | stPayloadBuffer_t * | pstPayload,
|  | double | dValue
| ) |  |

static

Send a signed int out to a CBOR payload

Parameters

  [in] | pstPayload | Current payload
  [in] | i64Value | Signed integer value to send

Definition at line 134 of file platform_encoder_cbor.c.

## ◆ EncodeSignedInt()

static void EncodeSignedInt | ( | stPayloadBuffer_t * | pstPayload,
|  | int64_t | i64Value
| ) |  |

static

Send a real out to a CBOR payload

Parameters

  [in] | pstPayload | Current payload
  [in] | dValue | Real value to send

Definition at line 108 of file platform_encoder_cbor.c.

## ◆ EncodeString()

static void EncodeString | ( | stPayloadBuffer_t * | pstPayload,
|  | const uint8_t * | pachString
| ) |  |

static

Send a string out to a CBOR payload

Parameters

  [in] | pstPayload | Current payload
  [in] | pau8String | String to send

Definition at line 147 of file platform_encoder_cbor.c.

## ◆ EncodeStructEnd()

static void EncodeStructEnd | ( | stPayloadBuffer_t * | pstPayload | ) |

static

Finish sending a struct out to a CBOR payload

Parameters

  [in] | pstPayload | Current payload

Definition at line 26 of file platform_encoder_cbor.c.

## ◆ EncodeStructStart()

static void EncodeStructStart | ( | stPayloadBuffer_t * | pstPayload | ) |

static

Start sending a struct out to a CBOR payload

Parameters

  [in] | pstPayload | Current payload

Definition at line 15 of file platform_encoder_cbor.c.

## ◆ EncodeUnsignedInt()

static void EncodeUnsignedInt | ( | stPayloadBuffer_t * | pstPayload,
|  | uint64_t | ui64Value
| ) |  |

static

Send an unsigned int out to a CBOR payload

Parameters

  [in] | pstPayload | Current payload
  [in] | ui64Value | Unsigned integer value to send

Definition at line 121 of file platform_encoder_cbor.c.

## Variable Documentation

## ◆ stCBORDecoder

const stPayloadDecoder_t stCBORDecoder

Initial value:
=
{
.pfn_DecodeStructStart = DecodeStructStart,
.pfn_DecodeStructEnd = DecodeStructEnd,
.pfn_DecodeArrayStart = DecodeArrayStart,
.pfn_DecodeArraySeparator = DecodeArraySeparator,
.pfn_DecodeArrayEnd = DecodeArrayEnd,
.pfn_DecodeFieldName = DecodeFieldName,
.pfn_DecodeFieldSeparator = DecodeFieldSeparator,
.pfn_DecodeBoolean = DecodeBoolean,
.pfn_DecodeSignedInt = DecodeSignedInt,
.pfn_DecodeUnsignedInt = DecodeUnsignedInt,
.pfn_DecodeReal = DecodeReal,
.pfn_DecodeString = DecodeString
}

Definition at line 333 of file platform_encoder_cbor.c.

Referenced by PayloadDecoder_Get().

## ◆ stCBOREncoder

const stPayloadEncoder_t stCBOREncoder

Initial value:
=
{
.pfn_EncodeStructStart = EncodeStructStart,
.pfn_EncodeStructEnd = EncodeStructEnd,
.pfn_EncodeArrayStart = EncodeArrayStart,
.pfn_EncodeArraySeparator = EncodeArraySeparator,
.pfn_EncodeArrayEnd = EncodeArrayEnd,
.pfn_EncodeFieldName = EncodeFieldName,
.pfn_EncodeFieldSeparator = EncodeFieldSeparator,
.pfn_EncodeBoolean = EncodeBoolean,
.pfn_EncodeSignedInt = EncodeSignedInt,
.pfn_EncodeUnsignedInt = EncodeUnsignedInt,
.pfn_EncodeReal = EncodeReal,
.pfn_EncodeString = EncodeString
}

Definition at line 316 of file platform_encoder_cbor.c.

Referenced by PayloadEncoder_Get().

DecodeSignedInt
static bool DecodeSignedInt(stPayloadBuffer_t *pstPayload, int64_t *pi64Value)
Definition: platform_encoder_cbor.c:282
EncodeArrayEnd
static void EncodeArrayEnd(stPayloadBuffer_t *pstPayload)
Definition: platform_encoder_cbor.c:59
EncodeReal
static void EncodeReal(stPayloadBuffer_t *pstPayload, double dValue)
Definition: platform_encoder_cbor.c:134
EncodeFieldSeparator
static void EncodeFieldSeparator(stPayloadBuffer_t *pstPayload)
Definition: platform_encoder_cbor.c:83
DecodeStructEnd
static bool DecodeStructEnd(stPayloadBuffer_t *pstPayload)
Definition: platform_encoder_cbor.c:174
EncodeArrayStart
static void EncodeArrayStart(stPayloadBuffer_t *pstPayload)
Definition: platform_encoder_cbor.c:37
EncodeSignedInt
static void EncodeSignedInt(stPayloadBuffer_t *pstPayload, int64_t i64Value)
Definition: platform_encoder_cbor.c:108
DecodeArrayEnd
static bool DecodeArrayEnd(stPayloadBuffer_t *pstPayload)
Definition: platform_encoder_cbor.c:213
DecodeArrayStart
static bool DecodeArrayStart(stPayloadBuffer_t *pstPayload)
Definition: platform_encoder_cbor.c:187
DecodeBoolean
static bool DecodeBoolean(stPayloadBuffer_t *pstPayload, bool *pbValue)
Definition: platform_encoder_cbor.c:268
EncodeFieldName
static void EncodeFieldName(stPayloadBuffer_t *pstPayload, const uint8_t *pau8FieldName)
Definition: platform_encoder_cbor.c:71
DecodeFieldName
static bool DecodeFieldName(stPayloadBuffer_t *pstPayload, const uint8_t **pachFieldName, uint32_t *puiNameLength)
Definition: platform_encoder_cbor.c:241
EncodeArraySeparator
static void EncodeArraySeparator(stPayloadBuffer_t *pstPayload)
Definition: platform_encoder_cbor.c:48
DecodeString
static bool DecodeString(stPayloadBuffer_t *pstPayload, const uint8_t **ppau8String, uint32_t *puiStringLength)
Definition: platform_encoder_cbor.c:226
EncodeStructStart
static void EncodeStructStart(stPayloadBuffer_t *pstPayload)
Definition: platform_encoder_cbor.c:15
DecodeFieldSeparator
static bool DecodeFieldSeparator(stPayloadBuffer_t *pstPayload)
Definition: platform_encoder_cbor.c:254
EncodeString
static void EncodeString(stPayloadBuffer_t *pstPayload, const uint8_t *pachString)
Definition: platform_encoder_cbor.c:147
DecodeReal
static bool DecodeReal(stPayloadBuffer_t *pstPayload, double *pdValue)
Definition: platform_encoder_cbor.c:310
DecodeUnsignedInt
static bool DecodeUnsignedInt(stPayloadBuffer_t *pstPayload, uint64_t *pui64Value)
Definition: platform_encoder_cbor.c:296
DecodeStructStart
static bool DecodeStructStart(stPayloadBuffer_t *pstPayload)
Definition: platform_encoder_cbor.c:161
DecodeArraySeparator
static bool DecodeArraySeparator(stPayloadBuffer_t *pstPayload)
Definition: platform_encoder_cbor.c:200
EncodeBoolean
static void EncodeBoolean(stPayloadBuffer_t *pstPayload, bool bValue)
Definition: platform_encoder_cbor.c:95
EncodeStructEnd
static void EncodeStructEnd(stPayloadBuffer_t *pstPayload)
Definition: platform_encoder_cbor.c:26
EncodeUnsignedInt
static void EncodeUnsignedInt(stPayloadBuffer_t *pstPayload, uint64_t ui64Value)
Definition: platform_encoder_cbor.c:121