HTTP server over BLE on nRF5340

I have a use case and I don't know if it's possible. The objective is to have a user tap their standard Android/iOS phone against my nRF5340's NFC antenna, and be able to download a file.

There appear to be a couple ways to transfer files over BLE (e.g. the OTS GATT service), but those seem to require companion apps on the devices to know how to get the file.

Here's my idea:

  1. The device hosts an HTTP server (based on the relevant sample), with the file transmitted in the response payload when a specific HTTP endpoint is requested.
  2. The device runs a HTTP Proxy BLE GATT service (is there a sample for this service?).
  3. User taps phone against the device to do an NFC-bootstrapped BLE connection (relevant sample).
  4. Over NFC or a QR code printed on the device, the phone gets a URL corresponding to the URL that serves the file.
  5. (This is the part where I need help): The phone makes a request to that URL, which is routed over the BLE connection to the HTTP proxy service on the device, which routes it to the local device-hosted HTTP server that serves the file.

For step 5, how do I get the phone to route the HTTP request over the BLE connection instead of over its normal LTE/5G cellular connection?

If there's another way of achieving this file transfer without requiring an app install on the phone, I'd love to hear that idea as well!

  • Hi,

    The device hosts an HTTP server (based on the relevant sample), with the file transmitted in the response payload when a specific HTTP endpoint is requested.

    This sample does not have support for nRF5340 itself, only the 7002DK, which also offers WiFi connectivity.

    The device runs a HTTP Proxy BLE GATT service (is there a sample for this service?).

    I'm not sure if this service works the way you expect. Please have a look at this post. You would need to be running TCP/IP stack running on the device to support this. You can use 6lowpan over BLE to support IP over BLE, but I doubt that this is supported in phone OSes.

    (This is the part where I need help): The phone makes a request to that URL, which is routed over the BLE connection to the HTTP proxy service on the device, which routes it to the local device-hosted HTTP server that serves the file.

    I would be surprised if the phone OSes supports this service natively. You would most likely have to implement this in an app.

    If there's another way of achieving this file transfer without requiring an app install on the phone, I'd love to hear that idea as well!

    I don't think this would be possible to support without a dedicated app. An then I think it would be much easier to implement it using for instance the OTS than using HTTP.

    Best regards,
    Jørgen

Related