Mapwize

From Wiki for Dragino Project
Revision as of 02:29, 13 November 2020 by David.huang (Talk | contribs) (Created page with "=Introduction= =Location service configuration= The location service is currently installed on the 120.78.138.177 server, the code is in /root/location, and the pre-read con...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Location service configuration

The location service is currently installed on the 120.78.138.177 server, the code is in /root/location, and the pre-read configuration file for running location directly is /etc/location_conf.json

Configuration file: location_conf.json { "location_conf": {

   "loctype": "indoor",       / / indoor/outdoor
   "locmap": "mapwize"    //   Map interface: mapwize, traccar

}, "mqtt_conf": {

    "servaddr": "[str]",    //     Lorawan server address: Refer to TTN app handler:eu.thethings.network
    "servport": [int],       //   Lorawan server port: 1883
   "clientid": "[str]",       //   MQTT client identity: Custom
   "qos":[int],                 //  (Optional) MQTT service quality: 0
   "username":"[str]",     //   Agent name of mqtt: application ID of TTN
    "password":"[str]",      //  The proxy password of mqtt: application access key of TTN
   "topic":"[str]",              // The topic of mqtt subscription: TTN is + / devices / + / up  
   "connection":"[str]" },   //(Optional) mqtt is a string used for direct connection, composed of serveraddr and port 
"mapwize_conf":{          //Map settings
    "apikey": "[str]",        // The apikey of the map user can be found on the Api keys page of wapwize, and read and write permissions need to be set
   "venueid":"[str]",        // (Optional)Indoor map area identification 
    "orgid":"[str]",           //  The identity of the user organizer
   "universesid":"[str]",   //The range indicator of the indoor map, find it on the universes page
   "placetype": "[str]"     //The type of place used to identify the creation must be created on the placetypes page in the map, where the placetype name is filled in
    },
"loracloud":{
   "token":  "[str]"          //The password string of loracloud location service, the outdoor map must fill in the account token of loracloud

}

"rssi_conf": {
   "rssirate": [int],          // (Optional) A basis for rssi calculation distance, the rssi value (absolute value) when the beacon is 1 meter apart   
   "rssidiv": [float] }        // (Optional) rssi measures an attenuation value of distance. As the distance to the beacon is farther, the value changes speed

}

TTN map decoder

function Decoder(bytes, port) { // Decode an uplink message from a buffer // (array) of bytes to an object of fields. value = bytes[0] << 8 | bytes[1]; var batV = value/1000;//Battery,units:V

var mode = bytes[5];

//var value=(bytes[3]-0x30)*1000 +(bytes[5]-0x30)*100 + (bytes[5]-0x30)*10 +(bytes[6]-0x30); //var value = bytes.slice(3);

var i; var con; var str = ""; var major = 1; var minor = 1; var rssi = 0; var addr = "";

if(mode ==2 ) { for(i = 38 ; i<50 ; i++) { con = bytes[i].toString(); str += String.fromCharCode(con); }

addr = str;

str = "";

for(i = 6 ; i<38 ; i++) { con = bytes[i].toString(); str += String.fromCharCode(con); }

value = str; }

if(mode == 3 ) { str = ""; for(i = 18 ; i < 22 ; i++) { con = bytes[i].toString(); str += String.fromCharCode(con); }

major = parseInt(str, 16);

str = "";

for(i = 22 ; i < 26 ; i++) { con = bytes[i].toString(); str += String.fromCharCode(con); }

minor = parseInt(str, 16);

str = "";

for(i = 28 ; i < 32 ; i++) { con = bytes[i].toString(); str += String.fromCharCode(con); }

rssi = parseInt(str);

str = ""; for(i = 6 ; i < 18 ; i++) { con = bytes[i].toString(); str += String.fromCharCode(con); }

value = str; }

if(mode == 1) { for(i = 6 ; i<11 ; i++) { con = bytes[i].toString(); str += String.fromCharCode(con); }

value = str; }

var uuid = value; var alarm = bytes[2] >> 4 & 0x0F; var step_count = (bytes[2] & 0x0F) << 16 | bytes[3] << 8 | bytes[4];

return { UUID: uuid, ADDR: addr, MAJOR: major, MINOR: minor, RSSI:rssi, STEP: step_count, ALARM: alarm, BatV:batV, }; }