You are reading a single comment by @valap95 and its replies. Click here to read the full conversation.
  • Hi @Gordon,
    I've just implemented a code that allows to stream data via BLE (in my case to a mobile app developed for a specific task). Idk if it is interesting for you (in terms of adding this part to the original app) or others for private use, in any case, I post it in this post.

    import { ActivityStatus, AppState} from './state';
    
    declare var NRF: any;
    
    
    
    
    //Setto i servizi per preparare la connessione 
    function SetServices(state:AppState){
      NRF.setServices({
        // activity services
        'f8b20001-89ad-4220-8c9f-d81756009f0c': {
            'f8b20002-89ad-4220-8c9f-d81756009f0c': {
            descriptio: 'duration',
            notify: true,
            readable: true,
            value: [state.duration]
          },
          'f8b20003-89ad-4220-8c9f-d81756009f0c':{­
              description: 'distance',
              notify:'true',
              readable: 'true',
              value: [state.distance]
          },
          'f8b20004-89ad-4220-8c9f-d81756009f0c':{­
            description: 'speed',
            notify:'true',
            readable: 'true',
            value: [state.speed]
          },
          'f8b20005-89ad-4220-8c9f-d81756009f0c':{­
            description: 'steps',
            notify:'true',
            readable: 'true',
            value: [state.steps]
          },
          'f8b20006-89ad-4220-8c9f-d81756009f0c':{­
            description: 'cadence',
            notify:'true',
            readable: 'true',
            value: [state.cadence]
          },
    
    
        },
        //HR services
        
        'f8b20007-89ad-4220-8c9f-d81756009f0c': {
            'f8b20008-89ad-4220-8c9f-d81756009f0c': {
            description:'HR',
            readable: true,
            notify: true,
            value : [state.hr],
        }
      }       
    });
    
    }
    
    
    
        function UpdateServices(state: AppState): void {
          NRF.updateServices({
            // activity services
            'f8b20001-89ad-4220-8c9f-d81756009f0c': {
                'f8b20002-89ad-4220-8c9f-d81756009f0c': {
                descriptio: 'duration',
                notify: true,
                readable: true,
                value: [state.duration]
              },
              'f8b20003-89ad-4220-8c9f-d81756009f0c':{­
                  description: 'distance',
                  notify:'true',
                  readable: 'true',
                  value: [state.distance]
              },
              'f8b20004-89ad-4220-8c9f-d81756009f0c':{­
                description: 'speed',
                notify:'true',
                readable: 'true',
                value: [state.speed]
              },
              'f8b20005-89ad-4220-8c9f-d81756009f0c':{­
                description: 'steps',
                notify:'true',
                readable: 'true',
                value: [state.steps]
              },
              'f8b20006-89ad-4220-8c9f-d81756009f0c':{­
                description: 'cadence',
                notify:'true',
                readable: 'true',
                value: [state.cadence]
              },
        
        
            },
            //HR services
            
            'f8b20007-89ad-4220-8c9f-d81756009f0c': {
                'f8b20008-89ad-4220-8c9f-d81756009f0c': {
                description:'HR',
                readable: true,
                notify: true,
                value : [state.hr],
            }  
          }     
        });
     }
    
     export {SetServices,UpdateServices};
    

    I added this .ts file to the src folder in my fork of BangleApps and ran using rollup in vs code. Then I took app.js content and with it, I created my own app.

    Kind Regards

    Valerio

About

Avatar for valap95 @valap95 started