AnsweredAssumed Answered

service is not defined error when running bluetooth developer studio plugin

Question asked by Fittrack GmbH on Oct 11, 2017

Hi!
While running the bluetooth developer studio plugin v1.0.0 code generator with some custom services I was running into a runtime error "service is not defined".

I digged a bit into the code of Plugin.js and found that the variable service is indeed used without declaration and that the following changeset to fix the issue.

 

@@ -741,7 +741,7 @@ function GetGapScanningAndAdvertisingData() {
         for (var i = 0; i < GAPProperties.ServicesAdvertisement.length; i++) {
             var serviceAdvertisement = GAPProperties.ServicesAdvertisement[i];
             // generate only custom services
-            if (serviceAdvertisement.Selected && isCustom(serviceAdvertisement) && service.UUID.length > 8) {
+               if (serviceAdvertisement.Selected && isCustom(serviceAdvertisement) && serviceAdvertisement.UUID.length > 8) {
                     var uuidArray = serviceAdvertisement.UUID.match(/.{1,2}/g)
                          .map(function (a) {
                               #return "0x" + a;

 

This is just to let both NXP know about the issue and help others in the same situation.

 

Kind regards,

Bernhard

Outcomes