0

Can anyone help please! I am trying to change the accelerometer range for the Movesense Sensor in Android Studio from the standard 8G to 16G.

I keep getting the 'Bad Request' error. I have had no problem with using PUT requests for other things (e.g. switching the LED on/off) but for some reason I can't change the accelerometer range. I have tried changing the format of the contract part of the request but this has not solved the problem. I am new to programming the Movesense. Thank you.

My code is:

private final String LINEAR_CONFIG_PATH = "/Meas/Acc/Config";
private final String range = "{\"GRange\":";
private final String rangeValue = "16";

Mds.builder().build(this).put(MdsRx.SCHEME_PREFIX +  
MovesenseConnectedDevices.getConnectedDevice(0).getSerial()+
LINEAR_CONFIG_PATH , range + rangeValue +"}", new  
MdsResponseListener() {

1 Answers1

0

the API (yaml) document of the /Meas/Acc/Config states:

put:
  description: |
    Set linear acceleration measurement configuration.
  parameters:
    - name: config
      in: body
      description: New configurations for the accelerometer.
      required: true
      schema:
        $ref: '#/definitions/AccConfig'

The name of the parameter is "config". so the JSON you put to the request should be:

{
  "config":{"GRange":16}
}

i.e it has to be wrapped to a property with the name of the put parameter (in some API's there are multiple parameters so this is the way to set them all).

Full Disclosure: I work for the Movesense team

PetriL
  • 1,211
  • 1
  • 7
  • 11