We’ve gotten a lot done in the last week for the iOS port of the Bluetooth Plugin. You can check out my work here.
- I’ve finished the MedicalDevicePlugin class.
- Wrote the Command Protocol.
- Wrote a template for the ReturnableCommand class.
- I started on the WorkQueue class, but Carl told me to shift from that to the Invoker class because WorkQueue will be removed sometime in the near future.
- I also wrote the Invoker class but left out the bulk of the implementation as it uses the WorkQueue, so there is no point to code it for now as I don’t know what kind of design we will be using.
- I’ve also pushed a lot of bug fixes to the repo.
Objective-c vs. Java
There were a lot of changes going to iOS from Android. The biggest one was that a lot of the architecture and functions of the Cordova Library in iOS are different than in Android. They still follow the same idea, but are different in implementation. Most of the functions in Android have an iOS equivalent. One of the ones that do not is onActivityResult() in the DevicePlugin implementation. I’ve talked with Carl about this though and it seems that it won’t be that big of a deal since we are planning to remove that function in the future. It seems to me that the Cordova Library for Objective-c is a lot more immature then the Java one. You can see this in the fact that going from version 2.0 (the one that we are using) to 2.3, most of the Objective-c code changes, but almost nothing from the Java code does. This indicates that there is still a lot of work to be done on the Objective-c library. I’m not complaining, but the Java Cordova Library just looks so much nicer.
Another thing that is a lot different are language specific things. For example in Objective-c you cannot specify the visibility level (i.e. public, protected, private) on member functions, and you can’t specify static member variables in exactly the same way as Java. This isn’t a big deal, but it is one of the many things that must change from going to Java to iOS. Another, rather concerning, thing that is different is that Objective-c offers no way to synchronize entire functions. This is a problem because this design paradigm is used a lot in the Java plugin. We will have to find a way around it in Objective-c.
- Caitlin has currently been tackling the BluetoothServer class as well as doing the full implementation of the ReturnableCommand class.
- Vince has been working on the PacketParser implementation. I haven’t heard much from him this week, but I hope he has been making good progress.
After Caitlin gets the ReturnableCommand landed we will be able to start implementing the concrete Command objects that inherit from ReturnableCommand and begin to tie the commands into the Invoker as well as the MedicalDevicePlugin class. I’ve taken on writing the isSupported(), isEnabled(), and isDisabled() commands. Everything is looking good so far baring the problem we may have with the Bluetooth Protocols…
Recently heard from Carl that I should be implementing threads in Objective-c in the Invoker class. It’s up to me how we get that done. So I will be working on that before continuing the Command implementations.