team4909 / 2018-Core

2018 Scouting Platform
MIT License
10 stars 3 forks source link

Analysis Portal & BT Worker Integration (Tablet->Server) #4

Closed roshanr10 closed 7 years ago

roshanr10 commented 7 years ago

The analysis portal should be based on Node, and Mongo as per #2.

This should connect with the BT worker via something similar to web hooks, both ways.

roshanr10 commented 7 years ago

Attached is a simple example of web hooks with data going from tablet to server. The tablet uses the Cordova plugin to communicate the data to the Python script on the Pi over Bluetooth, which is then sent to the Node.JS server from Python.

The resulting output from the JSON on the Node side is below:

pi@raspberrypi:~/Desktop/TGA-Server-2018 $ node server.js 
Listening at http://localhost:4909
=====
New Connection:
{ thread_id: 0, client_mac: '68:37:E9:19:50:FF' }
=====
New Data:
{ thread_id: 0,
  msg_data: { gears_placed: 2 },
  client_mac: '68:37:E9:19:50:FF' }
=====
Bad Data:
{ thread_id: 0,
  msg_data: 'MORE DATA PT.4',
  client_mac: '68:37:E9:19:50:FF' }
=====
Lost Connection:
{ thread_id: 0, client_mac: '68:37:E9:19:50:FF' }
=====
New Connection:
{ thread_id: 1, client_mac: '68:37:E9:19:50:FF' }
=====
New Data:
{ thread_id: 1,
  msg_data: { gears_placed: 2 },
  client_mac: '68:37:E9:19:50:FF' }
=====
Bad Data:
{ thread_id: 1,
  msg_data: 'MORE DATA PT.4',
  client_mac: '68:37:E9:19:50:FF' }