Gets data from accelerometer
accelStream
: The accelerometer stream object that we have to listen to
[acc_x, acc_y, acc_z]
: single array consisting of x, y and z values from accelerometer data.
Gets data from the GPS
gpsObject
: The GPS object provided by the library you will be using to get the GPS data.
[latitude, longitude]
: single array consisting of latitude and longitude
Gets an input array of arbitrary length and writes to the filename
with the following structure:
[
vehicle_id(String), # A string containing the vehicle id
datapoint_id(String), # A datapoint id to locate this specific datapoint
timestamp(String), # Timestamp of the datapoint
content(String) # A string of comma separated values (i.e. array of data [arr1, arr2, arr3] is sent as "arr1,arr2,arr3")
]
The function must then write to a new line in the file of filename
(look into writeln
method here)
The file contents upon upload should look like this
[...datapoint1]
\n
[...datapoint2]
\n
[...datapoint3]
\n
...
[...datapointx]
array (Array)
: array of datadata_type (String)
: the type of data we are writing (i.e. accelerometer or gps)filename (String)
: the filename we are writing to
NONE
Generates a random filename string. We suggest using UUID v4 to generate the filename. More information can be found here
NONE
filename (String)
: A unique filename ID
This function changes the widget state variable that controls the filename we are writing to new_filename
whilst also returning the previous filename for reference in the future.
NONE
last_filename (String)
The filename of the file we last wrote into
A function that moves the selected filename
from root/${folder_from}
to root/${folder_to}
. This function will be used to move files from the root/compile
to root/upload
folder.
filename (String)
: the target filename we want to movefolder_from (String)
: the target folder the file is infolder_to (String)
: the target folder we want to move the file into
NONE
A function that deletes a specific filename
from a specified folder
path. We will use this to delete folders which have been successfully uploaded OR contain data that has no sufficient movement being logged.
filename (String)
: The target filenamefolder (String)
: The target folder path
NONE
A function that checks if the folder
path is empty
folder (String)
: Which folder to look in
is_empty(Boolean)
: A boolean which istrue
when the folder is empty andfalse
if it contains files
A function that checks if there is cellular connection
NONE
has_connection (Boolean)
: A boolean which istrue
if the there is an active connection andfalse
if no connection is present.
A function that looks into a folder and returns an array containing a list of filenames present within the folder
path. This should return a list as follows:
[fn1, fn2, fn3, ... fnN]
folder (String)
: A string cointaining the targetfolder
path to look at
file_list (String)
: A list of files present inside the folder
This function should send the contents of the filename
inside a folder
path to a url
via an HTTP:POST
request. We advise it be a Future
function that returns a String
of the response which can be used for future reference later.
url (String)
: The url endpoint we want toPOST
tofilename (String)
: The name of the file we want to uploadfolder (String)
: The path thefilename
exists in
response (String)
: A string of the response from the server
Analyses the GPS data within filename
in folder
path and find the maximum distance from the first datapoint. If it is less than distance_threshold
, return false
else, return true
.
filename (String)
: the filename of the target filefolder (String)
: the folder in which the file is located indistance_threshold (Double)
: The minimum threshold displacement of a point that must be exceeded for the function to consider movement within the recorded file
movement_detected (Boolean)
true
if maximum displacement exceeds the threshold distance elsefalse