I need to simulate the position tracking for my 'IoT thing' in my IoT platform Thingworx. For eg: If I have a car as a Thing, and it has two modes moving and stopped. I need to simulate the changing latitude and longitude for the car when it is in 'moving' state and store the generated coordinates so that they can be later displayed on the Google map widget in the mashup. Similarly, if the car is stopped then it should display the location where it was last stopped. I have the following questions:
Thanks!
A part of the logic to simulate movement, which can be as complex as you want or a simple as adding Randomly movements to the Latitude / Longitude.
You should use a Timer Thing which for instance triggers every second ( or any other frequency ) and you subscribe to "Timer" event and there you write the code to move the car.
You need to have a property on the Car Thing that we can call it "location" which of baseType LOCATION, and this property should be set as "logged" then you just need to update location property with the new location ( if it moved since last location - on your simulator code - ). Of course you also must set car Thing's ValueStream property in order to get storage for location changes.
You can use TW Marketplace Google Maps extension in order to show Location and Paths on Google Maps from the recorded simulation.
Setting a location property in TW it's something like:
me.location = { latittude: latitude_value, longitude: longitude_value, elevation: elevation_value, units: "WGS84" }
Hope it helps.