D2 Connect IQ SDK

Former Member
Former Member
Hi All,

can someone please confirm that Bravo D2/Titanium is currently unable to read bearing through Activity.Info??

I am really confused to why this information would not be available through SDK as D2 watch does offer bearing information in the navigation while in flight.
I am trying to create customised DataField.

Kind regards,
M.
  • can someone please confirm that Bravo D2/Titanium is currently unable to read bearing through Activity.Info??

    I am really confused to why this information would not be available through SDK as D2 watch does offer bearing information in the navigation while in flight.
    I am trying to create customised DataField.


    You should be able to retrieve the bearing on the D2 Bravo. However, because the VM that runs Connect IQ is integrated (and potentially customized) at the device level it is possible that there is a bug or it has been removed for some reason. Do you have some sample code to replicate this, and I can try on my D2B right away. Otherwise, I can try to throw something together really quick tomorrow to test as it might be the way you are implementing the Connect IQ code.

    Cheers,
    Douglas
  • Are you seeing this in the sim for the D2 or on the real watch? I know with heading in the sim for various devices, I'll often just see north (0 degrees), but it works fine on real devices.
  • Former Member
    Former Member
    Thanks for the answers so far!

    I am running the code on the emulator only; I have not tried it on the actual device yet.

    If I try to access the bearing variable like this

    class MyDataField extends Ui.DataField {
    ...
    function compute(info) {
    System.println("Current bearing: " + info.bearing);
    System.println("Current heading: " + info.currentHeading);
    }
    ...
    }


    I will get

    Device Version 0.1.0
    Device id 1 name "A garmin device"
    Shell Version 0.1.0
    Could not find symbol bearing.
    Symbol Not Found Error
    in compute (/Users/mdev/Projects/myDataView/source/myDataView.mc:18)
    Failed invoking <symbol>


    I am running code against SDK 1.4.x so I can have Bravo & Titanium ticked off.



    Needles to say, currentHeading works but does display 0 on the emulator.

    Thanks for the help guys!
  • We'll take a look at this and see if we can reproduce in the sim, and check hardware while we're at it.
  • I finally got around to checking into this for you. As it turns out this is not an error in the simulator (and I would expect the same results on the actual device) because according to the API docs the [FONT=Courier New]Activity.Info.bearing()[/FONT] method was not added until SDK 2.1.0. As a result, this method is not available on the D2 Bravo as that device is currently running VM 1.4.0.

    You can see this on the method details here: https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Activity/Info.html#bearing-instance_method

    Cheers,
    Douglas
  • Former Member
    Former Member
    I finally got around to checking into this for you. As it turns out this is not an error in the simulator (and I would expect the same results on the actual device) because according to the API docs the [FONT=Courier New]Activity.Info.bearing()[/FONT] method was not added until SDK 2.1.0. As a result, this method is not available on the D2 Bravo as that device is currently running VM 1.4.0.

    You can see this on the method details here: https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Activity/Info.html#bearing-instance_method

    Cheers,
    Douglas


    That was my fear from the beginning. I have seen that in the SDK documentation but was baffled how bearing would not be available as the Fly application on a D2 does show the set bearing.

    Is there any other way of accessing hardware sensors/variables a.k.a drivers instead of going through the SDK?
  • That was my fear from the beginning. I have seen that in the SDK documentation but was baffled how bearing would not be available as the Fly application on a D2 does show the set bearing.

    Is there any other way of accessing hardware sensors/variables a.k.a drivers instead of going through the SDK?


    The "Fly" app (along with any built-in apps/widgets) do not use Connect IQ but are instead built natively in C and thus are able to access the hardware and other data directly. All Connect IQ apps are run within the VM/sandbox so there is no way to access anything not exposed via the API.

    Cheers,
    Douglas
  • Good catch dbrobert! Believe it or not, I have trouble sometimes keeping track of which devices run which VMs, so this didn't come to mind when I read through the thread yesterday. Thanks for investigating. :)
  • Brandon - as a future wishlist item, what might be nice is when you get an error like this in the sim, it included that it wasn't supported on this device's VM (as it's valid, just not for this one) in addition to the "symbol not found".
  • Good catch dbrobert! Believe it or not, I have trouble sometimes keeping track of which devices run which VMs, so this didn't come to mind when I read through the thread yesterday. Thanks for investigating. :)


    As the self appointed D2 Bravo "expert" here in the forums (for Connect IQ and general functionality/use) I got your D2 Bravo back, Brandon. :)

    Cheers,
    Douglas