Generic BLE Scan?

it it possible to enable scanning without a specific scan profile?

I'd like to get a list of all available Bluetooth devices nearby and parse services and characteristics programmatically.

For example, I'd like to find any devices that have '0x1826' in either long form or short form, or be able to search for several services to support custom fitness machine services like Precor  in the same app that supports standard FTMS, etc.

It seems like the BLE 'Profile' has option for only a specific service and I have to explicitly declare the characteristic I want?

can I include multiple characteristics? 

can I enable notification for more than 1 characteristic at a time?

Anyone have a code sample of a generic BLE scanning tool that runs on Connect IQ / watch?

  • Here's an app of mine that scans looking for any ble devices that can be seen with CIQ - BleScan

    https://apps.garmin.com/apps/9bcc8b66-8385-4afb-b93e-f69e01422284

    Nothing is "learned" over BLE with CIQ so it doesn't show services or characteristic, but you can see that with nRFConnect on a phone.  But understand, it may also show devices and additional info you can't see with CIQ.

    If you look at the NordicThiny52 sample in the SDK, you can see something similar by adding 1 line to the contains function in the BleDelegate (ThingyDelegate.mc)

        private function contains(iter as Iterator, obj as Uuid) as Boolean {
            for (var uuid = iter.next(); uuid != null; uuid = iter.next()) {
    //Add this line
    //System.println(uuid.toString());    
                if (uuid.equals(obj)) {
                    return true;
                }
            }

            return false;
        }
  • with my existing code I have

        private const _fitnessProfileDef =
        {
            :uuid => FITNESS_MACHINE_SERVICE,
            :characteristics => [
            {
                :uuid => STAIR_CLIMBER_DATA_CHARACTERISTIC,:descriptors => [BluetoothLowEnergy.cccdUuid()]
            },
            {
                :uuid => FITNESS_MACHINE_FEATURE_CHARACTERISTIC                
               
            },
            {
                :uuid => FITNESS_MACHINE_CONTROL_POINT                
               
            }]
        };
        function initialize()
        {
            BluetoothLowEnergy.registerProfile(_fitnessProfileDef);
             ...
        }

    Would I just skip registering a profile to not limit what devices I receive from onScanResult()?
  • shouldn't I be able to parse advertised services from the scanResult?

  • Try BleScan.  You can see the advertised UUID for most devices but there a number of things you can't see

    Again, CIQ doesn't "learn" things over BLE.  It's a very basic implementation.  You need to hardcode them in the profile Manager logic.

    Here's the video from when it was announced:

    https://forums.garmin.com/developer/connect-iq/b/news-announcements/posts/adding-bluetooth-connectivity-to-your-connect-iq-projects