Giter VIP home page Giter VIP logo

xbee-java's Introduction

XBee Java Library Maven Central

This project contains the source code of the XBee Java Library, an easy-to-use API developed in Java that allows you to interact with Digi International's XBee radio frequency (RF) modules. This source has been contributed by Digi International.

The project includes the Java source code, unit tests for the library, and multiple examples that show how to use the available APIs. The examples are also available in source code format.

The main features of the library include:

  • Support for Zigbee, 802.15.4, DigiMesh, Point-to-Multipoint, Wi-Fi, Cellular and BLU XBee devices.
  • Support for API and API escaped operating modes.
  • Management of local (attached to the PC) and remote XBee device objects.
  • Discovery of remote XBee devices associated with the same network as the local device.
  • Configuration of local and remote XBee devices:
    • Configure common parameters with specific setters and getters.
    • Configure any other parameter with generic methods.
    • Execute AT commands.
    • Apply configuration changes.
    • Write configuration changes.
    • Reset the device.
  • Transmission of data to all the XBee devices on the network or to a specific device.
  • Reception of data from remote XBee devices:
    • Data polling.
    • Data reception callback.
  • Transmission and reception of IP, IPv6, CoAP and SMS messages.
  • Reception of network status changes related to the local XBee device.
  • IO lines management:
    • Configure IO lines.
    • Set IO line value.
    • Read IO line value.
    • Receive IO data samples from any remote XBee device on the network.
  • Support for explicit frames and application layer fields (Source endpoint, Destination endpoint, Profile ID, and Cluster ID).
  • Support for User Data Relay frames, allowing the communication between different interfaces (Serial, Bluetooth Low Energy and MicroPython).

Start Here

The best place to get started is the XBee Java Library documentation.

How to Contribute

The contributing guidelines are in the CONTRIBUTING.md document.

License

Copyright 2017-2024, Digi International Inc.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, you can obtain one at http://mozilla.org/MPL/2.0/.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Licensing terms for RXTX

GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

See http://www.gnu.org/licenses/lgpl.html

Licensing terms for SLF4J

SLF4J source code and binaries are distributed under the MIT license.

See http://www.slf4j.org/license.html

xbee-java's People

Contributors

daescalona avatar dependabot[bot] avatar diescalo avatar hgonzaledigi avatar hl2308 avatar jbeard6 avatar jlleitschuh avatar mlasevich avatar pedroperez avatar rubenmoral avatar tatianaleon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xbee-java's Issues

Get Device by 64-bit Address

Hello!,

I need get a device by 64-bit address but I get null because my Node ID is null, but I do not understand why compare 64-bit address with NodeID in XBeeNetwork.clas (line 384):

    // Look in the 64-bit map.
        for (RemoteXBeeDevice remote : remotesBy64BitAddr.values()) {
            if (remote.getNodeID().equals(id))
                return remote;
        }

Should not it be something like?

    // Look in the 64-bit map.
        for (RemoteXBeeDevice remote : remotesBy64BitAddr.values()) {
            if (remote.getXbee64BitAddress().equals(id))
                return remote;
        }

As it is now I think I'll have to put the 64-bit address in the NodeID, is it so?

Sorry my english.

Best regards.

java.lang.IllegalArgumentException: RSSI value must be between 0 and 100.

Every couple hours of running I get this error and I am not sure where it is happening as I am not creating a RX16Packet. Need help to debug it.

Exception in thread "Thread-4" java.lang.IllegalArgumentException: RSSI value must be between 0 and 100.
at com.digi.xbee.api.packet.raw.RX16Packet.(RX16Packet.java:131)
at com.digi.xbee.api.packet.raw.RX16Packet.createPacket(RX16Packet.java:104)
at com.digi.xbee.api.packet.XBeePacketParser.parsePayload(XBeePacketParser.java:299)
at com.digi.xbee.api.packet.XBeePacketParser.parsePacket(XBeePacketParser.java:194)
at com.digi.xbee.api.connection.DataReader.run(DataReader.java:409)

No such port: /dev/ttyAMA0

Hello,

I have this code to attempt to communicate with the local XBee I have connected to a Raspberry Pi but I get this error:

http://pastebin.com/AKGYBNjB

Jun 08, 2015 6:50:57 AM com.digi.xbee.api.XBeeDevice open
INFO: [/dev/ttyAMA0 - 9600/8/N/1/N] Opening the connection interface...
WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
Error opening localXBee com.digi.xbee.api.exceptions.InvalidInterfaceException: No such port: /dev/ttyAMA0

But if I use Screen I can run AT commands.

sudo screen /dev/ttyAMA0 9600

+++
OK
ATSL
ATSH
etc....

What I can try to solve this?

Regards

Node Identification Indicator (0x95) XBeeAPIPacket in the future?

Are there any plans to create an Node Identifier packet in the future? I've got my endpoint nodes sleeping very long periods (several hours with waking time just long enough to send sensor data because they run on very small batteries and depend on small solar cells to recharge) so the standard network discovery doesn't seem applicable.

I've set the endpoints to send their node identification packets upon association, and that helps my server identify them and figure which NI goes with which 16-bit address.

I've got a hack together right now that just pulls apart the payload of the UnknownXBeePacket and figures things out manually, so I'm not stuck. But I thought I would write this as a +1 for having that part of the API represented. (I could try writing it if the authors would welcome the pull request....)

XBee Pro 868 with XBeeJavaLibrary

Hello,

I'm testing with this code, attempt to communicate a Coordinator with a endDevice:

import com.digi.xbee.api.DigiPointDevice;
import com.digi.xbee.api.DigiPointNetwork;
import com.digi.xbee.api.RemoteDigiPointDevice;
import com.digi.xbee.api.RemoteXBeeDevice;
import com.digi.xbee.api.exceptions.TimeoutException;
import com.digi.xbee.api.exceptions.XBeeException;
import com.digi.xbee.api.io.IOLine;
import com.digi.xbee.api.io.IOValue;
import com.digi.xbee.api.models.XBee64BitAddress;

private DigiPointDevice localXBee;
private DigiPointNetwork xbeeNetwork;
private RemoteDigiPointDevice selectedNode;
private RemoteDigiPointDevice node6;

// Initialize a local XBee (coordinator)
localXBee = new DigiPointDevice("/dev/ttyUSB0", 9600);
try {
localXBee.open();
} catch (XBeeException e) {
System.out.println("Error opening localXBee " + e);
}

  if(localXBee.isOpen()) {
        // Obtain the remote XBee device from the XBee network.
            xbeeNetwork = (DigiPointNetwork) localXBee.getNetwork();

      // Instantiate the remotes XBee devices
            XBee64BitAddress node6Address = new XBee64BitAddress("0013A20040A2C795");
            node6 = new RemoteDigiPointDevice(localXBee, node6Address);
            xbeeNetwork.addRemoteDevice(node6);

I tried with API 1 and 2, but get this error.

node.setDIOValue(IOLine.DIO0_AD0, IOValue.HIGH);

may 02, 2015 1:21:42 PM com.digi.xbee.api.XBeeDevice open
INFORMACIÓN: [/dev/ttyUSB0 - 9600/8/N/1/N] Opening the connection interface...
WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyUSB0
may 02, 2015 1:21:42 PM com.digi.xbee.api.XBeeDevice open
INFORMACIÓN: [/dev/ttyUSB0 - 9600/8/N/1/N] Connection interface open.
com.digi.xbee.api.exceptions.TimeoutException: There was a timeout while executing the requested operation.
at com.digi.xbee.api.AbstractXBeeDevice.sendXBeePacket(AbstractXBeeDevice.java:991)
at com.digi.xbee.api.AbstractXBeeDevice.sendATCommand(AbstractXBeeDevice.java:806)
at com.digi.xbee.api.AbstractXBeeDevice.sendParameter(AbstractXBeeDevice.java:1985)
at com.digi.xbee.api.AbstractXBeeDevice.setParameter(AbstractXBeeDevice.java:1908)
at com.digi.xbee.api.AbstractXBeeDevice.setDIOValue(AbstractXBeeDevice.java:1294)

What am I doing wrong?

Best regards

Consider using nrjavaserial

I was playing with samples and having a need to put native libs somewhere with -Djava.library.path is just so inconvenient. I quickly played with rxtx port in github.com/NeuronRobotics/nrjavaserial and it seem to work quite well and doesn't require to set library path manually.

Just switching those rxtx jars resulted MethodNotFoundException which is probably because current rxtx libs are so old on a byte level. I copied(without any modifications) SerialPortRxTx out from xbee sources order to compile against nrjavaserial and things worked well. I used copied SerialPortRxTx as a custom serial implementation.

Stepper Motor Driver Semiconductor to XBee Pro 868

Hello,

I use XBee Pro 868 with JavaXBeeLibrary in API Mode 2.

I need to control two stepper motors and a linear actuator.(But possibly need to use any more).

You know some Stepper Motor Driver chip that can be connected directly to the XBee to control these motors?

I've seen some models but not sure that can be used for this scenario.

DRV8825
http://www.ti.com/product/drv8825?keyMatch=drv8825&tisearch=Search-EN-Everything

DRV8842
http://www.ti.com/product/drv8842

Will any of these models serve for what I want to do?

Best regards

RXTX serial library crashing on closing port in macOS

Case ID: 00278849

We are experiencing problems on macOS when using the latest version of the RXTX serial library with Digi’s XBee Java library:

  • macOS version: 10.11.6
  • XBee Java library version 1.2.0
  • RXTX serial library version 2.2

I’ve attached the error log. Apple identifies the problem as [librxtxSerial.jnilib+0x312f] Java_gnu_io_RXTXPort_interruptEventLoop+0x6b in the error log.

It happens on closing the serial port with the RXTX serial library.
It seems like it is related to this post:
I double checked, and I am definitely using the latest version of the RXTX native libraries (version 2.2 pre2).

To prove that it is not my application I reproduced the problem with Digi’s own example code: xbee_java_library/examples/communication/SendDataSample

Here are my XStick driver details as well (from About this MAC > System Report… > Hardware > USB > XStick):

  • Product ID: 0x6001
  • Vendor ID: 0x0403 (Future Technology Devices International Limited)
  • Version: 6.00
  • Speed: Up to 12 Mb/sec
  • Manufacturer: Digi
  • Location ID: 0x14200000 / 6
  • Current Available (mA): 1000
  • Current Required (mA): 100
  • Extra Operating Current (mA): 0

hs_err_pid7372.log.txt

Support AO=3?

I have a question. Is this library have plan to support explicit with ZDO frame API mode? That will help me use ZB S2 module to talk with other standard Zigbee device. Thanks.

XBeeDevice open timeout

I use the XBee S2 module as zigbee coorinator, it works find.
But since I setting serial D6 as RTS flow control pin, I cant open the xbee device and get below exceptions.

[main] INFO com.digi.xbee.api.XBeeDevice - [COM21 - 115200/8/N/1/N] Connection interface open.
[main] ERROR com.digi.xbee.api.XBeeDevice - There was a timeout while executing the requested operation.
com.digi.xbee.api.exceptions.TimeoutException: There was a timeout while executing the requested operation.
at com.digi.xbee.api.XBeeDevice.enterATCommandMode(XBeeDevice.java:414)
at com.digi.xbee.api.XBeeDevice.determineOperatingMode(XBeeDevice.java:364)
at com.digi.xbee.api.XBeeDevice.open(XBeeDevice.java:207)
at sm.net.xbee.XBeeConn.Open(XBeeConn.java:183)
at smarterme.Main.main(Main.java:86)
[main] INFO com.digi.xbee.api.XBeeDevice - [COM21 - 115200/8/N/1/N] Connection interface closed.
com.digi.xbee.api.exceptions.InvalidOperatingModeException: Could not determine operating mode.
at com.digi.xbee.api.XBeeDevice.open(XBeeDevice.java:212)
at sm.net.xbee.XBeeConn.Open(XBeeConn.java:183)
at Main.main(Main.java:86)
java.lang.Exception: XBee open failed
at Main.main(Main.java:88)
[main] INFO com.digi.xbee.api.XBeeDevice - [COM21 - 115200/8/N/1/N] Connection interface closed.

Does any one known how to slove this issue? Thanks.
My library version is 1.0.1, API mode=1

Error compiling Maven project with XBeeJavaLibrary "cannot access android.content.Context"

I'm having trouble trying to compile a maven project that uses the XBeeJavaLibrary.

mvn clean compile assembly:single

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building daemon 0.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ daemon ---
[INFO] Deleting /daemon/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ daemon ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /daemon/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ daemon ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 24 source files to /daemon/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /daemon/src/main/java/io/daemon/App.java:[51,31] cannot access android.content.Context class file for android.content.Context not found
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.859 s
[INFO] Finished at: 2017-01-27T15:56:25-02:00
[INFO] Final Memory: 19M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project daemon: Compilation failure
[ERROR] /daemon/src/main/java/io/daemon/App.java:[51,31] cannot access android.content.Context
[ERROR] class file for android.content.Context not found
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

I checked the

XBeeDevice.class

file in the library and there's
import android.content.Context;

But i don't use Android here.

Anyway to bypass this ?

exceptions.TimeoutException: There was a timeout while executing the requested operation.

Hello to everyone,

i have a xbee and i what to use this java library but i have one problem i got a error:

com.digi.xbee.api.exceptions.TimeoutException: There was a timeout while executing the requested operation.
at com.digi.xbee.api.AbstractXBeeDevice.sendXBeePacket(AbstractXBeeDevice.java:989)
at com.digi.xbee.api.AbstractXBeeDevice.sendATCommand(AbstractXBeeDevice.java:804)
at com.digi.xbee.api.AbstractXBeeDevice.sendParameter(AbstractXBeeDevice.java:1983)
at com.digi.xbee.api.AbstractXBeeDevice.getParameter(AbstractXBeeDevice.java:1925)
at com.digi.xbee.api.AbstractXBeeDevice.readIOSample(AbstractXBeeDevice.java:1781)
at com.digi.xbee.api.AbstractXBeeDevice.getDIOValue(AbstractXBeeDevice.java:1334)
at xbee_discover.XBEE_DISCOVER$UpdateOutputTask.run(XBEE_DISCOVER.java:140)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)

the code:
..............................
..............................
setDIOTimer1.scheduleAtFixedRate(new UpdateOutputTask(remote_dev1), 0,5000);
setDIOTimer2.scheduleAtFixedRate(new UpdateOutputTask(remote_dev2), 5000,10000);
setDIOTimer3.scheduleAtFixedRate(new UpdateOutputTask(remote_dev3), 10000,20000);

    } catch (XBeeException e) {
        System.out.println(e);
        myDevice.close();
        System.exit(1);
    }
}

private static class UpdateOutputTask extends TimerTask {

    private final RemoteXBeeDevice remoteDevice;

    public UpdateOutputTask(RemoteXBeeDevice remote) {            
        this.remoteDevice = remote;
    }

    @Override
    public void run() {


        try {
            if (remoteDevice.getDIOValue(IOLine.DIO3_AD3) == IOValue.HIGH) {
                remoteDevice.setDIOValue(IOLine.DIO3_AD3, IOValue.LOW);
            } else {
                remoteDevice.setDIOValue(IOLine.DIO3_AD3, IOValue.HIGH);
            }
        } catch (XBeeException ex) {
            Logger.getLogger(XBEE_DISCOVER.class.getName()).log(Level.SEVERE, null, ex);
        }


    }
}

Why i get this exception and how to solve?

Could not determine operating mode @ XBee-PRO 900HP module

The connection with a XBee-PRO 900HP module is not possible with XBeeJavaLib v.1.1.1, since the Java application return the following exception:
com.digi.xbee.api.exceptions.InvalidOperatingModeException: Could not determine operating mode.
at com.digi.xbee.api.XBeeDevice.open(XBeeDevice.java:218)

The COM port selected into the Java code is right.
A test on Linux platform has been also done, but nothing work.
The only way is to open XCTU and let him to discover the module, and then the module will be available and it works, but if the module is powered off and the powered on, the issue still remain.

How is possible to solve this issue?

Clean maven dependencies

When pulling dependency com.digi.xbee:xbee-java-library:1.2.0 maven complains missing deps for

org.rxtx:rxtx:2.2
org.rxtx:rxtx-native:2.2
com.digi:android-sdk:5.1.1
com.digi:android-sdk-addon:3

Looks like for rxtx latest release is 2.1.7 so I don't know where you got 2.2. Also you should not define dependencies(use dependency management) in a parent pom as those are probably needed only in samples(well looks like android sample was moved away).

Issues (with solutions) found when updating a Java project from V1.1.1 to V1.2.0.

I am one of the developers for the JMRI project ( https://github.com/JMRI/ ). Last week, we started
the process of upgrading our XBee device support from XBeeJavaLibrary 1.1.1 to XBeeJavaLibrary 1.2.0.

We discovered several issues that appeared when testing that we didn't expect based on the description of the changes in the release notes and the JavaDoc.

First, and most importantly, the XBee libraries use SLF4J to log to JUL (java.util.logging) (also called JDK14 because that is when that logging mechanism was introduced); JMRI uses SLF4J to log to Log4J. SLF4J doesn't like this because there are two logging mechanisms defined.

The short term solution to this problem is to excluding the slf4j-jdk14 dependency in our maven configuration.

The real issue here is actually that the XBee library is mis-configured to require that incorporating projects use JUL logging. ( see https://github.com/digidotcom/XBeeJavaLibrary/blob/master/pom.xml#L223 which establishes the dependency on logging via JUL.)

The long term solution to this problem is to either:

  1. remove the dependency on slf4j-jdk14
  2. change the scope of the dependency on slf4j-jdk14 to test
  3. mark the dependency on slf4j-jdk14 as optional

We believe option 3 is preferred unless the XBeeLibrary only needs slf4j-jdk14 for tests (We don't know if its needed for any example code to function). (see http://maven.apache.org/pom.html#Dependencies for more on this)

Second, There were several findbugs errors in our code that were not present before the version 1.2.0 library was added to the project. We narrowed the issue down to the inclusion of android support by the Digi library.

We were able to eliminate these findbugs warnings by excluding the android-sdk and android-sdk-addon dependencies in our maven configuration.

Finally, When we implemented support for version 1.1.1, we mocked the XBeeDevice object in some of our tests using powermockito. Powermockito had issues with the version 1.2.0 library finding android.content.Context due to the new constructors in the XBeeDevice class that expect android.content.Context objects. In order to work around this, we are now mocking our class that implements IConnectionInterface and then calling the XBeeDevice constructor that expects an IConnectionInterface object.

The relevant portion of our maven pom.xml file (addressing the first two issues above) is copied below

     <dependency>
        <groupId>com.digi.xbee</groupId>
        <artifactId>xbee-java-library</artifactId>
        <version>1.2.0</version>
        <exclusions>
           <exclusion> 
              <groupId>org.slf4j</groupId>
              <artifactId>slf4j-jdk14</artifactId>
           </exclusion>
           <exclusion>
              <groupId>com.digi</groupId>
              <artifactId>android-sdk</artifactId>
           </exclusion>
           <exclusion>
              <groupId>com.digi</groupId>
              <artifactId>android-sdk-addon</artifactId>
           </exclusion>
        </exclusions>
     </dependency>

Compile XBJLib with Gradle

Hi!,

In Bintray url 'http://dl.bintray.com/digidotcom/maven'

I use 1.0.1 version, compile 'com.digi.xbee:xbjlib:1.0.1'

But not works with rxtx-2.1.7 version. compile 'org.rxtx:rxtx:2.1.7'

:compileJava
FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':compileClasspath'.
> Could not find org.rxtx:rxtx:2.2.
  Searched in the following locations:
      https://jcenter.bintray.com/org/rxtx/rxtx/2.2/rxtx-2.2.pom
      https://jcenter.bintray.com/org/rxtx/rxtx/2.2/rxtx-2.2.jar
      file:/home/user/.m2/repository/org/rxtx/rxtx/2.2/rxtx-2.2.pom
      file:/home/user/.m2/repository/org/rxtx/rxtx/2.2/rxtx-2.2.jar
      https://repo1.maven.org/maven2/org/rxtx/rxtx/2.2/rxtx-2.2.pom
      https://repo1.maven.org/maven2/org/rxtx/rxtx/2.2/rxtx-2.2.jar
      http://dl.bintray.com/digidotcom/maven/org/rxtx/rxtx/2.2/rxtx-2.2.pom
      http://dl.bintray.com/digidotcom/maven/org/rxtx/rxtx/2.2/rxtx-2.2.jar
  Required by:
      :MissionFX:unspecified > com.digi.xbee:xbjlib:1.0.1
> Could not find org.rxtx:rxtx-native:2.2.
  Searched in the following locations:
      https://jcenter.bintray.com/org/rxtx/rxtx-native/2.2/rxtx-native-2.2.pom
      https://jcenter.bintray.com/org/rxtx/rxtx-native/2.2/rxtx-native-2.2-win32_x86.jar
      file:/home/user/.m2/repository/org/rxtx/rxtx-native/2.2/rxtx-native-2.2.pom
      file:/home/user/.m2/repository/org/rxtx/rxtx-native/2.2/rxtx-native-2.2-win32_x86.jar
      https://repo1.maven.org/maven2/org/rxtx/rxtx-native/2.2/rxtx-native-2.2.pom
      https://repo1.maven.org/maven2/org/rxtx/rxtx-native/2.2/rxtx-native-2.2-win32_x86.jar
      http://dl.bintray.com/digidotcom/maven/org/rxtx/rxtx-native/2.2/rxtx-native-2.2.pom
      http://dl.bintray.com/digidotcom/maven/org/rxtx/rxtx-native/2.2/rxtx-native-2.2-win32_x86.jar
  Required by:
      :MissionFX:unspecified > com.digi.xbee:xbjlib:1.0.1

Where can I find the 2.2 and native-2.2 versions?

Best regards,
Javier

Exception thrown when opening an XBee device configured in API 2

When a module is configured to use API 2 (API Mode with Escapes), that is AP = 2, an exception is thrown when opening the device and reading the device information.

Using the SendDataSample example of the XBee Java Library v1.0.1, this is what is printed out:

 +--------------------------------------+
 |  XBee Java Library Send Data Sample  |
 +--------------------------------------+

WARNING:  RXTX Version mismatch
    Jar version = RXTX-2.2pre1
    native lib Version = RXTX-2.2pre2
Error
com.digi.xbee.api.exceptions.TimeoutException: There was a timeout while executing the requested operation.
    at com.digi.xbee.api.AbstractXBeeDevice.sendXBeePacket(AbstractXBeeDevice.java:989)
    at com.digi.xbee.api.AbstractXBeeDevice.sendATCommand(AbstractXBeeDevice.java:806)
    at com.digi.xbee.api.AbstractXBeeDevice.sendParameter(AbstractXBeeDevice.java:1983)
    at com.digi.xbee.api.AbstractXBeeDevice.getParameter(AbstractXBeeDevice.java:1925)
    at com.digi.xbee.api.AbstractXBeeDevice.readDeviceInfo(AbstractXBeeDevice.java:365)
    at com.digi.xbee.api.XBeeDevice.open(XBeeDevice.java:219)
    at com.digi.xbee.api.senddata.MainApp.main(MainApp.java:55)

IOSampleListener duplicating readings

This issue has been banging my head...

I'm building a java program that will be able to open/close my garage door and monitor the respective status.

For this i wrote a initialization class that register an IOSampleListener using this code:

localDevice.addIOSampleListener(new PortaoGaragemListener());

The class PortaoGaragemListener.java is above:

public class PortaoGaragemListener implements IIOSampleReceiveListener{

  private static final Logger logger = LoggerFactory.getLogger(PortaoGaragemListener.class.getName());

  @Override
  public void ioSampleReceived(RemoteXBeeDevice remoteDevice, IOSample ioSample) {
    byte[] rssi = ByteUtils.intToByteArray(0);
    RegistroNotificacaoDao registroNotificacaoDao = new RegistroNotificacaoDao();
    String msgAberto = "Portão aberto";
    String msgFechado = "Portão fechado";
    try{
      rssi = remoteDevice.getParameter("DB");
      logger.info("Remote RSSI: " + ByteUtils.byteArrayToInt(rssi) + " dBm");
      if (ioSample.getDigitalValue(IOLine.DIO4_AD4).toString() == "High"){
        logger.info(msgAberto);
        registroNotificacaoDao.registraNotificacao(msgAberto, 3, 1);
      }else{
         logger.info(msgFechado);
         registroNotificacaoDao.registraNotificacao(msgFechado, 3, 1);
       }
    }catch(Exception e){
       System.out.println(e);
     }
  }
}

The program works almost fine.

I say almost because sometimes, when I press and release the button, the listener is suddenly called two and sometimes three times.

I'm using log4j2 and this implementation is giving me several debug information of the communication between the two xbees and, I was able to see that the tx/rx is running smoothly when I do not register a listener class but, when I instantiate the listener I got this issue.

My xbee connection is above:

img_9758-640x376

RXTX JNI/.so segfaults on Ubuntu 14

Hi, I wrote myself an application using the XBJL on Mac and it works great. However, I need it to run on a Linux machine, specifically Ubuntu 14.04.

However, no matter what combination of RXTX/JavaComm jars and librxtxSerial.so objects (for x86_64) I use, the best result I get is that there is a seg-fault. I have searched around the internet for a couple days now and have been unable to solve the issue.

I know Digi doesn't develop librxtx, but I was wondering if anyone else had run into this (and solved it)?

My output from the MyFirstXBeeApp.java program is as follows:

WARNING:  RXTX Version mismatch
    Jar version = RXTX-2.2pre1
    native lib Version = RXTX-2.2-20081207 Cloudhopper Build rxtx.cloudhopper.net
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fa1012465da, pid=10699, tid=140330066917120
#
# JRE version: Java(TM) SE Runtime Environment (8.0_60-b27) (build 1.8.0_60-b27)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.60-b23 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [librxtxSerial.so+0x75da]  Java_gnu_io_RXTXPort_nativeDrain+0xea
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/framework/Desktop/MyFirstXBeeApp/hs_err_pid10699.log
[thread 140329484539648 also had an error]
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Get RSSI Value

Hello,

Is possible to get RSSI value with this library?

Best regards.

can this library be used on raspberry pi?

cloned and ran mvn package in directory but the logs seem to show that it compiling for windows 32/64bit is there something im doing wrong or should I specify some parameter to ask it to compile for the native platform please guide me the samples are not compiling due to lack of dependencies though im using maven

App doesn't work after exporting as JAR

I have made an application in eclipse to send certain messages based on user input. The application works fully when run in Eclipse. When I try to export the app as a runnable JAR file, I can still use the interface i made, but trying to send the frame does not work.

I have tried all three options under "Library handling". Is there another way to run the program without an IDE, or is there an extra step I need to export correctly?

EDIT: I tried running the JAR through the console and recieved this error "java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver". I fixed this by finding rxtxSerial.dll and moving it to the working directory. But I now receive a new error shown below.
image

The mentioned log is here:
hs_err_pid13880.log

EDIT2: I would like to add that this same issue is true for the example application. I have tried the same steps for MainApp.java as the program that I wrote and they both face the same issue.

XBeeJavaLibrary with Xtend-PKG modem

I'm using XBeeJavaLibrary with 2 Xtend-PKG modems. This is possible because the Xtend modems accept frames type "XBee DigiMesh" (Firmware 8062). I successfully tested the examples SendBroadcastDataSample, SendDataSample, ReceiveDataSample and ReceiveModemStatusSample.

The only change I made in the library code was change the "XBeeProtocol" class. In "determineProtocol" method, where is "return XTEND_DM" I switched to "return DIGI_MESH".

I would like to hear from you if I will find any limitations later. Do you recommend other changes?

ExplicitDataReceiveListener not working

Hi !

I'm not able to receive the packets using the "ExplicitDataReceiveListener".
Are there any known problems with that ?

The "explicitDataReceived" method is never called.

PS: the regular "DataReceiveListener" works fine. But i need the "ExplicitDataReceiveListener" so i can read ClusterID values.

    public static void main(String[] args) {

        DigiMeshDevice xbee = new DigiMeshDevice("COM1", 115200);
		try {
			xbee.open();
			xbee.addExplicitDataListener(new ExplicitDataReceiveListener());
//			xbee.addDataListener(new DataReceiveListener());

		} catch (XBeeException e) {
			e.printStackTrace();
			System.exit(1);
		}
    }
public class ExplicitDataReceiveListener implements IExplicitDataReceiveListener {
	
	@Override
	public void explicitDataReceived(ExplicitXBeeMessage xbeeMessage) {

		System.out.format("From %s >> %s | %s%n", xbeeMessage.getDevice().get64BitAddress(),
				HexUtils.prettyHexString(HexUtils.byteArrayToHexString(xbeeMessage.getData())),
				new String(xbeeMessage.getData()));

		System.out.format(xbeeMessage.getClusterID());
        }
}

sendExplicitData throws timeOutException - but error is really bad address from get16BitAddress..

Hi,

xbjlib-1.1.1

Zigbee IAS Zone end device (not digi) on occasion has different 16bit address than what is returned from ExplicitXBeeMessage getDevice get16BitAddress(). This occurs on different ZEDs from different manufacturers. We experienced issue with non-IASzone devices during bindrequest. I've noticed the ZEDs will sometimes send 2 0x0013 clusters first with address that is same as xbee java call above - the second the addresses differ. Problem occurs also when one 0x0013 is sent from ZED. This issue happens during factory reset or a new device - when we send data to enroll or bind endpoints.

In the case where addresses differ a call to sendExplicitData using the 16bit address from remoteZigbeeDevice will throw a timeOutExpcetion, however the error is transmit status frame 24 (Address not found)
Transmit status frame.
7e 00 07 8b 0a ff fd 0c 24 02 3c

off tty port connected to coordinator. 2 0x0013 from end devices.

7e 00 1e 91 00 0d 6f 00 0e ad e0 98 08 34 00 00 00 13 00 00 02 81 34 08 98 e0 ad 0e 00 6f 0d 00 80 82 -- announce
7e 00 1e 91 00 0d 6f 00 0e ad e0 98 57 0f 00 00 00 13 00 00 02 82 0f 57 98 e0 ad 0e 00 6f 0d 00 80 2d -- announce

1st announce -- 16 bit address is correct
81 - 34 08 -- 98 E0 AD 0E 00 6F 0D 00 -- 80
2nd announce -- 16 bit address changed - xbee remoteDevice still has old address
82 - 0F 57 -- 98 E0 AD 0E 00 6F 0D 00 -- 80
remoteZigbeeDevice.get16BitAddress() returns following...
08 34

this is one 0x0013 with different addresses in payload and remoteXbeeDevice
---------------------NEW MESSAGE------------------------------------
Explicit Message: request : clsid: 13, prof: 0, src-ep: 0, dest-ep: 0
Remote 64BitAddress 000D6F000EADE098
Remote 16BitAddress 10AB
Payload 82 - 43 85 - 98 E0 AD 0E 00 6F 0D 00 -- 80
The correct 16Bit address is 8543 (above are little endian)

We coded around the issue by caching and using the correct address in payload. Once the devices are enrolled no issues - devices work correctly. However, we have not attempted to send messages after enrollment.

Has anyone experienced this behavior?

IOSample.getDigitalValue should not throw IllegalArgumentException on missing values

Without adding slf4j configuration, or wrapping code in a try/catch block, a naive user's code will silently fail inside an IIOSampleReceiveListener when trying to access the values of pins which are not reported. For example: (some illustrative pseudo-code, not entirely-correct Java)

// Import statements

void main() {
    XBeeDevice device = new XBeeDevice("COM1", 9600);
    try {
        device.open();
    catch (Exception e) {
        e.printStackTrace();
        System.exit(1);
    }
    device.addIOSampleListener(new IIOSampleReceiveListener() {
        @Override
        public void ioSampleReceived(... ioSample) {
            if (ioSample.getDigitalValue(IOLine.DIO0_AD0) == IOValue.LOW) {
                handleD0Pressed();
            }
        }
    });
}

void handleD0Pressed() {
    // ...
}

If an IO sample comes in without a value for DIO0, then ioSample.getDigitalValue(IOLine.DIO0_AD0) will throw an IllegalArgumentException, as follows:

java.lang.IllegalArgumentException: DIO0 does not have a digital value.
          at com.digi.xbee.api.io.IOSample.getDigitalValue(IOSample.java:347)
          ...

...but the only way you'll know that that exception was raised, is to wrap the contents of your listener in a try/catch block.

I would expect getDigitalValue to return null (or a different IOValue value, like UNKNOWN or NOT_REPORTED) when the value is not present, as opposed to raising this exception. This way, straightforward code like in my example above, and right below, will work without extra boilerplate or error handling.

if (ioSample.getDigitalValue(IOLine.DIO0_AD0) == IOValue.LOW) {
    handleButtonPressed();
} else if (ioSample.getDigitalValue(IOLine.DIO0_AD0) == IOValue.HIGH) {
    handleButtonNotPressed();
}

ioSample.hasDigitalValue is still useful then, and would be used to prevent a NullPointerException or to drive logic around a remote XBee not reporting required values.


If the above request is turned down, then I would recommend using a more semantic exception class than IllegalArgumentException (e.g. "DigitalValueNotReportedException"). As per that class's JavaDoc, it is:

Thrown to indicate that a method has been passed an illegal or inappropriate argument.

Asking for the value of a particular DIO line is perfectly valid for the getDigitalValue method. The value itself might be missing, but it should be more straightforward to find that out (e.g. with a sentinel IOValue value, or null).

Facing issues connecting XBee with Android OS

Hello I am using SX development board with onboard XBee-Pro SX RF pad module for connecting to the android device and send message. I am facing issues, not able to even open connection. It throws error. Does the library support XBee Pro SX rf module? it is the latest XBee version released.

RE: THT Grove Development Board and https://github.com/digidotcom/XBeeJavaLibrary/releases/tag/v1.2.1

Hello,

My name is Seth. I got a Wireless Connectivity Kit. It has two THT Grove Development Boards and two XBee S1 modules. Currently, I am a starter. I am starting out with NetBeans and software development for these Xbee modules.

I tried: https://github.com/digidotcom/XBeeJavaLibrary/releases/tag/v1.2.1 and the older model of the software v1.1.1.

Now, I followed the instructions to the T. I have tried over and over again. Here is my read out from running the software with my THT Grove Development boards attached and communicating via NetBeans.

run:
+-----------------------------------------------+
|          Receive Digital Data Sample          |
+-----------------------------------------------+

java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading 
gnu.io.RXTXCommDriver
Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
 	    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:123)
    at com.digi.xbee.api.connection.serial.SerialPortRxTx.open(SerialPortRxTx.java:165)
    at com.digi.xbee.api.XBeeDevice.open(XBeeDevice.java:334)
    at com.digi.xdmk.receivedigitaldata.MainApp.main(MainApp.java:54)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Although I am reaching a successful build, at least this is what is printed in my terminal, my info. (packets) on the XCTU is not distinguishable.

Seth

P.S. If you or someone you know are having complications reading an i2c device on DIO1 with this specific development board, please let me know. Please add some feedback if you can. I posted on the Digi Forum like the instructions said but I have not been accepted for posting yet (for some reason).

HTTP Bug

Hello,

I have encountered a weird bug when using the XBeeJavaLibrary and HTTP. I am developing an application with an XBee connected to a PC that is supposed to collect data from some sensors. The data should be persisted in a remote database (Apache Jena) which I have to use HTTP for. Usually that should not be the problem since the database API offers some nice abstractions, which at the end wraps up and HTTP Post and sends it to the database.
If I want to use that abstraction, or any of Apache HTTP for that matter, the implementation does not work because of a runtime error stating the message "Stub!". After some debugging it turns out that by default the HTTP implementation from Apache located in the android sdk that is shipped with the xbee library is used, instead of the one I am providing through gradle. And in that (android) implementation the classes used in the PC-version of the HTTP library are all deprecated and just throw a runtime exception as a hint that they are deprecated.
When looking deeper into the code it turns out that at some point the types are pointing towards the android sdk. The imports in those classes just point to "org.apache...". At this point the JVM behaves silly: since there are technically two packages with the same name in the classpath it just resovles the first one, in my case the android one, since it is located in a "com" package rather then a "org" package. Does this mean that you can not use the xbee library with anything that it might collide with in the android sdk?

I really like the XBee devices and the library, since there are easy to use, which makes it handy when it comes to teaching (I am working at an embedded systems departement at a university). I have used the last version of the library before and I would like to continue using it, but not having the ability to use HTTP kind of defeats the purpose, especially in an Internet of Things context.

Do you have any suggestions, help insights?

Regards,
Prometheus

jSSC (Java Simple Serial Communicator)

Hi,

Currently, you use RXTX to communicate with the devices. Have you consider using jSSC instead ?

With RXTX you always need to install the native library and link it to your java project. With jSSC the native library is embedded in the java library. It's very easy to use. I was used to RXTX but now I'm only using jSSC and I'm not disappointed. For instance, Universal GCode sender made the same choice.

Cheers

Gaetan

Can I make the classes implements Serializable?

Hello to every one,

I have same problem so I need same help!I write a xbee gateway so I can received xbee packet from nodes and send via tcp to central server.I use apache mina for TCP server and client.My gateway is linux base and I create a class TCPMessage that have same int type of message and Object message(that will be the data from gateway to server).Type of message use to know what type is the object message so I can cast later.
Example i received RemoteXBeeDevice and I want to send to server by tcp but the problem is that RemoteXBeeDevice class not Serializable.How to solve this problem?

Thanks for all your help!!!

XBee Pro 868 with XBeeJavaLibrary

Hello,

I'm testing with this code, attempt to communicate a Coordinator with a endDevice:

import com.digi.xbee.api.DigiPointDevice;
import com.digi.xbee.api.DigiPointNetwork;
import com.digi.xbee.api.RemoteDigiPointDevice;
import com.digi.xbee.api.exceptions.TimeoutException;
import com.digi.xbee.api.exceptions.XBeeException;
import com.digi.xbee.api.io.IOLine;
import com.digi.xbee.api.io.IOValue;
import com.digi.xbee.api.models.XBee64BitAddress;

private DigiPointDevice localXBee;
private DigiPointNetwork xbeeNetwork;
private RemoteDigiPointDevice node;

// Initialize a local XBee (coordinator)
localXBee = new DigiPointDevice("/dev/ttyUSB0", 9600);
try {
localXBee.open();
} catch (XBeeException e) {
System.out.println("Error opening localXBee " + e);
}

  if(localXBee.isOpen()) {
        // Obtain the remote XBee device from the XBee network.
            xbeeNetwork =  (DigiPointNetwork) localXBee.getNetwork();

      // Instantiate the remotes XBee devices
            XBee64BitAddress nodeAddress = new XBee64BitAddress("0013A20040A2C792");
            node6 = new RemoteDigiPointDevice(localXBee, nodeAddress);
            xbeeNetwork.addRemoteDevice(node);

I tried with API 1 and 2, but get this error.

node.setDIOValue(IOLine.DIO0_AD0, IOValue.HIGH);

may 02, 2015 1:21:42 PM com.digi.xbee.api.XBeeDevice open
INFORMACIÓN: [/dev/ttyUSB0 - 9600/8/N/1/N] Opening the connection interface...
WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyUSB0
may 02, 2015 1:21:42 PM com.digi.xbee.api.XBeeDevice open
INFORMACIÓN: [/dev/ttyUSB0 - 9600/8/N/1/N] Connection interface open.
com.digi.xbee.api.exceptions.TimeoutException: There was a timeout while executing the requested operation.
at com.digi.xbee.api.AbstractXBeeDevice.sendXBeePacket(AbstractXBeeDevice.java:991)
at com.digi.xbee.api.AbstractXBeeDevice.sendATCommand(AbstractXBeeDevice.java:806)
at com.digi.xbee.api.AbstractXBeeDevice.sendParameter(AbstractXBeeDevice.java:1985)
at com.digi.xbee.api.AbstractXBeeDevice.setParameter(AbstractXBeeDevice.java:1908)
at com.digi.xbee.api.AbstractXBeeDevice.setDIOValue(AbstractXBeeDevice.java:1294)

What am I doing wrong?

Best regards

WARNING: RXTX Version mismatch

I have followed the instructions for Getting started with XBee Java Library here: https://www.digi.com/resources/documentation/digidocs/90001438/Default.htm

When attempting to run the example program in eclipse I get the following output.
xbee example error
And the receiver will receive what is shown no matter what message I try to send.
2018-03-19 14_33_25-

I have previously used these two devices to communicate, the sender connected to XCTU and the receiver connected to an arduino, so the settings on each device should be correct. Any help in solving these errors would be appreciated.

Setting ID network parameter bug?

First of all when I use either the RemoteXBeeDevice class or RemoteATCommandPacket class, for example, if I set the paremater value to "BB". When I check the new value on the remote, it has the value of "B0B". So the set value is different.

Also I don't know how to "WRITE" the changes after changing that parameter ("the Network ID"). I know it's because the remote it's already on the new set network, but I need a way to send also the "write changes" command at the same time.

This is how I am sending the instruction:
remote.setPANID(new byte[]{(byte)0xB, (byte)0xB});
or
RemoteATCommandPacket packet = new RemoteATCommandPacket(1, remote.get64BitAddress(), remote.get16BitAddress(), XBeeTransmitOptions., "ID", new byte[]{(byte)0xB, (byte)0xB});

Invalid phone number when receiving text message from provider

When I am receiving text messages from my mobile provider (KPN in Netherlands) the phone number cannot be parsed and an error is thrown:
"Phone number invalid, only numbers and '+' prefix allowed"
This is caused by the fact that in TXSMSPacket.java the phone number is matched against:
"^\+?\d+$"
Since the phone number field from my provider apparently contains the text "KPN" a text message from this provider can never be received.

RXTX POM incomplete

I get the following errors building a project that depends on this library:

Downloading: file:///Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/lib/org/rxtx/rxtx/2.2/rxtx-2.2.pom
Downloading: https://repo.maven.apache.org/maven2/org/rxtx/rxtx/2.2/rxtx-2.2.pom
Downloading: http://ftp1.digi.com/support/m-repo/org/rxtx/rxtx/2.2/rxtx-2.2.pom
[WARNING] The POM for org.rxtx:rxtx:jar:2.2 is missing, no dependency information available
Downloading: file:///Users/rhwood/Developer/JMRI/JMRI/rhwood/JMRI/lib/org/rxtx/rxtx-native/2.2/rxtx-native-2.2.pom
Downloading: https://repo.maven.apache.org/maven2/org/rxtx/rxtx-native/2.2/rxtx-native-2.2.pom
Downloading: http://ftp1.digi.com/support/m-repo/org/rxtx/rxtx-native/2.2/rxtx-native-2.2.pom
[WARNING] The POM for org.rxtx:rxtx-native:jar:macosx:2.2 is missing, no dependency information available

This happens for every build, but all other dependencies were downloaded once and reused. Can you please fix the RXTX POM or use an alternate RXTX release such as http://search.maven.org/#artifactdetails%7Corg.bidib.jbidib%7Cjbidibc-rxtx-2.2%7C1.6.0%7Cjar

Send large file

Hello,

I need to send an image (100 KB) once a day. What is the best strategy to send a large file? Could you provide an example?

Best regards.

Provide better error handling for too large payloads

As it is known fact that if you try to send payload which is too large for protocol in use, api will simply throw TimeoutException. It'd be extremely nice if digi lib would throw something like IllegalPayloadException if size is not supported. I'm not exactly sure how easy it is to know from an api perspective what is max supported payload size but if there is a way then digi's lib would be a place to impose that restriction.

I'm trying to make higher level library atop of digi and will try to make a protocol of some sort to be able to send larger payload by splitting and then reconstructing those on the other side. Not going crazy on this but I would not want to impose there size restrictions in my code as digi as a maintainer should know limits.

I was a little surprised that while testing too large payload using xctu, too large payload is simply dropped without any errors. I think same happens with java lib and is a bit inconvenient as you only get:

com.digi.xbee.api.exceptions.TimeoutException: There was a timeout while executing the requested operation.
	at com.digi.xbee.api.AbstractXBeeDevice.sendXBeePacket(AbstractXBeeDevice.java:1237) ~[xbee-java-library-1.2.0.jar!/:1.2.0]
	at com.digi.xbee.api.AbstractXBeeDevice.sendAndCheckXBeePacket(AbstractXBeeDevice.java:1401) ~[xbee-java-library-1.2.0.jar!/:1.2.0]
	at com.digi.xbee.api.XBeeDevice.sendData(XBeeDevice.java:853) ~[xbee-java-library-1.2.0.jar!/:1.2.0]
	at com.digi.xbee.api.XBeeDevice.sendBroadcastData(XBeeDevice.java:994) ~[xbee-java-library-1.2.0.jar!/:1.2.0]

You don't know if it's a real timeout or too large payload.

java.lang.NullPointerException: 64-bit address cannot be unknown.

Hello!!
I have this problem:

Exception in thread "Thread-2" java.lang.NullPointerException: 64-bit address cannot be unknown. at com.digi.xbee.api.XBeeNetwork.getDevice(XBeeNetwork.java:415) at com.digi.xbee.api.connection.DataReader.getRemoteXBeeDeviceFromPacket(DataReader.java:588) at com.digi.xbee.api.connection.DataReader.packetReceived(DataReader.java:444) at com.digi.xbee.api.connection.DataReader.run(DataReader.java:383)

I used ReceiveDataSample for recive data from arduino with xbee.
Only save data and adreess of xbee.

ReceiveData example doesn't wait for input.

The com.digi.xbee.api.receivedata.MainApp class does provide a visual description of how to register a listener, but I think there's a problem with the example because immediately after registering the listener, the application's main() function simply exits.

I'm writing this as an issue because it's not going to work (and might confused reader) but more importantly I was trying to understand how someone would most appropriately wait for input—i.e. to write a basic server application.

I've been digging through the source code, and I now understand that calling the XBeeDevice's open() method will create the DataReader Thread and call start() on it. That is, I get that this library creates its own thread for handling the packet delivery events, but what should I do with the main thread? Should I just put something like Thread.sleep(10000) in a loop, or should I be calling wait() on the XBeeDevice's getConnectionInterface() object?

Going a little deeper into this, if I were wanting to write something that used the Java EE standards, I'm not supposed to be creating my own threads, but rather using managed threads i.e. implementing Runnable or Callable, right?

Any guidelines on how a person should be creating a basic server-style app for the Coordinator would be appreciated. I.e. if looping on Thread.sleep(someBigNumber) is sufficient and appropriate, that would be great. I just suggest it gets put into the ReceiveData example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.