|
|
@ -74,7 +74,7 @@ void ZCanProtocolParser::onRceivePacket(zcr_cmd_header_t* rxcmd, uint8_t* data, |
|
|
|
|
|
|
|
ZIModule* module = it->second; |
|
|
|
int32_t cmdid = CMDID(rxcmd->cmdMainId, rxcmd->cmdSubId); |
|
|
|
_onRceivePacket(module, rxcmd, cmdid, data, len); |
|
|
|
_onRceivePacket(module, rxcmd, cmdid, rxcmd->data, len); |
|
|
|
} |
|
|
|
|
|
|
|
void ZCanProtocolParser::regCmdFn(int32_t cmdid, cmdcb_t cb) { |
|
|
@ -104,7 +104,8 @@ void ZCanProtocolParser::_onRceivePacket(ZIModule* module, zcr_cmd_header_t* rxc |
|
|
|
cxt.module = module; |
|
|
|
cxt.rxcmd = rxcmd; |
|
|
|
cxt.cmdid = cmdid; |
|
|
|
cxt.param = param; |
|
|
|
cxt.params = (int32_t*)param; |
|
|
|
cxt.paramRaw = param; |
|
|
|
cxt.paramlen = len; |
|
|
|
cxt.acklen = 0; |
|
|
|
cxt.ackbuf = ackbuf; |
|
|
@ -136,13 +137,14 @@ int32_t ZCanProtocolParser::module_get_status(cmdcontxt_t* cxt) { |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::module_set_reg(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(2); |
|
|
|
return module->module_set_reg(cxt->param[0], cxt->param[1]); |
|
|
|
return module->module_set_reg(cxt->params[0], cxt->params[1]); |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::module_get_reg(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
int32_t* ack = (int32_t*)cxt->ackbuf; |
|
|
|
cxt->acklen = 4; |
|
|
|
return module->module_get_reg(cxt->param[0], &ack[0]); |
|
|
|
ZLOGI(TAG, "module_get_reg %d", cxt->params[0]); |
|
|
|
return module->module_get_reg(cxt->params[0], &ack[0]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::module_get_error(cmdcontxt_t* cxt) { |
|
|
@ -175,11 +177,11 @@ int32_t ZCanProtocolParser::module_active_cfg(cmdcontxt_t* cxt) { |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::step_motor_enable(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->step_motor_enable(cxt->param[0]); |
|
|
|
return module->step_motor_enable(cxt->params[0]); |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::step_motor_stop(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->step_motor_stop(cxt->param[0]); |
|
|
|
return module->step_motor_stop(cxt->params[0]); |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::step_motor_read_pos(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(0); |
|
|
@ -189,16 +191,16 @@ int32_t ZCanProtocolParser::step_motor_read_pos(cmdcontxt_t* cxt) { |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::step_motor_easy_rotate(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->step_motor_easy_rotate(cxt->param[0]); |
|
|
|
return module->step_motor_easy_rotate(cxt->params[0]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::step_motor_easy_move_by(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->step_motor_easy_move_by(cxt->param[0]); |
|
|
|
return module->step_motor_easy_move_by(cxt->params[0]); |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::step_motor_easy_move_to(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->step_motor_easy_move_to(cxt->param[0]); |
|
|
|
return module->step_motor_easy_move_to(cxt->params[0]); |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::step_motor_easy_move_to_zero(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(0); |
|
|
@ -206,11 +208,11 @@ int32_t ZCanProtocolParser::step_motor_easy_move_to_zero(cmdcontxt_t* cxt) { |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::step_motor_easy_set_current_pos(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->step_motor_easy_set_current_pos(cxt->param[0]); |
|
|
|
return module->step_motor_easy_set_current_pos(cxt->params[0]); |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::step_motor_easy_move_to_io(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(2); |
|
|
|
return module->step_motor_easy_move_to_io(cxt->param[0], cxt->param[1]); |
|
|
|
return module->step_motor_easy_move_to_io(cxt->params[0], cxt->params[1]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::step_motor_active_cfg(cmdcontxt_t* cxt) { |
|
|
@ -221,7 +223,7 @@ int32_t ZCanProtocolParser::step_motor_read_io_state(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
int32_t* ack = (int32_t*)cxt->ackbuf; |
|
|
|
cxt->acklen = 4; |
|
|
|
return module->step_motor_read_io_state(cxt->param[0], ack); |
|
|
|
return module->step_motor_read_io_state(cxt->params[0], ack); |
|
|
|
} |
|
|
|
|
|
|
|
#undef MODULE_CLASS
|
|
|
@ -238,7 +240,7 @@ int32_t ZCanProtocolParser::step_motor_read_io_state(cmdcontxt_t* cxt) { |
|
|
|
// virtual int32_t mini_servo_read_io_state(int32_t ioindex) = 0;
|
|
|
|
int32_t ZCanProtocolParser::mini_servo_enable(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->mini_servo_enable(cxt->param[0]); |
|
|
|
return module->mini_servo_enable(cxt->params[0]); |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::mini_servo_read_pos(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(0); |
|
|
@ -252,15 +254,15 @@ int32_t ZCanProtocolParser::mini_servo_active_cfg(cmdcontxt_t* cxt) { |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::mini_servo_stop(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->mini_servo_stop(cxt->param[0]); |
|
|
|
return module->mini_servo_stop(cxt->params[0]); |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::mini_servo_rotate(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->mini_servo_rotate(cxt->param[0]); |
|
|
|
return module->mini_servo_rotate(cxt->params[0]); |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::mini_servo_move_to(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->mini_servo_move_to(cxt->param[0]); |
|
|
|
return module->mini_servo_move_to(cxt->params[0]); |
|
|
|
} |
|
|
|
int32_t ZCanProtocolParser::mini_servo_set_mid_point(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(0); |
|
|
@ -270,7 +272,7 @@ int32_t ZCanProtocolParser::mini_servo_read_io_state(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
int32_t* ack = (int32_t*)cxt->ackbuf; |
|
|
|
cxt->acklen = 4; |
|
|
|
return module->mini_servo_read_io_state(cxt->param[0], ack); |
|
|
|
return module->mini_servo_read_io_state(cxt->params[0], ack); |
|
|
|
} |
|
|
|
|
|
|
|
#if 0
|
|
|
@ -278,17 +280,17 @@ int32_t ZCanProtocolParser::mini_servo_read_io_state(cmdcontxt_t* cxt) { |
|
|
|
#define MODULE_CLASS ZIXYMotor
|
|
|
|
int32_t ZCanProtocolParser::xymotor_enable(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->xymotor_enable(cxt->param[0]); |
|
|
|
return module->xymotor_enable(cxt->params[0]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::xymotor_move_by(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(3); |
|
|
|
return module->xymotor_move_by(cxt->param[0], cxt->param[1], cxt->param[2]); |
|
|
|
return module->xymotor_move_by(cxt->params[0], cxt->params[1], cxt->params[2]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::xymotor_move_to(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(3); |
|
|
|
return module->xymotor_move_to(cxt->param[0], cxt->param[1], cxt->param[2]); |
|
|
|
return module->xymotor_move_to(cxt->params[0], cxt->params[1], cxt->params[2]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::xymotor_move_to_zero(cmdcontxt_t* cxt) { |
|
|
@ -332,7 +334,7 @@ int32_t ZCanProtocolParser::pipette_ctrl_put_tip(cmdcontxt_t* cxt) { |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::pipette_ctrl_move_to_ul(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->pipette_ctrl_move_to_ul(cxt->param[0]); |
|
|
|
return module->pipette_ctrl_move_to_ul(cxt->params[0]); |
|
|
|
} |
|
|
|
|
|
|
|
#undef MODULE_CLASS
|
|
|
@ -344,48 +346,48 @@ int32_t ZCanProtocolParser::pipette_ctrl_move_to_ul(cmdcontxt_t* cxt) { |
|
|
|
#define MODULE_CLASS ZIA8000OpticalModule
|
|
|
|
int32_t ZCanProtocolParser::a8000_optical_module_power_ctrl(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->a8000_optical_module_power_ctrl(cxt->param[0]); |
|
|
|
return module->a8000_optical_module_power_ctrl(cxt->params[0]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::a8000_optical_open_laser(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->a8000_optical_open_laser(cxt->param[0]); |
|
|
|
return module->a8000_optical_open_laser(cxt->params[0]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::a8000_optical_close_laser(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
return module->a8000_optical_close_laser(cxt->param[0]); |
|
|
|
return module->a8000_optical_close_laser(cxt->params[0]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::a8000_optical_set_laster_gain(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(2); |
|
|
|
return module->a8000_optical_set_laster_gain(cxt->param[0], cxt->param[1]); |
|
|
|
return module->a8000_optical_set_laster_gain(cxt->params[0], cxt->params[1]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::a8000_optical_set_scan_amp_gain(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(2); |
|
|
|
return module->a8000_optical_set_scan_amp_gain(cxt->param[0], cxt->param[1]); |
|
|
|
return module->a8000_optical_set_scan_amp_gain(cxt->params[0], cxt->params[1]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::a8000_optical_read_scanner_adc_val(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
int32_t* ack = (int32_t*)cxt->ackbuf; |
|
|
|
cxt->acklen = 4; |
|
|
|
return module->a8000_optical_read_scanner_adc_val(cxt->param[0], &ack[0]); |
|
|
|
return module->a8000_optical_read_scanner_adc_val(cxt->params[0], &ack[0]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::a8000_optical_read_laster_adc_val(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(1); |
|
|
|
int32_t* ack = (int32_t*)cxt->ackbuf; |
|
|
|
cxt->acklen = 4; |
|
|
|
return module->a8000_optical_read_laster_adc_val(cxt->param[0], &ack[0]); |
|
|
|
return module->a8000_optical_read_laster_adc_val(cxt->params[0], &ack[0]); |
|
|
|
} |
|
|
|
|
|
|
|
int32_t ZCanProtocolParser::a8000_optical_scan_current_point_amp_adc_val(cmdcontxt_t* cxt) { |
|
|
|
CHECK_AND_GET_MODULE(4); |
|
|
|
int32_t* ack = (int32_t*)cxt->ackbuf; |
|
|
|
cxt->acklen = 8; |
|
|
|
return module->a8000_optical_scan_current_point_amp_adc_val(cxt->param[0], cxt->param[1], cxt->param[2], &ack[0], &ack[1]); |
|
|
|
return module->a8000_optical_scan_current_point_amp_adc_val(cxt->params[0], cxt->params[1], cxt->params[2], &ack[0], &ack[1]); |
|
|
|
} |
|
|
|
|
|
|
|
#undef MODULE_CLASS
|