Customer Server
needed).
On that
fi
le you can
fi
nd a commented example of a URL request; you can modify and adapt it to your needs.
7.7.2. Modifying the Database
If you want to use a database which is different to the provided one, or if you want to change the way data is saved
on the database, you must modify the
fi
le src/app/Helpers/DataFlow.php.
This class has 3 methods:
‚
get_null_record
: This method should return an array of
NULL
values foreach
fi
eld de
fi
ned on the database.
‚
get_last_record
: This method should return the previous record for the device. It should call the previous
method if there isn
’
t any previous value for the node.
‚
insert_record
: This method receives the data prepared to be inserted on the database as input and therefore
it makes the database insertion on a new row.
7.7.3. Adding a new unsupported LoRaWAN Network Server
To add a new LoRaWAN Network Server
(di
ff
erent from the o
ffi
cially supported by Libelium) you have to create a
new PHP class that must implement the interface located on
src/app/Helpers/Services/LwService
I
nterface.php
.
There are 4 methods to be implemented:
‚
enqueue_message
:
I
t allows to send data to the new LoRaWAN Network Server.
‚
get_lw_info_from_request
:
I
t returns all the LoRaWAN information from the request of the new LoRaWAN
Network Server.
‚
get_eui_from_request
:
I
t returns the node EU
I
from the request of the new LoRaWAN Network Server.
‚
get_payload_from_request
:
I
t returns the payload from the request of the new LoRaWAN Network Server.
The next step would be to create an endpoint to be able to receive data from the LoRaWAN Network Server.
Therefore, you have to create a new method on the services app
’
s controller:
src/app/Http/Controllers/api/v2/ServiceController.php
This method will receive a request object with all the data provided from the service, you can use the helper
methods from the service class you have created previously. The implementation details can vary from service
to service, so this cannot be explained in detail (you can use the Loriot and Actility ones as a reference).
The functionality that this method must implement is:
‚
Get data from the request
‚
Parse the payload using the same helper class used by the provided services:
$a_result = $this->frames->main($EUI, $payload);
‚
Enqueue the data if the parser returns something on the
output
key returned form the parser:
- 109 -
v7.5
Summary of Contents for Waspmote Smart Parking v2
Page 1: ......
Page 92: ...LoRaWAN Network Server setup Figure Check In to DeviceHQ 91 v7 5 ...
Page 135: ...Deployment and installation Figure Final section of the anchor and screw 134 v7 5 ...
Page 143: ...Safety Guides 11 Safety Guides 11 1 Smart Parking Chemical Fixing Cartridge 142 v7 5 ...
Page 144: ...Safety Guides 143 v7 5 ...
Page 145: ...Safety Guides 144 v7 5 ...
Page 146: ...Safety Guides 145 v7 5 ...
Page 147: ...Safety Guides 146 v7 5 ...
Page 148: ...Safety Guides 147 v7 5 ...
Page 149: ...Safety Guides 148 v7 5 ...
Page 150: ...Safety Guides 149 v7 5 ...
Page 151: ...Safety Guides 150 v7 5 ...
Page 152: ...Safety Guides 151 v7 5 ...
Page 153: ...Safety Guides 152 v7 5 ...
Page 154: ...Safety Guides 153 v7 5 ...