public void destroy() { CtrlAction.write(0x02); // 01=Set Remote Comms off super.destroy(); mbed.delete(); }
// ************************************************************************** // * functions for timer and memory control // * public void stop() { CtrlAction.write(0x02); // 01=Set Remote Comms off refresh_timer.stop(); mbed.delete(); super.destroy(); }
// ************************************************************************** // * 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; } }
public void actionPerformed(ActionEvent evt) { if (evt.getSource() == LocalActive_ALBtn) { CtrlAction.write(0x03); // LR on CtrlAction.write(0x04); // LR off get_data(); repaint(); get_data(); repaint(); } if (evt.getSource() == LNBSelect_ALBtn) { CtrlAction.write(0x05); // LNB on get_data(); repaint(); get_data(); repaint(); } if (evt.getSource() == LNBAutoManual_ALBtn) { CtrlAction.write(0x07); // LNB Auto on get_data(); repaint(); get_data(); repaint(); } if (evt.getSource() == LNBRecal_ALBtn) { // LNBRecal_i=1; LNBRecalCounter = 3; // get_data(); repaint(); CtrlAction.write(0x09); // LNB Recal on get_data(); repaint(); } if (evt.getSource() == UHFSelect_ALBtn) { CtrlAction.write(0x0B); // UHF on get_data(); repaint(); get_data(); repaint(); } if (evt.getSource() == UHFAutoManual_ALBtn) { CtrlAction.write(0x0D); // UHF Auto on get_data(); repaint(); } if (evt.getSource() == UHFRecal_ALBtn) { // UHFRecal_i=1; UHFRecalCounter = 3; repaint(); CtrlAction.write(0x0F); // UHF Recal on get_data(); repaint(); } if (evt.getSource() == Refresh_ALBtn) { get_data(); repaint(); get_data(); repaint(); } }