Dispositivos sempre ficam lotados em alguma companhia específica. Ela fica identificada no arquivo device:
{// documento device gravado com o nome "<imei>" na collection de devices
"imei": "<imei>"
,"deviceOf": "<companyId>"
/* UTILS AND CONSTANTS*/ | |
const SPEED_MULTIPLIER = 1.852; | |
const DISTANCE_MULTIPLIER = 111.045; | |
const SETTINGS = { | |
"default_object_online_timeout": 5 | |
,"valid_by_avg_speed": false | |
,"min_moving_speed": 6 | |
,"addon.device_tracker_app_login": false |
Dispositivos sempre ficam lotados em alguma companhia específica. Ela fica identificada no arquivo device:
{// documento device gravado com o nome "<imei>" na collection de devices
"imei": "<imei>"
,"deviceOf": "<companyId>"
// [bucket]/<userID>/invoices/invoiceID.json | |
{ | |
"invoiceID": "Number" | |
,"by": "UID" | |
,"createdAt": "Date" | |
,"legacyLogin": "String" | |
,"chargeType": "String[event|recurrent|occasional]" | |
,"userToCharge": { | |
"name": "String" | |
,"CPFCNPJ": "String" |
Pegar todo o cache separado por servidor:
https://us-central1-tracker-net.cloudfunctions.net/updateimeis?servernodes=true
Todos os dispositivos separados por servidor: {"imei":"866551038xxxxxx","t":1694968580764,"prot":"ev02","users":["zecarevenda","zecaurubu","3632400600xxxxxx"]}
t é o tempo epoch da última conexão. prot é o protocolo users usuários em ordem.
<!doctype HTML> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<!-- <script type="module" src="http://localhost:5000/tracker-net/us-central1/getHistory" /> --> | |
<!-- <script type="module" src="https://us-central1-tracker-net.cloudfunctions.net/getHistory" /> --> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.15.3/xlsx.full.min.js" ></script> |
const UserScheme = { | |
uid: { | |
type: "string" | |
,match: /[0-9].*/ | |
,required: true | |
,unique: true | |
,validate: "uid" | |
,trim: true | |
,max: 25 | |
} |
const http = require('node:http'); | |
const url = require('url'); | |
function getData(req) { | |
return new Promise((resolve, reject) => { | |
const queryObject = url.parse(req.url, true).query; | |
let body = ''; | |
function res() { | |
resolve(Object.assign({}, JSON.parse(body||'{}'), queryObject)); | |
} |
/** | |
* Module to work with Models and Classes | |
*/ | |
(function(o){ | |
o.Model = {_:{}}; | |
// o.Model.connection; | |
// o.Model.connect; | |
var counter = 0; |
// get streets near point, ordered by proximity to point ASC in bulk (positions) | |
// eg: http://localhost:3000/street/bulk/geojson | |
app.get('/street/bulk/geojson', function ( req, res ) { | |
// http://142.132.241.141:4700/street/near/geojson?lat=-23.264973&lon=-47.299873 | |
// http://142.132.241.141:4700/street/bulk/geojson?positions=-23.264973,-47.299873 | |
getData(req).then(data => { | |
const max_distance = data.dist || 0.01; | |
const max_matches = data.max_matches || 100; | |
if (!data.positions) { |
let fetch = (url, body) => { | |
return new Promise( async function (resolve, reject) { | |
// IF MODERN BROWSER > CREATE NEW httpRequest | |
let httpRequest; | |
if (window.XMLHttpRequest) { | |
httpRequest = new XMLHttpRequest(); | |
} | |
// IF IE > CREATE NEW ActiveXObject | |
else if (window.ActiveXObject) { | |
try { |