The getters are used by the framework to get the value of the attributes from you device.
So you need to implement a getter for each attribute that returns its value. Because you don’t want to request the value from you android device (else a reverse connection would be needed) you can simply save the values to local properties of your device and return the saved values:
class LocationDevice extends env.devices.Device
description: "the distance"
getDistance: -> Promise.resolve(@_distance)
To have an api end point you can simply add a action for setting for example the distance. This action is automatically exposed as HTTP-API:
description: "updates the distance, called from your android device"
updateDistance: (distance) ->
@_distance = distance
You can now call the updateDistance-action via HTTP-REQUEST:
@_distance is just a shorthand for
this._distance. If you need further help, push the code to github and ping me there.