private boolean isMessageFromMyDevices(byte[] readData){
  int initByte=firstByteOfDeviceId(readData);
  if (initByte < 0 || readData.length < initByte) {
    log.error("Error checking initByte and received length, I can't check If is from 'My devices'");
    return false;
  }
  for (  String knownDevice : knownDevices) {
    int nBytes=knownDevice.length() / 2;
    if (knownDevice.length() % 2 > 0 && knownDevice.length() > 2) {
      nBytes++;
    }
    if (readData.length < (nBytes + initByte)) {
      log.error("Error checking received length, I can't check If is from 'My devices'");
      return false;
    }
    String deviceCode=HexDump.toHexString(readData,initByte,nBytes);
    if (knownDevice.equals(deviceCode))     return true;
 else     log.error("Current Known Device " + knownDevice + " Message Received From "+ deviceCode);
  }
  return false;
}

private boolean isMessageFromMyDevices ( byte [ ] readData ) { int initByte = firstByteOfDeviceId ( readData ) ; if ( initByte < 0 || readData . length < initByte ) { log . error ( "Error checking initByte and received length, I can't check If is from 'My devices'" ) ; return false ; } for ( String knownDevice : knownDevices ) { int nBytes = knownDevice . length ( ) / 2 ; if ( knownDevice . length ( ) % 2 > 0 && knownDevice . length ( ) > 2 ) { nBytes ++ ; } if ( readData . length < ( nBytes + initByte ) ) { log . error ( "Error checking received length, I can't check If is from 'My devices'" ) ; return false ; } String deviceCode = HexDump . toHexString ( readData , initByte , nBytes ) ; if ( knownDevice . equals ( deviceCode ) ) return true ; else log . error ( "Current Known Device " + knownDevice + " Message Received From " + deviceCode ) ; } return false ; }
this method checks if the message received has its source in one of the devices registered .
