Exemplo n.º 1
0
        private int HandleCmd_DiagnosisStatusControl(EmulatorCommandType cmd, EmulMessage msg)
        {
            //D0: Rack ID
            //D1: cmd
            //D2: -
            //D3: -
            //D4-D7: EmulatorDiagnosisType
            Int32 diagnosisFlags = builderWindow.GetSelectedDiagnosisStatus();

            msg.DATA[0] = builderWindow.GetSelectedRackID();
            msg.DATA[1] = (byte)cmd;
            msg.DATA[2] = 0;
            msg.DATA[3] = 0;
            msg.DATA[4] = (byte)((diagnosisFlags >> 24) & 0xff);
            msg.DATA[5] = (byte)((diagnosisFlags >> 16) & 0xff);
            msg.DATA[6] = (byte)((diagnosisFlags >> 8) & 0xff);
            msg.DATA[7] = (byte)(diagnosisFlags & 0xff);

            return(0);
        }
Exemplo n.º 2
0
        private int HandleCmd_BatteryStatusControl(EmulatorCommandType cmd, EmulMessage msg)
        {
            //D0: Rack ID
            //D1: cmd
            //D2: EmulatorBatteryStatusElement
            //D3: -
            //D4-D5: Element Status Value1
            //D6-D7: Element Status Value2

            msg.DATA[0] = builderWindow.GetSelectedRackID();
            msg.DATA[1] = (byte)cmd;
            msg.DATA[2] = (byte)builderWindow.GetSelectedBatteryStatusElement();
            msg.DATA[3] = 0;
            msg.DATA[4] = (byte)((builderWindow.GetValueInputField(1) >> 8) & 0xff);
            msg.DATA[5] = (byte)((builderWindow.GetValueInputField(1)) & 0xff);
            msg.DATA[6] = (byte)((builderWindow.GetValueInputField(2) >> 8) & 0xff);
            msg.DATA[7] = (byte)((builderWindow.GetValueInputField(2)) & 0xff);

            return(0);
        }
Exemplo n.º 3
0
        public EmulatorResult BuildMessageWithSelectedOptions(ref EmulMessage msg)
        {
            builderWindow.ShowDialog();
            if (builderWindow.windowStatus == MessageBuilderWindow.WindowStatus.CANCEL_CLOSED)
            {
                return(EmulatorResult.EMULATOR_RESULT_CANCELLED);
            }

            //Update variables from the controls
            EmulatorCommandType commandType = builderWindow.GetSelectedCommandType();

            foreach (var cmdType in cmdTypeFuncMap)
            {
                if (cmdType.Key.Equals(commandType))
                {
                    cmdType.Value.Invoke((EmulatorCommandType)commandType, message);
                    msg = message;
                    return(EmulatorResult.EMULATOR_RESULT_SUCCESS);                    //Success
                }
            }
            return(EmulatorResult.EMULATOR_RESULT_INVALID_PARAM);            //Fail: No matching command
        }
Exemplo n.º 4
0
        private int HandleCmd_DiagnosisStatusRequest(EmulatorCommandType cmd, EmulMessage msg)
        {
            //D0: Rack ID
            //D1: cmd
            //D2: -
            //D3: -
            //D4: -
            //D5: -
            //D6: -
            //D7: -

            msg.DATA[0] = builderWindow.GetSelectedRackID();
            msg.DATA[1] = (byte)cmd;
            msg.DATA[2] = 0;
            msg.DATA[3] = 0;
            msg.DATA[4] = 0;
            msg.DATA[5] = 0;
            msg.DATA[6] = 0;
            msg.DATA[7] = 0;

            return(0);
        }
Exemplo n.º 5
0
        private int HandleCmd_ComponentStatusControl(EmulatorCommandType cmd, EmulMessage msg)
        {
            //D0: Rack ID
            //D1: cmd
            //D2: EmulatorComponentType
            //D3: Component Status Value
            //D4: -
            //D5: -
            //D6: -
            //D7: -

            msg.DATA[0] = builderWindow.GetSelectedRackID();
            msg.DATA[1] = (byte)cmd;
            msg.DATA[2] = (byte)builderWindow.GetSelectedComponentType();
            msg.DATA[3] = (byte)Convert.ToByte(builderWindow.GetValueToggleField());
            msg.DATA[4] = 0;
            msg.DATA[5] = 0;
            msg.DATA[6] = 0;
            msg.DATA[7] = 0;

            return(0);
        }
Exemplo n.º 6
0
 public EmulatorCommandComboBoxItem(string name, string content, EmulatorCommandType commandType) : base(name, content)
 {
     this.commandType = commandType;
 }