GPS TRACKING (WITH TK103-2 ADAPTER)| Node.js
This module let you easily create listeners for your GPS tracking devices. You can add your custom implementations to handle more protocols.
New GPS Tracker emulator:
We created a brand new gps emulator so you can start testing your app in a breeze. You can signup to save your testing devices.
You can check the code of the emulator in this repo.
We removed mongoDB dependecy for this package. Now you can use any DB to save the data you receive.
The old documentation is still available in the repository (tag v0.25)
Currently supported models
With package manager npm:
npm install octopus-gps-tracking
DEMO SERVER APP
You can check a basic demo app here
DEMO SERVER WEB APP
Once you have installed the package, you can use it like:
var gps = ;var options ='debug' : true'port' : 8090'device_adapter' : "TK103_2"var server = gps;
Sending a message to device
server.send_to(device_id, 'powercar 11');
Step by step
Create a folder for your project
Copy the example code above in a .js file like server.js
Install the package in the project folder
cd /path/to/my/projectnpm install gps-tracking
- Run your server
With this package you are going to create a tcp server that listens on a open port of your server/computer for a specific gps device model. For example, you are going to listen on port 8090 for 'TK103 gps-trackers'.
If you want to listen for different kind of trackers, you have to create another tcp server. You can do this in a different node.js program in the same server, but you have to listen in a different port.
So, you can listen on port 8090 for TK103 devices and listen on 8091 for TK102 devices (or any gps-tracker you want)
Enables console.log messages.
The port to listen to. Where the packages of the device will arrive.
Which device adapter will be used to parse the incoming packets.
"device_adapter": false// If false, the server will throw an error."device_adapter": "TK103_2"// You can create your own adapter.//FOR USING A CUSTOM DEVICE ADAPTER"device_adapter":
Once you create a server, you can access to the connection and the device object connected. Both objects emits events you can listen on your app.
var server = gps
//Example:var server = gps;
Device object events
Every time something connects to the server, a net connection and a new device object will be created. The Device object is your interface to send & receive packets/commands.
var server = gps