Esempio n. 1
0
 /**
  * Helper method to make extended message
  *
  * @param flags
  * @param cmd1
  * @param cmd2
  * @return extended message
  * @throws FieldException
  * @throws IOException
  */
 public Msg makeExtendedMessage(byte flags, byte cmd1, byte cmd2)
     throws FieldException, IOException {
   Msg m = Msg.s_makeMessage("SendExtendedMessage");
   m.setAddress("toAddress", getAddress());
   m.setByte("messageFlags", (byte) (((flags & 0xff) | 0x10) & 0xff));
   m.setByte("command1", cmd1);
   m.setByte("command2", cmd2);
   int checksum = (~(cmd1 + cmd2) + 1) & 0xff;
   m.setByte("userData14", (byte) checksum);
   return m;
 }
Esempio n. 2
0
 /**
  * Helper method to make standard message, possibly with group
  *
  * @param flags
  * @param cmd1
  * @param cmd2
  * @param group (-1 if not a group message)
  * @return standard message
  * @throws FieldException
  * @throws IOException
  */
 public Msg makeStandardMessage(byte flags, byte cmd1, byte cmd2, int group)
     throws FieldException, IOException {
   Msg m = Msg.s_makeMessage("SendStandardMessage");
   InsteonAddress addr = null;
   if (group != -1) {
     flags |= 0xc0; // mark message as group message
     // and stash the group number into the address
     addr = new InsteonAddress((byte) 0, (byte) 0, (byte) (group & 0xff));
   } else {
     addr = getAddress();
   }
   m.setAddress("toAddress", addr);
   m.setByte("messageFlags", flags);
   m.setByte("command1", cmd1);
   m.setByte("command2", cmd2);
   return m;
 }