3 Replies Latest reply on Sep 8, 2017 7:43 AM by supandey RSS
    nrodrigues Newbie

    ThingWorx Newbie - Streamming data and saving logs

    I'm just getting into thingworx and I think I have a rough idea of the concepts behind, however I'm unsure on to implement something I have in mind.


    For starters I'm using ThingWorx Android SDK, since I'm making an Android app. This app connects to a bluetooth device with multiple sensors which streams its data to the android phone.

    In the app I'm making some pre-processing of the data. I want to create a thing for each bluetooth device, let's call it SensorThing, and I would like to create some kind of log of the sensor data in order to later on be able to analyse/plot it. Furthermore, I want to be able to start and stop this logging so I can have different "sessions" saved for the same SensorThing. Also, some of the sensors are 3D, meaning that the data is not a single value, but an array of values.


    What's the best way to go about it? Can you give me some tips?

      • Re: ThingWorx Newbie - Streamming data and saving logs
        supandey Collaborator

        Hi, what you wanna do here is to create representation of these SensorThing as RemoteThings in ThingWorx Composer. If all of these sensors are gathering similar sort of data then you can consider creating a Template (or multiple depending on how widely distributed properties you have) using this RemoteThingTemplate you can spawn multiple RemoteThings in ThingWorx Composer which will persist the data you will gather.


        Now to the question on logging this timeseries data you'd want to have something like ValueStream/ Stream which logs all the incoming data from your bluetooth sensors via the ThingWorx Android SDK to ThingWorx composer. ValueStream stores timestamps for each entry making it easier for you to analyse data over the period of time. Of course you can log array of data into Value Stream.


        Note you can choose to persist or not persist the data, may be this could be something that you can utilize to log or not log certain time period of data. Otherwise you can Enable/Disable things within ThingWorx which should allow you to stop logging.


        For collective guides on all the concepts I have mentioned above you can check the guides section if you haven't already IoT Development Guides and Tutorials | Developer Portal : ThingWorx


        Hope this could help jump start your project. Goodluck!




        More documentation/guides on ThingWorx Core

          • Re: ThingWorx Newbie - Streamming data and saving logs
            nrodrigues Newbie

            Thanks for the answer!


            As you suggested, I already have a template for SensorThing so that I'm able to create them as I connect to the bluetooth devices.


            On the other hand, I'm not sure if ValueStream/Streams alone are going to be enough, since I would like to have each "session" saved individually (where a session might be as simple as the time between the user presses start and stop in the app). However I would also need to have a away to know to which device the log belongs to.


            That being said, I'm still trying to implement these things, so I'm going to have a better understanding of the whole ThingWorx workflow after some more testing.