#ifndef CONSOLE_H #define CONSOLE_H #define PROTOCOL_LENGTH 8 #define PacketAppDirection 0x01 #define EchoDataLength 0x02 #define EchoType 0x06 #define EchoFunctionCode 0xA4 #define ZeroValue 0x00 #include #include "ButtonHelper.h" #include "FunctionCodes.h" #include "PushButton.h" #include "RotaryButton.h" #include "DataSender.h" #include "Logger.h" class Console : public QObject { Q_OBJECT //PushButton with LED PUSH_BUTTON(Dual, dual, DUAL_FC, static_cast(DUAL_LED_FC)); PUSH_BUTTON(Quad, quad, QUAD_FC, static_cast(QUAD_LED_FC)); PUSH_BUTTON(Single, single, SINGLE_FC, static_cast(SINGLE_LED_FC)); PUSH_BUTTON(P1, p1, P1_FC, static_cast(P1_LED_FC)); PUSH_BUTTON(P2, p2, P2_FC, static_cast(P2_LED_FC)); PUSH_BUTTON(P3, p3, P3_FC, static_cast(P3_LED_FC)); PUSH_BUTTON(P4, p4, P4_FC, static_cast(P4_LED_FC)); PUSH_BUTTON(P5, p5, P5_FC, static_cast(P5_LED_FC)); PUSH_BUTTON(P6, p6, P6_FC, static_cast(P6_LED_FC)); PUSH_BUTTON(Exit, exit, EXIT_FC, static_cast(EXIT_LED_FC)); PUSH_BUTTON(Freeze, freeze, FREEZE_FC, static_cast(FREEZE_LED_FC)); PUSH_BUTTON(Pointer, pointer, POINTER_FC, static_cast(POINTER_LED_FC)); PUSH_BUTTON(AutoSet, autoSet, AUTOSET_FC, static_cast(AUTOSET_LED_FC)); PUSH_BUTTON(Abc, abc, ABC_FC, static_cast(ABC_LED_FC)); PUSH_BUTTON(FourD, fourD, FOUR_D_FC, static_cast(FOUR_D_LED_FC)); PUSH_BUTTON(Clear, clear, CLEAR_FC, static_cast(CLEAR_LED_FC)); PUSH_BUTTON(ThreeD, threeD, THREE_D_FC, static_cast(THREE_D_LED_FC)); PUSH_BUTTON(Measure, measure, MEASURE_FC, static_cast(MEASURE_LED_FC)); PUSH_BUTTON(BodyMark, bodyMark, BODY_MARK_FC, static_cast(BODY_MARK_LED_FC)); PUSH_BUTTON(Patient, patient, PATIENT_FC, static_cast(PATIENT_LED_FC)); PUSH_BUTTON(Utils, utils, UTILS_FC, static_cast(UTILS_LED_FC)); PUSH_BUTTON(Dvd, dvd, DVD_FC, static_cast(DVD_LED_FC)); PUSH_BUTTON(Report, report, REPORT_FC, static_cast(REPORT_LED_FC)); PUSH_BUTTON(Probe, probe, PROBE_FC, static_cast(PROBE_LED_FC)); PUSH_BUTTON(Archive, archive, ARCHIVE_FC, static_cast(ARCHIVE_LED_FC)); PUSH_BUTTON(End, end, END_FC, static_cast(END_LED_FC)); PUSH_BUTTON(Xtd, xtd, XTD_FC, static_cast(XTD_LED_FC)); PUSH_BUTTON(Bf, bf, BF_FC, static_cast(BF_LED_FC)); PUSH_BUTTON(DepthCenter, depthCenter, DEPTH_CENTER_FC, static_cast(ZOOM_LED_FC)); PUSH_BUTTON(FocusCenter, focusCenter, FOCUS_CENTER_FC, static_cast(FOCUS_ZONE_LED_FC)); PUSH_BUTTON(ModePwCenter, modePwCenter, MODE_PW_CENTER_FC, static_cast(MODE_PW_LED_FC)); PUSH_BUTTON(ModeMCenter, modeMCenter, MODE_M_CENTER_FC, static_cast(MODE_M_LED_FC)); PUSH_BUTTON(ModePdCenter, modePdCenter, MODE_PD_CENTER_FC, static_cast(MODE_PD_LED_FC)); PUSH_BUTTON(ModeCCenter, modeCCenter, MODE_C_CENTER_FC, static_cast(MODE_C_LED_FC)); PUSH_BUTTON(ModeBCenter, modeBCenter, MODE_2D_CENTER_FC, static_cast(MODE_2D_LED_FC)); PUSH_BUTTON(DepthBottom, depthBottom, DEPTH_BOTTOM_FC, static_cast(DEPTH_LED_FC)); PUSH_BUTTON(FocusBottom, focusBottom, FOCUS_BOTTOM_FC, static_cast(FOCUS_DEPTH_LED_FC)); //PushButton with No LED PUSH_BUTTON_NO_LED(Js1Top, js1Top, JOYSTICK1_TOP_FC); PUSH_BUTTON_NO_LED(Js2Top, js2Top, JOYSTICK2_TOP_FC); PUSH_BUTTON_NO_LED(Js3Top, js3Top, JOYSTICK3_TOP_FC); PUSH_BUTTON_NO_LED(Js4Top, js4Top, JOYSTICK4_TOP_FC); PUSH_BUTTON_NO_LED(Js5Top, js5Top, JOYSTICK5_TOP_FC); PUSH_BUTTON_NO_LED(DepthTop, depthTop, DEPTHTOP_FC); PUSH_BUTTON_NO_LED(FocusTop, focusTop, FOCUSTOP_FC); PUSH_BUTTON_NO_LED(Js1Center, js1Center, JOYSTICK1_CENTER_FC); PUSH_BUTTON_NO_LED(Js2Center, js2Center, JOYSTICK2_CENTER_FC); PUSH_BUTTON_NO_LED(Js3Center, js3Center, JOYSTICK3_CENTER_FC); PUSH_BUTTON_NO_LED(Js4Center, js4Center, JOYSTICK4_CENTER_FC); PUSH_BUTTON_NO_LED(Js5Center, js5Center, JOYSTICK5_CENTER_FC); PUSH_BUTTON_NO_LED(Js1Bottom, js1Bottom, JOYSTICK1_BOTTOM_FC); PUSH_BUTTON_NO_LED(Js2Bottom, js2Bottom, JOYSTICK2_BOTTOM_FC); PUSH_BUTTON_NO_LED(Js3Bottom, js3Bottom, JOYSTICK3_BOTTOM_FC); PUSH_BUTTON_NO_LED(Js4Bottom, js4Bottom, JOYSTICK4_BOTTOM_FC); PUSH_BUTTON_NO_LED(Js5Bottom, js5Bottom, JOYSTICK5_BOTTOM_FC); PUSH_BUTTON_NO_LED(TrackballTop, trackballTop, TRACKBALL_TOP_FC); PUSH_BUTTON_NO_LED(TrackballTopRight, trackballTopRight, TRACKBALL_TOP_RIGHT_FC); PUSH_BUTTON_NO_LED(TrackballRight, trackballRight, TRACKBALL_RIGHT_FC); PUSH_BUTTON_NO_LED(TrackballBottomRight, trackballBottomRight, TRACKBALL_BOTTOM_RIGHT_FC); PUSH_BUTTON_NO_LED(TrackballBottom, trackballBottom, TRACKBALL_BOTTOM_FC); PUSH_BUTTON_NO_LED(TrackballBottomLeft, trackballBottomLeft, TRACKBALL_TOP_BOTTOM_FC); PUSH_BUTTON_NO_LED(TrackballLeft, trackballLeft, TRACKBALL_LEFT_FC); PUSH_BUTTON_NO_LED(TrackballTopLeft, trackballTopLeft, TRACKBALL_TOP_LEFT_FC); //ROTAY_BUTTON with LED ROTARY_BUTTON(Focus, focus, FOCUS_FC, static_cast(ANGLE_LED_FC)); ROTARY_BUTTON(ModeM, modeM, MODE_M_FC, static_cast(QUADRAT_LED_FC)); ROTARY_BUTTON(ModePd, modePd, MODE_PD_FC, static_cast(Z_LED_FC)); ROTARY_BUTTON(ModeC, modeC, MODE_C_FC, static_cast(Y_LED_FC)); ROTARY_BUTTON(ModeB, modeB, MODE_2D_FC, static_cast(X_LED_FC)); //ROTAY_BUTTON with No LED ROTARY_BUTTON_NO_LED(Js1, js1, JOYSTICK1_FC); ROTARY_BUTTON_NO_LED(Js2, js2, JOYSTICK2_FC); ROTARY_BUTTON_NO_LED(Js3, js3, JOYSTICK3_FC); ROTARY_BUTTON_NO_LED(Js4, js4, JOYSTICK4_FC); ROTARY_BUTTON_NO_LED(Js5, js5, JOYSTICK5_FC); ROTARY_BUTTON_NO_LED(Depth, depth, DEPTH_FC); ROTARY_BUTTON_NO_LED(ModePw, modePw, MODE_PW_FC); private: DataSender* _dataSender; Logger* _logger; public: Console(); void injectDataSender(DataSender* sender); void injectLogger(Logger* logger); void hasValidDataFormat(const QByteArray& data); bool isEchoPacket(const QByteArray& data); void initializeButtons(); signals: void dataReady(QByteArray data, Logger* log); //uncrustify off public slots: //uncrustify on void newData(QByteArray data); }; #endif //CONSOLE_H