polarofficial / polar-ble-sdk

Repository includes SDK and code examples. More info https://polar.com/en/developers
Other
447 stars 147 forks source link

Question about Using startOhrStreaming() in Polar SDK #415

Open umizuki317 opened 7 months ago

umizuki317 commented 7 months ago

Platform your question concerns:

Device:

Description:

The issue is that I can successfully stream PPI values using the Polar SDK library with Verity Sense, but I'm having trouble with PPG streaming using mApi.startOhrStreaming().

The relevant code is provided below:

private void PPIStreaming(String sensorID) {
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
        mApi.startOhrPPIStreaming(sensorID)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(
                        new io.reactivex.rxjava3.functions.Consumer<PolarOhrPPIData>() {
                            @Override
                            public void accept(PolarOhrPPIData ppiData) throws Exception {
                                for (PolarOhrPPIData.PolarOhrPPISample sample : ppiData.samples) {
                                    Log.d("SENSOR","value:"+sample.ppi);
                                }
                            }
                        },
                        new io.reactivex.rxjava3.functions.Consumer<Throwable>() {
                            @Override
                            public void accept(Throwable error) throws Exception {
                                Log.e("PPI", "PPI stream failed. Reason: " + error);
                            }
                        },
                        new io.reactivex.rxjava3.functions.Action() {
                            @Override
                            public void run() throws Exception {
                                Log.d("PPI", "PPI stream complete");
                            }
                        }
                );
    }
}

The questions are as follows:

  1. How can PPG streaming be used in Java with Polar SDK?
  2. How should I define PolarSensorSetting in Java for use with the Polar SDK in java? I'm having trouble understanding how to use mApi.startOhrStreaming() for PPG streaming. Do you have any insights or suggestions on what might be causing this issue?