Devices

Suitable Nebula devices can be any of the following:

  • Any device with an OS that can run Java. This includes Linux, Windows, Mac, desktop, laptop and local or cloud servers. Single Board Computers (SBC) like Raspberry Pi and Beagleboard are ideal.
  • Any phone, tablet or wearable that runs Android version 4.4.2 or higher.
  • Any WiFi capable device that can be programmed on the Arduino IDE including the popular ESP series of WiFi/BT modules and Arduino compatible SBCs.
  • Sorry not iPhone yet.

Device Class Elements

All elements are String and have associated getter and setter methods.

mDevName – unique authoritative name of the device entered during installation.
mDevAddr – the current IP address of the device.
mDevStat – a hex(1 byte) value bit code holding the current device status.
bit 0 - boolean - device has internet connection
bit 1 - boolean - device is on a LAN
bit 2 - boolean - device is mobile
bit 3 - boolean - device is home
bit 4 - not used
bit 5 - boolean - device address is static
bit 6 - Device is jar(00) || apk(01) || bin(10) || ipa(11)
bit 7 - Device is jar(00) || apk(01) || bin(10) || ipa(11)
mDevId – hex(2 byte) unique device ID assigned and managed by Nebula.

The last 4 elements are for sending mobile SMS commands.
mDevPhone – mobile device phone number and provider email -> SMS URL or “NONE”
mDevEmlHost – mobile device email host URL or “NONE”
mDevEmlAdr – mobile device email address URL or “NONE”
mDevEmlPwd – mobile device email account password or “NONE”

Developer Device Considerations

  • Nebula maintains up to 65,535 devices based on device IDs. Galixsys Andromeda extends that to billions with an extended ID. Careful consideration of network configuration and device lookup is important for commercial users that want to control/monitor a large number of devices. Contact Galixsys Networks for advice on very large networks, you’ll save considerable time and aggravation.
  • Device 1 is special. Review the special considerations here .
  • Device information and current status is collected and maintained by Nebula. A user provides a name for the device which is really only used for convenient identification and Log purpose.
  • Memory requirements - A device occupies between 65 and 200 bytes depending primarily on its name and whether it’s mobile with a long email address. VPN devices are all held in a file and, for APK and JAR, assembled as objects into RAM during Startup . Be especially watchful of BIN devices with limited memory. There are device configuration settings under Tools in the Arduino IDE. User code can be implemented to further reduce what Nebula saves regarding its devices. Generally less than 100 devices on a VPN will not have a memory issue.

Removing Devices from VPN

Nebula has a native command Remove which will:
  1. Remove the device from all other devices on the VPN.
  2. Cause the removed device to delete its Nebula files making it a new device that must be reinstalled.
  3. Add the removed device’s ID back to the pool of available IDs.
  4. Leaves the Nebula application intact on the removed device.
  5. You cannot remove Device 1 with the Remove command.
  • Besides the Remove command you can use one of the following methods. Doing this will leave a “zombie” device on the other VPN devices. The “zombie” device can still be deleted from the VPN using the Remove command from any APK or JAR device still connected to the VPN.

    1. For JAR devices you can delete the ~/Nebula directory of the device. When Nebula is restarted it will come up as a new device to be installed.
    2. For APK devices you can uninstall the Nebula app using the device’s Application Manager then reinstall it using the IDE.
    3. For BIN devices holding pin [D9(Arduino) GPIO-3(ESP module) RX(pin label)] LOW, then power or reset the module. Hold the pin LOW until Yellow On. This causes Nebula to format the SPIFFS memory and removes the device. If the pin is still LOW after the format completes then the WiFi settings are removed too. There is also an Erase Flash setting under Tools of the IDE. The default is “Only Sketch” but you can select “All Flash Contents” to remove the Nebula files. After removal you will have to Install the module.

Adding or Removing Device Elements

There may be an instance where you want to add a new element to the Device class. Adding or removing an element effects several methods within Nebula. How you use the new element is up to you but the following will show where it MUST be added to work in the Nebula environment as supplied by Galixsys Networks.

THE ELEMENT MUST BE ADDED TO ANDROID, JAVA AND ARDUINO

For APK and JAR Devices—
Open the Device class file at device_files.Device.
Note the elements are all of type String. This is intentional for several reasons:
1. Ready to save/restore data in CSV file.
2. Ready to send via HTTP.
3. Easy to parse or convert to Integer or boolean if/when needed.
4. Human readable makes debugging easier.

To add an element:
1 - device_files.Device
1.1 - Add a private String with reference name. Note the element position.
1.2 - Add getter and setter methods
1.2.1 - Highlight the name, right click, select Generate -> Getter and Setter. Then edit as needed.

Where element position is referenced.
2 - command_files.StaticValues – At the bottom of the file see “Device element order”. Match the position noted in 1.1 above. Update the element integer order too.

Where getters and setters are called:
3 - device_files.DeviceUtils.deviceToCsv() – Note the position, very important to keep the position consistent for all the following.
4 - device_files.DeviceUtils.csvToDevice() – Match position noted in 1.1. Update element integer order.
5 - device_files.DeviceUtils.showDeviceInLog() – Optional - Unused method used for code debugging

Where Devices are made from CSV strings.
6 - device_files.DeviceUtils.thisDeviceNow() –End of method. Match position noted in 1.1
7 - startup_files.Installation.makeThisDevice() –Add to String tempCsv. Match position noted in 1.1


For BIN devices— Be sure to match element order. Use Edit -> Find with the following search strings (without the quotes)
1 - “String thisDevice” – update the array size too
2 - “String tempDevArray” – update the array size only
3 - “void parseDevice” – update devArray argument size and modify method with element
4 - “//Build a CSV device” – modify method with element