// ************************************************************************** // * function to get data from mbed RPC variable // * public void get_data() { LEDStatus0_i = LEDStatus0.read_char(); LEDStatus1_i = LEDStatus1.read_char(); LEDStatus2_i = LEDStatus2.read_char(); LocalActiveLED_i = ((LEDStatus0_i >> 2) & 0x000000001); LNBPosition_i = ((LEDStatus0_i >> 3) & 0x000000001); UHFPosition_i = ((LEDStatus0_i >> 4) & 0x000000001); LNBAutoManual_i = ((LEDStatus0_i >> 5) & 0x000000001); UHFAutoManual_i = ((LEDStatus0_i >> 6) & 0x000000001); PSU1Alarm_i = ((LEDStatus1_i >> 1) & 0x000000001); PSU2Alarm_i = ((LEDStatus1_i >> 2) & 0x000000001); LNB1Alarm_i = ((LEDStatus1_i >> 3) & 0x000000001); LNB2Alarm_i = ((LEDStatus1_i >> 4) & 0x000000001); UHF1Alarm_i = ((LEDStatus1_i >> 5) & 0x000000001); UHF2Alarm_i = ((LEDStatus1_i >> 6) & 0x000000001); LNBSwitchError_i = ((LEDStatus2_i >> 1) & 0x000000001); UHFSwitchError_i = ((LEDStatus2_i >> 2) & 0x000000001); }
// ************************************************************************** // * function to initialise // * public void init() { setLayout(null); mbed = new HTTPRPC(this); LEDStatus1 = new RPCVariable<Character>(mbed, "RemoteLEDStatus1"); // won't work with bool LEDStatus0 = new RPCVariable<Character>(mbed, "RemoteLEDStatus0"); LEDStatus2 = new RPCVariable<Character>(mbed, "RemoteLEDStatus2"); CtrlAction = new RPCVariable<Integer>(mbed, "RemoteCtrlAction"); LEDStatus0_i = LEDStatus0.read_char(); CommsOpenFlag = ((LEDStatus1_i >> 1) & 0x00000001); if (CommsOpenFlag == 0) { comms_active = 1; LocalActive_ALBtn = new Button("Local / Remote"); Refresh_ALBtn = new Button("Update Connection Data"); LNBSelect_ALBtn = new Button("LNB"); LNBAutoManual_ALBtn = new Button("LNB Auto/Manual"); LNBRecal_ALBtn = new Button("LNB Recalibrate"); UHFSelect_ALBtn = new Button("UHF"); UHFAutoManual_ALBtn = new Button("UHF Auto/Manual"); UHFRecal_ALBtn = new Button("UHF Recalibrate"); LocalActive_ALBtn.setBounds(80, 20, 160, 30); Refresh_ALBtn.setBounds(20, 420, 220, 30); LNBSelect_ALBtn.setBounds(97, 86, 66, 40); LNBAutoManual_ALBtn.setBounds(80, 131, 160, 30); LNBRecal_ALBtn.setBounds(80, 168, 160, 30); UHFSelect_ALBtn.setBounds(97, 226, 66, 40); UHFAutoManual_ALBtn.setBounds(80, 271, 160, 30); UHFRecal_ALBtn.setBounds(80, 308, 160, 30); add(LocalActive_ALBtn); add(Refresh_ALBtn); add(LNBSelect_ALBtn); add(LNBAutoManual_ALBtn); add(LNBRecal_ALBtn); add(UHFSelect_ALBtn); add(UHFAutoManual_ALBtn); add(UHFRecal_ALBtn); LocalActive_ALBtn.addActionListener(this); Refresh_ALBtn.addActionListener(this); LNBSelect_ALBtn.addActionListener(this); LNBAutoManual_ALBtn.addActionListener(this); LNBRecal_ALBtn.addActionListener(this); UHFSelect_ALBtn.addActionListener(this); UHFAutoManual_ALBtn.addActionListener(this); UHFRecal_ALBtn.addActionListener(this); refresh_timer = new Timer(rate, timerListener); refresh_timer.start(); get_data(); CtrlAction.write(0x01); // 01=Set Remote Comms Open/Active } else { comms_active = 0; } }