All Projects → ianovir → HIMUServer

ianovir / HIMUServer

Licence: other
HIMUServer is a server-side solution for the app HyperIMU

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to HIMUServer

watson-vehicle-damage-analyzer
A server and mobile app to send pictures of vehicle damage to IBM Watson Visual Recognition for classification
Stars: ✭ 62 (+287.5%)
Mutual labels:  android-device
crowdsource-video-experiments-on-android
Crowdsourcing video experiments (such as collaborative benchmarking and optimization of DNN algorithms) using Collective Knowledge Framework across diverse Android devices provided by volunteers. Results are continuously aggregated in the open repository:
Stars: ✭ 29 (+81.25%)
Mutual labels:  android-device
android device zuk z2 plus
Android device configuration for ZUK Z2 (z2_plus)
Stars: ✭ 18 (+12.5%)
Mutual labels:  android-device
android device zuk z2 row
Android device configuration for ZUK Z2 Pro (z2_row)
Stars: ✭ 17 (+6.25%)
Mutual labels:  android-device
android-sysinfo
No description or website provided.
Stars: ✭ 13 (-18.75%)
Mutual labels:  android-device
codecinfo
Detailed listing of multimedia codecs on an Android device
Stars: ✭ 33 (+106.25%)
Mutual labels:  android-device
Women-Safety-App
An android app which can INSTANTLY alert the Guardians(along with user location) whenever the user is in an emergency situation. It can be triggered just by shaking the android device in which the app is installed.
Stars: ✭ 41 (+156.25%)
Mutual labels:  android-device
myplanet
🌕 myPlanet android app reads data from 🌎 for offline use as well as it collect usage data and sends them back to the Planet.
Stars: ✭ 17 (+6.25%)
Mutual labels:  android-device
Ghost
Ghost Framework is an Android post-exploitation framework that exploits the Android Debug Bridge to remotely access an Android device.
Stars: ✭ 1,934 (+11987.5%)
Mutual labels:  android-device

HIMU-Server

HIMU Server (HyperIMU Server) is a python library covering all server-side stream protocols supported by HyperIMU. It performs basic operations such as input stream reading and csv sequence chunking.

Read the HyperIMU Documentation for more details.

Overview

Network configurations

In order to connect the HIMUServer application and the HyperIMU app, you need the following:

  • Be sure the Android device (HyperIMU client) and you server (HIMUServer) are connected to the same network
  • Configure the HyperIMU app with the server IP address and server port
  • Be sure the firewall in the server machine doesn't limit the server application

Protocols and Data Format

HyperIMU streams the sensors' data by using the protocols UDP and TCP, or by storing them into a file for an offline processing. The order of the sensors is the same as specified in the HyperIMU's settings.

Data are formatted as CSV (Comma Separated Value). At a time, all sensors' values are gathered into a single string and all values are separated by commas. HyperIMU samples always three values per sensor.

E.g. considering a case with three sensors, the packet will be:

`0.123,0.586,0.2637,0.259,-0.5963,9.815,5.36,0.00,0.00 <CR><LF>`

where the values can be grouped as follows:

Sensor1 Sensor2 Sensor3 end of line
0.123 , 0.586 , 0.2637 0.259 , -0.5963 , 9.815 5.36 , 0.00 , 0.00 [CR][LF]

At the end of the CSV line it is inserted the symbols [CR][LF] or the char "#" (configurable option).

Timestamp and MAC address will be added at the very beginning of the packet, while GPS data (Latitude, Longitude, Altitude) and GPS NMEA sentences will be added at the very end.

Installation

Get HIMUServer source from Github and install it.

Linux

Execute the following commands:

git clone git://github.com/ianovir/HIMUServer.git
cd HIMUServer/
sudo python HIMUServer/setup.py install
sudo rm -rf HIMUServer

Windows

Download the repository or execute the following git command:

git clone git://github.com/ianovir/HIMUServer.git

Via Windows cmd (or Powershell) navigate to the downloaded folder HIMUServer/ and execute the follwing command:

python HIMUServer/setup.py install

Finally, delete the folder HIMUServer/

How to use HIMUServer

Server configuration

HIMU-Server offers code snippets for data acquisition via UDP, TCP and FILE protocols. It is possible to read the signals directly from the stream by using an instance of the class HIMUServer:

from HIMUServer import HIMUServer
myHIMUServer = HIMUServer()

Configurations such as input buffer size, timeout and terminator symbol can be specified directly in the server constructor:

from HIMUServer import HIMUServer
myHIMUServer = HIMUServer(bufferSize = 1024, timeout = 30, separatorIndex = 0)

The parameter separatorIndex can assume the value 0 to use the symbol [CR][LF] for csv packet separator, value 1 to use the # symbol.

Custom listeners

HIMU Server supports listeners. A listener is an object having the public method notify(sensorData) which is called by the server when a packet is received.

You can define your custom listener:

class SimplePrintListener:
    def __init__(self, serverInstance):
        self.__server = serverInstance
        ...
        
    def notify (self, sensorData):
        #simply printing all data strings
        HIMUServer.printSensorsData(sensorData)

Then add an instance of the listener to the server:

myListener = SimplePrintListener(myHIMUServer)
myHIMUServer.addListener(myListener)

Accessing Sensors' data

You can access the sensors' data by iterating the sensorData parameter in the notify() method of your custom listener:

class MyCustomListener:
    def __init__(self):
        pass
    ...    
    def notify (self, sensorData): 
        for sensors in sensorData:
          sensor_1 = HIMUServer.strings2Floats(sensors[0])
          sensor_2 = HIMUServer.strings2Floats(sensors[1])
          ...
          s1_x = sensor_1[0]
          s1_y = sensor_1[1]
          s1_z = sensor_1[2]

Please, note the method HIMUServer.strings2Floats() which can be used to convert a list of strings (from csv) to a list of floats very easily.

Launching the server

Launch the server with TCP protocol:

	myHIMUServer.start("TCP", 2055)

UDP protocol:

	myHIMUServer.start("UDP", 2055)

File:

	myHIMUServer.start("FILE", "HIMU-file-path.csv")

Take a look to the demo.py file for more info.

Copyright

Copyright(c) 2019 Sebastiano Campisi - ianovir.com. Read the LICENSE file for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].