0

I am trying to connect to the local server using the "MDS REST Bridge" app. My PC and mobile device are connected to the same Wi-Fi network, and I have successfully opened the main page, which is attached to this post.

however i'm unable to use any of the command which described in the preview page.

i'm sending the /Connect command to the URL (http://ip-address/Connect) but it didn't work. "Not found" error showing on page.

I have attached a screenshot of the main page I opened on the local server to this post. I am also attaching a link to the application that I am using. MDS_REST_Bridge_alpha_debug.apk

enter image description here

I am unable to find proper documentation for this application. Can you provide details on how to use the application, send commands, and receive responses?

1 Answers1

0

Yes, the REST bridge is not quite there yet, when it comes to documentation. Here's the piece of python code I use to make the connection:

    def _connect_sensor(self):

    connect_url = "http://" + self.server_addr + ":8080/Connect"
    payload = {"address":self.mac}

    logger.debug("requests.post: "+ connect_url + ". payload: " + str(payload))
    try:
        response = requests.post(connect_url, json=payload)
    except requests.exceptions.RequestException as e:
        # In all connection errors etc, return false
        logger.debug("REST request exception: %s" % str(e))
        return False

    # If response was 2xx, store Location and return true
    if response.status_code < 300:
        logger.debug("response.json: "+ str(response.json()))
        self.connected_serial = response.json()["serial"]
        logger.debug("connected_serial: "+ self.connected_serial)
        return True

    logger.info("REST connec request: status: %s"
                % str(response))
    return False

So in short:

To make the connection, send a json payload with the "address", which contains the BLE MAC-address of the device you want to connect to. The returning response will be json object which has "serial" containing the connected devices serial number.

Full disclosure: I work for the Movesense team

PetriL
  • 1,211
  • 1
  • 7
  • 11