Package com.rapplogic.xbee.api.wpan

Examples of com.rapplogic.xbee.api.wpan.TxStatusResponse


      if (response instanceof RxResponse16) {
        handleRxResponse16((RxResponse16) response);
      } else if (response instanceof TxStatusResponse) {
        final Command command = extractCommand(response);
        final String rawBytes = ByteUtils.toBase16(response.getRawPacketBytes());
        final TxStatusResponse txResponse = (TxStatusResponse) response;
        RxData rd;
        if (txResponse.getStatus() == TxStatusResponse.Status.SUCCESS) {
          rd = new RxRawData<String>(null, Status.NORMAL, 0, rawBytes);
          processData(null, UGateEvent.Type.WIRELESS_DATA_TX_STATUS_RESPONSE_SUCCESS, command, rd,
              RS.rbLabel(KEY.SERVICE_TX_RESPONSE_SUCCESS, rd, txResponse.getStatus()));
        } else {
          rd = new RxRawData<String>(null, Status.GENERAL_FAILURE, 0, rawBytes);
          processData(null, UGateEvent.Type.WIRELESS_DATA_TX_STATUS_RESPONSE_FAILED, command, rd,
              RS.rbLabel(KEY.SERVICE_TX_RESPONSE_ERROR, rd, txResponse.getStatus()));
        }
      } else if (response instanceof ErrorResponse) {
        final Command command = extractCommand(response);
        final ErrorResponse errorResponse = (ErrorResponse) response;
        final String rawBytes = ByteUtils.toBase16(response.getRawPacketBytes());
View Full Code Here


      final TxRequest16 request = new TxRequest16(xbeeAddress, bytes);
      message = RS.rbLabel(KEY.SERVICE_WIRELESS_SENDING, bytes, event.getSource().getAddress());
      log.info(message);
      UGateKeeper.DEFAULT.notifyListeners(event.clone(UGateEvent.Type.WIRELESS_DATA_TX, i, message));
      // send the packet and wait up to 12 seconds for the transmit status reply
      final TxStatusResponse response = (TxStatusResponse) xbee.sendSynchronous(request,
          timeout <= 0 ? DEFAULT_WAIT_MILISECONDS : timeout);
      if (response.isSuccess()) {
        // packet was delivered successfully
        message = RS.rbLabel(KEY.SERVICE_WIRELESS_ACK_SUCCESS, bytes, event.getSource().getAddress(), response.getStatus());
        log.info(message);
        UGateKeeper.DEFAULT.notifyListeners(event.clone(UGateEvent.Type.WIRELESS_DATA_TX_ACK, i, message));
      } else {
        // packet was not delivered
        failureCount++;
        message = RS.rbLabel(KEY.SERVICE_WIRELESS_ACK_FAILED, bytes, event.getSource().getAddress(), response.getStatus());
        if (throwRuntimeException) {
          throw new RuntimeException(message);
        } else {
          log.error(message);
        }
View Full Code Here

TOP

Related Classes of com.rapplogic.xbee.api.wpan.TxStatusResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.