def notify(self, sensorData):
        line = ''
        if len(sensorData) == 0:
            return
        sensors = sensorData[0]

        for sensor in sensors:
            for field in sensor:
                if isinstance(field, str):
                    line += '%s,' % field
                elif isinstance(field, float):
                    line += '%f,' % field
                else:
                    line += field
        line += '\n'

        f = open(filename, 'a')
        f.write(line)
        f.close()

        HIMUServer.printSensorsData(sensorData)
'''
Created on 17 Nov 2017

@author: Johannes Friedrich
@mail: [email protected], 
@homepage GitHub: https://github.com/JohannesFriedrich 

'''

import plotly.plotly as py
from plotly.graph_objs import Stream, Scatter, Data, Layout, Figure
# auto sign-in with credentials or use py.sign_in()

from HIMUServer import HIMUServer

myHIMUServer = HIMUServer()

maxpoints = 200

stream1 = Stream(
    token='your_token_1',  # (!) link stream id to 'token' key
    maxpoints=maxpoints       
)

stream2 = Stream(
    token='your_token_2',  # (!) link stream id to 'token' key
    maxpoints=maxpoints       
)

stream3 = Stream(
    token='your_token_3',  # (!) link stream id to 'token' key
                    line += '%f,' % field
                else:
                    line += field
        line += '\n'

        f = open(filename, 'a')
        f.write(line)
        f.close()

        HIMUServer.printSensorsData(sensorData)

    # for a string-to-float conversion, try HIMUServer.strings2Floats()


# HIMUServer instance:
myHIMUServer = HIMUServer()

# Creating listener and adding it to the server instance:
myListener = SimplePrintListener(myHIMUServer)
myHIMUServer.addListener(myListener)

# Change the timeout (in seconds) :
myHIMUServer.timeout = 10

# Launch acquisition via TCP on port 2055:
myHIMUServer.start("TCP", 2055)

# Launch acquisition via UDP on port 2055:
# myHIMUServer.start("UDP", 2055)

# Launch acquisition from local file:
Exemple #4
0
 def notify(self, sensorData):
     #Customize the notify method in order to elaborate data
     # sensorData contains String values (see HIMUServer.__extractSensorData())
     HIMUServer.printSensorsData(sensorData)
     #for a string-to-float conversion, try HIMUServer.strings2Floats()
     pass
Exemple #5
0
 def notify(self, sensorData):
     #Customize the notify method in order to elaborate data
     # sensorData contains String values (see HIMUServer.__extractSensorData())
     HIMUServer.printSensorsData(sensorData)
Exemple #6
0

#An example of listener implementation.
class SimplePrintListener:
    def __init__(self, serverInstance):
        self.__server = serverInstance

    def notify(self, sensorData):
        #Customize the notify method in order to elaborate data
        # sensorData contains String values (see HIMUServer.__extractSensorData())
        HIMUServer.printSensorsData(sensorData)
#for a string-to-float conversion, try HIMUServer.strings2Floats()


#HIMUServer instance:
myHIMUServer = HIMUServer()

#Creating listener and adding it to the server instance:
myListener = SimplePrintListener(myHIMUServer)
myHIMUServer.addListener(myListener)

#Change the timeout (in seconds) :
myHIMUServer.timeout = 2

#Launch acquisition via TCP on port 2055:
myHIMUServer.start("TCP", 2055)

#Launch acquisition via UDP on port 2055:
myHIMUServer.start("UDP", 2055)

#Launch acquisition from local file:
Exemple #7
0
    def notify (self, sensorData):
		#Customize the notify method in order to elaborate data
		# sensorData contains String values (see HIMUServer.__extractSensorData())
        HIMUServer.printSensorsData(sensorData)
		#for a string-to-float conversion, try HIMUServer.strings2Floats()
        pass
Exemple #8
0
#An example of listener implementation.
class SimplePrintListener:
    def __init__(self, serverInstance):
        self.__server = serverInstance
        pass
    		
    def notify (self, sensorData):
		#Customize the notify method in order to elaborate data
		# sensorData contains String values (see HIMUServer.__extractSensorData())
        HIMUServer.printSensorsData(sensorData)
		#for a string-to-float conversion, try HIMUServer.strings2Floats()
        pass

#HIMUServer instance:
myHIMUServer = HIMUServer()

#Creating listener and adding it to the server instance:
myListener = SimplePrintListener(myHIMUServer)
myHIMUServer.addListener(myListener)


#Change the timeout (in seconds) :
myHIMUServer.timeout = 2

#Launch acquisition via TCP on port 2055:
myHIMUServer.start("TCP", 2055)

#Launch acquisition via UDP on port 2055:
#myHIMUServer.start("UDP", 2055)