Nebula Files and Static Values

During the installation of a new JAR device Nebula creates a directory named Nebula in your home directory. The paths and filenames are initialized in Startup if you want to change them. A reference to to all files is held in class Static_Values. Inside the Nebula directory, JAR devices create directories to match the ones commonly used by Android. They are Audio, Documents, Downloads, Photos and Videos. The root file path for Android is to packagePath/files/Nebula. Both JAR and APK devices create a Nebula/UserData directory. Each of these created directories is for the sole purpose of transferring files between devices when using the demo commands SendFile and Get File. The demo commands do not allow file transfer to a directory name other than the one they originate from.

The essential directory for every Nebula device is Nebula/NebulaDataFiles. Inside the NebulaDataFiles directory are 3 files:

  1. ~/Nebula/NebulaDataFiles/thisDevice.csv
  2. ~/Nebula/NebulaDataFiles/thisNetwork.csv
  3. ~/Nebula/NebulaDataFiles/allDevices.csv

Directory Structure

/home/$USER/Nebula
Documents
Downloads
Movies
Music
Photos
NebulaDataFiles
thisDevice.csv
thisNetwork.csv
allDevices.csv

thisDevice.csv

A single line that contains 9 elements about the particular device in comma separated values.
Example: Venus,192.168.8.18,0B,0005,NONE,NONE,NONE,NONE^wlp2s0

1. device name
2. contact at IP address
3. hex byte for bit test
3.0 - boolean - device has internet connection
3.1 - boolean - device is on a LAN
3.2 - boolean - device is mobile
3.3 - boolean - device is home
3.4 - not used
3.5 - boolean - device address is static
3.6 - Device is jar(00) || apk(01) || bin(10) || ipa(11)
3.7 - Device is jar(00) || apk(01) || bin(10) || ipa(11)
4. device ID
5. mobile phoneNum@provider.ext
6. email host for provisioned mobile device mail@gmail.com
7. email address at host me@gmail.com
8. email account password
9. selected network name. Note: separated from CSV with ^

thisNetwork.csv

A single line that contains 3 elements about the VPN in comma separated values.
Example: 99.88.77.66,50500,NIJYrkjaO9ahkbFWvTn4Tw==

1. Public IP or DNS address of this VPN
2. Port number this VPN uses
3. The VPN encryption key or “NONE” if this VPN is sending as clear text

allDevices.csv

Multi-line file of all devices on the VPN. The device format is the same as thisDevice described above minus the network used name.
Example:
Mars,192.168.8.5,0B,0001,NONE,NONE,NONE,NONE
Venus,192.168.8.18,0B,0002,NONE,NONE,NONE,NONE
Cloud,21.22.23.241,29,0003,NONE,NONE,NONE,NONE

BIN Device Files

Arduino based WiFi devices use SPI Flash Filing System (SPIFFS). It’s used for embedded microprocessor systems with little RAM. Nebula configures a 4MB WiFi device to use 1MB for SPIFFS and 3MB for code and data. A SPIFFS file system is flat, meaning it does not use directories. More information can be found here. Nebula files on SPIFFS are:

1. /nebula/thisDevice.csv –Uses the same format as thisDevice.csv on APK and JAR
2. /nebula/thisNetwork.csv –Uses the same format as thisNetwork.csv on APK and JAR
3. /nebula/dev<deviceID>.csv –One file for each device on the VPN
  • The size of a device file is typically less than 70 bytes but can be around 200 bytes for a mobile device with a long email address.

Static Values

Essential Operating System elements

public static String OS; // = The Operating System used by a device
public static String EOL = System.getProperty(“line.separator”); // = Line ending used by the OS
public static String FS = System.getProperty(“file.separator”); // = Path separation character for OS

Essential Nebula files initialized in Startup

public static String sysBaseDir; // = System.getProperty(“user.home”)
public static String nebulaDir; // = sysBaseDir + “Nebula”
public static String filesDir; // = nebulaDir + “NebulaDataFiles”
public static String devsFile; // = filesDir + “allDevices.csv”
public static String thisDevCsv; // = filesDir + “thisDevice.csv”
public static String thisNetwork; // = filesDir + “thisNetwork.csv”

Command essentials

public static String replyFooter; //unique code instruction returned from server
public static String bigSms; //If SMS > 140 bytes, save and retrieve from here

Networking essentials

public static String netPubIP; // Public IP or DNS address of home network
public static String netBasePort; // Base VPN port. Port forward this + 2 (3 ports) to Device 1
public static String netCryptoKey; // Key to decode crypto

Local device essentials

public static ArrayList<Device> devsArray = new ArrayList<>(); // All known devices
public static ArrayList<Command> cmdsArray = new ArrayList<>(); // All known commands
public static Device sThisDevice; // Description of this device (devFrom)
public static String sNetConName; // thisDevice network name. (eth0, wlan1 etc.)
public static Device sToDevice; // The user selected device the command is going to (devTo)
public static Command sCommand; // The user selected command being sent
  • Command class name must be included in the nativeCmds or demoCmds array to make it usable.
  • Commands with show = “true” are shown in the user command selection box in the order they are listed here.
static final String[] nativeCmds =
{“Ping”, “GetDatabase”, “SyncDatabase”, “AddDevice”, “ModifyDevice”, “DeleteDevice”, “DeleteDeviceFromVpn”, “SmsCmdReply”, “SmsEndReply”, “SmsPutOn1”, “SmsGetOn1”, “SmsGetFrom1”, “SetHubXferMode”, “NewPublicIp”};
static final String[] demoCmds =
{ “SendFile”, “GetFileList”, “GetFile”, “DeleteFile”, “CheckFile”, “DatabaseRead”, “DatabaseWrite”, “DBwrite”, “DBwriteReply”, “VideoCameraFront”, “VideoCameraBack”, “VideoStopStream”, “WebControl”, “WebStop”, “WhereIs”, “VoiceControl”, “VoiceRepeat”};
  • Following the above is where all command and command-success IDs are listed. See command_files.Static_Values for default values and details.

  • The last section of Static_Values is for convenience in getting Device elements.
Device element order
public static final int DEVname = 0;
public static final int DEVladdr = 1;
public static final int DEVstatus = 2;
public static final int DEVid = 3;
public static final int DEVphone = 4;
public static final int DEVemlhost = 5;
public static final int DEVemladdr = 6;
public static final int DEVemlpwrd = 7;