示例#1
0
 /**
  * Set the current state of this Light This routine requests the hardware to change. If this is
  * really a change in state of this bit (tested in SerialNode), a Transmit packet will be sent
  * before this Node is next polled.
  */
 protected void doNewState(int oldState, int newState) {
   SerialNode mNode = SerialAddress.getNodeFromSystemName(getSystemName());
   if (mNode != null) {
     if (newState == ON) {
       mNode.setOutputBit(mBit, false);
     } else if (newState == OFF) {
       mNode.setOutputBit(mBit, true);
     } else {
       log.warn("illegal state requested for Light: " + getSystemName());
     }
   }
 }
示例#2
0
 /**
  * Public method to set a SECSI Output bit Note: systemName is of format CNnnnBxxxx where "nnn" is
  * the serial node number (0 - 127) "xxxx' is the bit number within that node (1 thru number of
  * defined bits) state is 'true' for 0, 'false' for 1 The bit is transmitted to the hardware
  * immediately before the next poll packet is sent.
  */
 public void setSerialOutput(String systemName, boolean state) {
   // get the node and bit numbers
   SerialNode node = SerialAddress.getNodeFromSystemName(systemName);
   if (node == null) {
     log.error("bad SerialNode specification in SerialOutput system name:" + systemName);
     return;
   }
   int bit = SerialAddress.getBitFromSystemName(systemName);
   if (bit == 0) {
     log.error("bad output bit specification in SerialOutput system name:" + systemName);
     return;
   }
   // set the bit
   node.setOutputBit(bit, state);
 }