27 char *data,
size_t dataLen,
void *register_block_state_vp) {
28 if (!register_block_state_vp) {
29 Throw(ASC_ERROR_REG_BLOCK_NULL);
33 if (command !=
'r' && command !=
'w') {
34 Throw(ASC_ERROR_UNEXPECTED_COMMAND);
37 Throw(ASC_ERROR_DATA_TOO_SHORT);
40 if (reg_num >= register_block_state->
n_regs) {
41 Throw(ASC_ERROR_REGNUM_OOB);
44 REGTYPE reg_val = register_block_state->
block[reg_num];
46 put_val_into_bytes(reg_val, data + 5);
47 dataLen = 5 + REGWIDTHBYTES * 2;
49 if (dataLen < 5 + REGWIDTHBYTES) {
50 Throw(ASC_ERROR_REGVAL_LEN);
52 REGTYPE new_reg_val = get_val_from_bytes(data + 5);
53 register_block_state->
block[reg_num] = new_reg_val;
57 command, data, dataLen);
void ascii_serial_com_put_message_in_output_buffer(ascii_serial_com *asc, char ascVersion, char appVersion, char command, const char *data, size_t dataLen)
ASCII Serial Com Pack and put message in output buffer.
void ascii_serial_com_register_block_handle_message(ascii_serial_com *asc, char ascVersion, char appVersion, char command, char *data, size_t dataLen, void *register_block_state_vp)
ASCII Serial Com Register Block handle message.