NordicThingy52CoinCollector Sample error

Former Member
Former Member

When I try and run the NordicThingy52CoinCollector sample this error appears:


Error: Not Enough Arguments Error
Details: Failed invoking <symbol>
Stack:
- initialize() at C:\Users\PC-User\eclipse-workspace\NordicThingy52CoinCollector\source\Thingy52CoinCollectorView.mc:18 0x10000156
- getInitialView() at C:\Users\PC-User\eclipse-workspace\NordicThingy52CoinCollector\source\Thingy52CoinCollectorApp.mc:51 0x1000012d

The lines which the compiler has identified are:

and

I am basing a project on this sample so it would be good to know if it actually works

Thanks

  • The sample from the 4.0.7 SDK is working fine for me.  Looks like you changed it, as in getInitalView, you need to pass the device manager to the view.

    Here's the getInitialView I see:

        public function getInitialView() as Array<Views or InputDelegates>? {
            var deviceManager = _deviceManager;
            if (deviceManager != null) {
                return [new $.Thingy52CoinCollectorView(deviceManager)] as Array<Views>;
            }
            return null;
        }

    You're passing the ThingyDelegate for the view but that's not correct either.  The ThingyDelegate is for BLE, not the view.

    BluetoothLowEnergy.setDelegate(_bleDelegate as ThingyDelegate);

  • Former Member
    Former Member in reply to jim_m_58

    That's strange, I don't remember changing it at all but I must have. Thanks

  • Former Member
    Former Member in reply to Former Member

    Speaking of BLE development you wouldn't happen to know how to pass in a 4 bit UUID into the longToUuid function?

    It just seems far too small for me especially since the UUID for the UART service is as follows:

  • There are some standard UUIS with 4 digits, like battery power and HR (180F and 180D) for the devices and added a lower 16 digits for both and honestly I can't recall where I found the info to do that.

  • Former Member
    Former Member in reply to jim_m_58

    Okay, thanks 

  • Former Member
    Former Member in reply to Former Member

    For anyone that may run into this problem in the future, firstly my problem was converting a 16 bit into a 128 bit UUID, not 4 bit I must have confused the words bit and byte. I believe the problem is solved through using the technique below: technique:

    Ref. the Bluetooth Core Specification 5.2, Vol 3, Part B, section 2.5.1 UUID:

    "The first UUID in this pre-allocated range is known as the
    Bluetooth Base UUID and has the value 00000000-0000-1000-8000-
    00805F9B34FB

    (...)

    The full 128-bit value of a 16-bit or 32-bit UUID may be computed by a simple
    arithmetic operation.

    128_bit_value = 16_bit_value * 2^96 + Bluetooth_Base_UUID


    128_bit_value = 32_bit_value * 2^96 + Bluetooth_Base_UUID"

    What it means in practice, is that you take a "base UUID" of 0000xxxx-0000-1000-8000-
    00805F9B34FB, and replace the x-es with the 16 bit UUID.

    I have not tried to use these values to connect to the power meter yet and I suspect I may run into some issues in the future as 16 bit UUIDs such as 1800 are fairly standard, but I will continue to update my progress.

  • Yup, that's it!  I must have found this a few years back, as it's exactly what I have for heart rate and battery level in my apps.

    I've included this info as a comment in my code, so next time I forget, I'll have a reference!Grinning

    Thanks!

  • Former Member
    Former Member in reply to jim_m_58

    Oh great, glad to know it works

  • So for battery level, I have this:

    var BATTERY_SERVICE = Ble.longToUuid(0x0000180f00001000L, 0x800000805F9B34FBL);
    var BATTERY_LEVEL_CHARACTERISTIC = Ble.longToUuid(0x00002a1900001000L, 0x800000805F9B34FBL);

    and Heartrate:

    var HR_SERVICE = Ble.longToUuid(0x0000180d00001000L, 0x800000805F9B34FBL);
    var HR_CHARACTERISTIC = Ble.longToUuid(0x00002a3700001000L, 0x800000805F9B34FBL);

  • Former Member
    Former Member in reply to jim_m_58

    Yeah that's similar to what I've got:

    CYCLING_POWER_SERVICE = BluetoothLowEnergy.longToUuid(0x0000181800001000L, 0x800000805F9B34FBL);
    CYCLING_POWER_MEASURMENT_CHARACTERISTIC = BluetoothLowEnergy.longToUuid(0x00002A6300001000L, 0x800000805F9B34FBL);