diff --git a/api/i_motor_laser_code_scanner.hpp b/api/i_motor_laser_code_scanner.hpp index 7bc6b60..201367a 100644 --- a/api/i_motor_laser_code_scanner.hpp +++ b/api/i_motor_laser_code_scanner.hpp @@ -5,13 +5,43 @@ using namespace std; class I_MotorLaserCodeScanner { public: - // virtual void +#pragma pack(push, 1) + typedef struct { + int32_t each_scan_result_len; + int32_t scan_reult_nums; + uint8_t scan_result[]; + } scan_result_t; +#pragma pack(pop) + public: + /** + * @brief 启动扫码 + * + * @param moveby_distance 移动距离 + * @param scan_interval_distance 每次扫描间隔距离 + * @param each_sample_times 每次采样次数 + * @param transmitting_tube_amplification 发光管放大倍数 + * @param receiving_tube_amplification 接收管放大倍数 + */ + virtual int32_t start_scan(s32 moveby_distance, // + s32 scan_interval_distance, // + s32 each_sample_times, // + s32 transmitting_tube_amplification, // + s32 receiving_tube_amplification, // + action_cb_status_t cb) = 0; + /** + * @brief 停止扫码 + * + * @return int32_t + */ + virtual int32_t stop_scan() = 0; /** - * push one clamp + * @brief 获取扫码结果 + * + * @param result + * @return int32_t */ - virtual void push_clamp(int32_t clamp_id, int32_t clamp_type, int32_t clamp_status, int32_t clamp_error_code) = 0; - + virtual int32_t get_scan_result(scan_result_t** result) = 0; }; } // namespace iflytop \ No newline at end of file diff --git a/zcancmder_protocol.hpp b/zcancmder_protocol.hpp index fd73ff6..32b3c8a 100644 --- a/zcancmder_protocol.hpp +++ b/zcancmder_protocol.hpp @@ -111,27 +111,16 @@ typedef enum { kcmd_heater_ctrl_module_get_base_param = CMDID(1011, 101), // 设置限制参数 /******************************************************************************* - * |Module_1012:光学模组扫码器 * + * |Module_1012:电机激光扫码器 * *******************************************************************************/ - kcmd_optical_barcode_reader_reset_pos = CMDID(1012, 0), // 复位 - kcmd_optical_barcode_reader_start_scan = CMDID(1012, 1), // 开始扫码 - kcmd_optical_barcode_reader_stop_scan = CMDID(1012, 2), // 停止扫码 - kcmd_optical_barcode_reader_drop_reaction_plate = CMDID(1012, 3), // 丢弃夹具 - - kcmd_optical_barcode_reader_read_status = CMDID(1012, 50), // 读取模块状态信息 - - kcmd_optical_barcode_reader_set_base_param = CMDID(1012, 100), // 设置运行参数 - kcmd_optical_barcode_reader_get_base_param = CMDID(1012, 101), // 读取运行参数 + kcmd_motor_laser_code_scanner_scan = CMDID(1012, 1), // 开始扫码 + kcmd_motor_laser_code_scanner_stop_scan = CMDID(1012, 2), // 停止扫码 + kcmd_motor_laser_code_scanner_get_scan_result = CMDID(1012, 3), // 获取扫码结果 /******************************************************************************* * |Module_1013:板夹仓 * *******************************************************************************/ - kcmd_reaction_plate_module_reset = CMDID(1013, 0), // 复位 - kcmd_reaction_plate_module_push_plate_and_scan = CMDID(1013, 1), // 推板 - kcmd_reaction_plate_module_read_status = CMDID(1013, 50), // 读取模块状态信息 - kcmd_reaction_plate_module_set_base_param = CMDID(1013, 100), // 设置运行参数 - kcmd_reaction_plate_module_get_base_param = CMDID(1013, 101), // 读取运行参数 // 风扇 /******************************************************************************* * |Module_1014:风扇 * @@ -289,9 +278,21 @@ ZPACKET_CMD_ACK(kcmd_barcode_reader_stop_scan, *******************************************************************************/ /******************************************************************************* - * |Module_1012:光学模组扫码器 * + * |Module_1012:电机激光扫码器 * *******************************************************************************/ +ZPACKET_CMD_ACK_AND_REPORT(kcmd_motor_laser_code_scanner_scan, + CMD(u8 id; // + s32 moveby_distance; // + s32 scan_interval_distance; // + s32 each_sample_times; // + s32 transmitting_tube_amplification; // 0.001 + s32 receiving_tube_amplification; // 0.001 + ), + ACK(u8 id;), REPORT(u8 id; int32_t exec_status;)); +ZPACKET_CMD_ACK(kcmd_motor_laser_code_scanner_stop_scan, CMD(u8 id;), ACK(u8 id;)); +ZPACKET_CMD_ACK(kcmd_motor_laser_code_scanner_get_scan_result, CMD(u8 id; u8 sector_index; u8 sector_size;), ACK(u8 id; u8 packet[];)); + /******************************************************************************* * Module_1013:板夹仓 * *******************************************************************************/