Bluetooth 2 Logo

Improving an SDK With Core Bluetooth

This entry is part 1 of 7 in the series Improving an SDK With Core Bluetooth

This series will pick up where the last series left off. It should be fairly quick, relatively.

If we do a recap of our conclusion, we were left with the following list of “TODOs”:

  1. The error handling is primitive, at best.
    We didn’t really do much to capture errors. We have the ability in the apps to catch and display them, but we didn’t take advantage of this in the SDK.
    This was mostly because I wanted to keep the lesson as simple and to-the-point as possible. If it were a “shipping” SDK, error handling would have been one of my first priorities.
  2. The Central “locks up” Peripherals.
    Because we connect, then hold the connection, a Peripheral is dedicated to a Central. It might be nice to allow a Peripheral to be used by multiple Centrals.
  3. We could put the entire Peripheral functionality inside the SDK.
    We could remove the ability to select a response, thus pretty much obviating the need for user intervention. It could be entirely possible to simply do the response automatically in the SDK, and report the results to the Peripheral user.
  4. It would be nice to know whether or not the question made it to the Peripheral.
    At the moment, we have the .writeWithoutResponse property set on the question, so we aren’t sure that the question made it to the Peripheral. We can ask the Peripheral to let us know if the question made it.
  5. This barely scratches the surface of Bluetooth Programming.
    Agreed. The purpose of this series (so far) has been to introduce Core Bluetooth. I expect to be exploring Bluetooth programming much further, and will use this SDK as the vehicle for that.
  6. The iOS app doesn’t clean up after itself very well.
    The Mac app closes all resource connections when it quits, but the iOS app can “hold the connection open.” That’s really something that would require work on the apps, as well as the SDK.
  7. We’re Not Sure Who’s Asking the Question.
    It would be nice to have a label on the Peripheral screen that showed who was asking the question.
  8. The App is Pathetic
    Yeah…It’s just enough to show that the SDK works. We can do better.
  9. We could explore Bluetooth “Classic” (BR/EDR) with this project.
    We’re using BLE for this, and it’s really the perfect type of task for BLE, but this would also be something that could be done with Bluetooth “Classic.”

In this series, I’d like to avoid touching the apps, and only work on the SDK, so that leaves out 6 – 9.

Which leaves us with this:

  1. Improved Error Handling
  2. Ephemeral Connections
  3. Automatic Peripherals
  4. Confirmed Question Delivery

5 isn’t really something that we “do.” It should percolate out of the work we are doing to meet the first four requirements.

So that gives us a fairly succinct and achievable project plan. I am going to take the liberty of rearranging them, though:

  1. Automatic Peripherals
  2. Ephemeral Connections
  3. Confirmed Question Delivery
  4. Improved Error Handling

Even though “Improved Error Handling” is listed as #4, I plan to address it as we work on the other three items.

The idea is that we don’t touch the apps at all. The Apps-src directory should remain exactly the same as it was at the beginning of the last series.

Let’s review what we’ll be tackling…