Pilloxa / react-native-nordic-dfu

Nordic Device Firmware Update for React Native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discrepancy in the speed parameter between iOS and Android

DhavalKL opened this issue · comments

When the DFU is in process, it is providing the parameters avgSpeed and speed in the DFUEmitter.addListener.

i.e.

DFUEmitter.addListener(Strings.DFU_Progress, ({
      percent, avgSpeed, speed,
    }) => {
      console.log(`DFU progress avgSpeed: ${avgSpeed}`);
      console.log(`DFU progress speed: ${speed}`);
    });
  })

But the value of the avgSpeed and speed are different in the iOS and Android.
In iOS in the below method in RNNordicDfu.m it is specified that this parameter is in format of BytesPerSecond but in Android I did not found any format related information.

- (void)dfuProgressDidChangeFor:(NSInteger)part
                          outOf:(NSInteger)totalParts
                             to:(NSInteger)progress
     currentSpeedBytesPerSecond:(double)currentSpeedBytesPerSecond
         avgSpeedBytesPerSecond:(double)avgSpeedBytesPerSecond
{
  NSDictionary * evtBody = @{@"deviceAddress": self.deviceAddress,
                             @"currentPart": [NSNumber numberWithInteger:part],
                             @"partsTotal": [NSNumber numberWithInteger:totalParts],
                             @"percent": [NSNumber numberWithInteger:progress],
                             @"speed": [NSNumber numberWithDouble:currentSpeedBytesPerSecond],
                             @"avgSpeed": [NSNumber numberWithDouble:avgSpeedBytesPerSecond],};

  [self sendEventWithName:DFUProgressEvent body:evtBody];
}

Is there any way to get the same output with iOS and Android for the speed information? or can I get exactly what is the unit(format) of speed and avgSpeed?