How to use temperature in data field

Hi,

I'm writing a simple data field and I would like to take the current temperature but somehow I can not find this variable. Does anyone know where to look for this variable?


Thank you,
Peter
  • Former Member
    Former Member
    The team of developers would have to redo all the activity. It would be simpler to add the missing information to the Activity.info.

    No they wouldn't. Not that it's very relevant, but I think you're missing the point.
  • Is there actually shared memory possible between two different types of programs?

    So, for example, a Widget or Application could retrieve data and store it in the object store. Then a Watchface or Datafield would retrieve the data for displaying purposes.

    This would create limitless possibilities for Watchfaces (weather, calendar, sunset info) and datafields (temp)


    It could be perfect!!! All information we need is: name of the application whose data you want to read and name of property and of course static function Application.getProperty(applicationName, propertyName) returning object.
  • It could be perfect!!! All information we need is: name of the application whose data you want to read and name of property and of course static function Application.getProperty(applicationName, propertyName) returning object.


    People have asked about shared object store for months, and the answer has always been "no". Given your example, what is "applicationName", for example? is the the "appName" in the resources.xml file, or is the name of the .prg file (which matches the name of the .str file for the object store? (which changes when you install from the app store vs side loading.)

    Also, if something needed two object stores (it's own and another's) there is only so much available memory for anything CIQ.. And data fields are limited to 16k on some devices

    adding temperature to the activity info would probably have the lowest impact, but anything that uses it would have to be careful and use "has" before trying to reference it, as it won't be available in all versions of the FW for all devices.
  • Given your example, what is "applicationName", for example? is the the "appName" in the resources.xml file, or is the name of the .prg file (which matches the name of the .str file for the object store? (which changes when you install from the app store vs side loading.)


    It must be "well known name" so from resources.xml and App's static function should take some parsing to investigate correct storage file. It seems to me that necessary information is in OUT.BIN file (maybe somewhere else).

    Also, if something needed two object stores (it's own and another's) there is only so much available memory for anything CIQ.. And data fields are limited to 16k on some devices


    But getting such object ready from another application (reference to a copy of it) should take much less memory than calculating it locally from the beginning, not to mention the processor time. Using 'has' or checking 'null' value is not a problem.
  • It must be "well known name" so from resources.xml and App's static function should take some parsing to investigate correct storage file. It seems to me that necessary information is in OUT.BIN file (maybe somewhere else).



    But getting such object ready from another application (reference to a copy of it) should take much less memory than calculating it locally from the beginning, not to mention the processor time. Using 'has' or checking 'null' value is not a problem.


    You may want to ask about shared OS in the CIQ developers forum. It's been asked before over the last 10 months, so you could also just search for threads..

    https://forums.garmin.com/forumdisplay.php?479-Connect-IQ

    The forum your posting in is really for users asking for new things for people that do 3rd party stuff to build... The Garmin CIQ folks regularly post in the developer forum..
  • Please forgive me but I'm totally new in CID SDK and again I have a few question (widget application):

    1. I'm looking for variable NormalizedPower and without success, how to get it?
    2. What is the difference between Sensor.Info.power and Activity.Info.currentPower?
    3. How to get temperature from internal sensor and how from Tempe sensor?
    4. Sensor.Info.temperature is null at least in simulator, is this correct?

    I'm writing nothing special, just want put some more values then four into my layout.

    With an app, you can also access about anything, while recording a .fit file too...


    Do you mean that in full app I'll be able to calculate e.g power, based on some other data and write it as power samples?

    For Suunto Ambit2 I wrote function for calculating power of YORK 302X (orbitrek), based on the ANT speed sensor from bike and given the level of resistance. For each level of resistance I have set the regression equation and I had very accurate indication of the power in my watch.

    I need exactly the same in Epix.

    Thank you,
    Peter
  • Please forgive me but I'm totally new in CID SDK and again I have a few question (widget application):

    1. I'm looking for variable NormalizedPower and without success, how to get it?
    2. What is the difference between Sensor.Info.power and Activity.Info.currentPower?
    3. How to get temperature from internal sensor and how from Tempe sensor?
    4. Sensor.Info.temperature is null at least in simulator, is this correct?

    I'm writing nothing special, just want put some more values then four into my layout.

    Thank you,
    Peter


    2. Activity info is only available if you are recording an activity. For sensor info, you have to have the sensor enabled, and is available weither or not you're recording

    3) in sensors, enable temperature like this:
    sensors=Sensor.setEnabledSensors( [Sensor.SENSOR_TEMPERATURE] );
    Sensor.enableSensorEvents(method(:sensorEvents));

    if(sensors!=null && sensors.size()>0) {
    gotTempe=true;
    }

    and then you'll have access to the temperature in the sensorEvents callback

    4. if you've enabled the temperature sensor, you must also feed the simulator data. The way to do this is in the simulator, Under "simulation", ckick on "fit data", and then "simulate data". FWI, a real Tempe only transmits about once per minute. So after enabling, it could take some time before you get a call back with the actual temp and not a null...

    FYI - the Tempe isn't a native sensor on the 920 - there it's much more complex to access..

    Again, the best place to ask is in the actual CIQ deveoper's forums

    https://forums.garmin.com/forumdisplay.php?479-Connect-IQ

    That's for people doing CIQ development. This sub-forum is for people suggesting ideas for others to build..
  • Thank you jim_m_58 for your replay. So how and when I should use function Sensor.Info.getInfo()?
  • Thank you jim_m_58 for your replay. So how and when I should use function Sensor.Info.getInfo()?


    The info is passed as a parameter to the callback function... Note here I'm also checking the value for temp is a float, as I ran into a strange case where it wasn't...

    function sensorEvents(sensor_info) {

    if ((sensor_info.temperature!=null && sensor_info.temperature instanceof Float)) {
    .....


    The Sensor sample in the SDK gives you a full example, but with the HRM...
  • Very interesting :). I wonder what value was there.





    In any case, thanks again for the information.
    Peter