0

Need to understand the proper settings behind the BEEP and VIBRATE settings using the Capture SDK. When setting the DEVICE_RUMBLE_CONFIG to 1 or 0 it seems I get an error and nothing is changed. Same issue with DEVICE_SOUND_CONFIG.

if (getBRSharedPreferenceBoolean(PreferencesActivity.PREF_SOCKET_SCANNER_VIBRATE, false)) {
  mDevice.setProperty(Property.create(Property.DEVICE_RUMBLE_CONFIG,1), propertyCallback);
} else {
  mDevice.setProperty(Property.create(Property.DEVICE_RUMBLE_CONFIG,0), propertyCallback);
}

if (getBRSharedPreferenceBoolean(PreferencesActivity.PREF_SOCKET_SCANNER_BEEP, false)) {
  mDevice.setProperty(Property.create(Property.DEVICE_SOUND_CONFIG,1), propertyCallback);
} else {
  mDevice.setProperty(Property.create(Property.DEVICE_SOUND_CONFIG,0), propertyCallback);
}

PropertyCallback propertyCallback = new PropertyCallback() {
        @Override
        public void onComplete(@Nullable CaptureError captureError, @Nullable Property property) {
            if (captureError != null) {
                Log.d("onComplete", String.format("capture error %s", captureError.getMessage()));
            } else {
                if (property != null) {
                    Log.d("onComplete", String.format("property set %d", property.getId()));
                }
            }
        }
    };
Enrico
  • 10,377
  • 8
  • 44
  • 55
Mark
  • 190
  • 1
  • 11

1 Answers1

1

I finally figured it out...went to look at the old code and realized I was using the wrong configuration ID's. Here are the right ones...One additional note about the code below is that I'm including FLASH in the beep and vibrate option by selecting ACTION_ALL.

if (deviceClient != null) {

            if (beep && vibrate) {
                Property property = Property.create(Property.DEVICE_LOCAL_DECODE_ACTION, LocalDecode.ACTION_ALL);
                deviceClient.setProperty(property, p);
                Log.d("configureSocket", "RUMBLE and BEEP");
            } else if (beep) {
                Property property = Property.create(Property.DEVICE_LOCAL_DECODE_ACTION, LocalDecode.ACTION_BEEP);
                deviceClient.setProperty(property, p);
                Log.d("configureSocket", "BEEP");
            } else if (vibrate) {
                Property property = Property.create(Property.DEVICE_LOCAL_DECODE_ACTION, LocalDecode.ACTION_RUMBLE);
                deviceClient.setProperty(property, p);
                Log.d("configureSocket", "RUMBLE");
            } else {
                Property property = Property.create(Property.DEVICE_LOCAL_DECODE_ACTION, LocalDecode.ACTION_NONE);
                deviceClient.setProperty(property, p);
                Log.d("configureSocket", "NO BEEP OR RUMBLE");
            }
        }
Mark
  • 190
  • 1
  • 11
  • Hey @Mark I was facing this same problem and it's get resolve based on your answer. but Do you know How we can get current status of scanning device. I had tried below but not get any luck. client.getProperty(Property.create(Property.DEVICE_LOCAL_DECODE_ACTION), (captureError, property) -> { if (captureError == null) { Log.e("Tag", "Pro : " + property.getInt()); } }); – Chirag Solanki Apr 22 '22 at 06:38
  • Chirag, I'm not sure what you are trying to do. Are you trying to check if the device is ON or OFF? – Mark Apr 25 '22 at 15:12
  • No no Mark I was trying to get current Beep and Vibration status of scanner device – Chirag Solanki Apr 27 '22 at 09:13
  • Ah...I've not been able to get it to work but here's what I would try. deviceClient.getProperty(Property.create(Property.DEVICE_RUMBLE_CONFIG), propertyCallback); – Mark Apr 28 '22 at 17:57