Well, I'm making progress but this iOS app stuff is a little bit tricky! Just about everything I proposed to do on this project I've had some familiarity with EXCEPT iOS apps. In fact, I've never made a mobile phone app but I've always wanted to. I'm glad I'm finally getting around to learning how to do this, but at the same time, it's really challenging trying to learn a new language in such a short period of time.
I decided to learn how to do this in the new Apple language, Swift. I had read a bit about this language a few months ago, that Apple is really trying to push its developers to this language and that they've spent a lot of effort trying to improve it and make the language more robust. I have to say, it has some neat properties that I have not seen elsewhere. The problem, however, is that Swift is changing all the time. I'm having trouble following tutorials that were written only a year ago because of all the changes going on.
Right, so that's a headache but let's take a look at that screenshot. This is the only part of the whole project that is being coded in OS X, the rest has been coded in Arch Linux/Raspbian. What you see is XCode, Apple's programming IDE. I've tried to use it in the past for other languages but I've always hated its clunkiness but when it comes to iOS development, it really does shine.
You can see the basic layout of the app. There is a login screen that asks for the driver's name. The driver enters his/her name and then the code takes that name, parses it and sends it to the web server for verification and feedback. I'm using this tutorial: https://twitter.com/dave_on_Cape/status/574734739472584704 as my guide and modifying it as I go. You can see in the bottom windows that it's actually tried to run the code that connects to the server, but I haven't finished writing it so of course it sends a response of "404", meaning the verification script (a PHP file that has yet to be written) was not found.
Here's what the layout looks like on an iPad. For the pizza delivery management side I am designing the web interface to be accessible via a tablet. I've noticed that lots of restaurants make use of tablets. It seems a lot easier to use that than a clunky laptop. Anyway, you can see a little black squiggly line on the map. That's some dummy GPS data that I used to test overlaying GPS coordinates onto a Google map. It's not that difficult to do, all you need to use is GeoJSON. There is actually a nifty website (geojson.io) that will format your data for you so you don't really have to learn how to do the formatting yourself.
Things are moving along. The app building is the most challenging thing right now. I still need to write the code to link the back end to the front end but that really isn't that difficult. I do that sort of thing everyday at the lab! What's left after that is to port everything onto the Raspberry Pi 2 and then get real sensor data flowing. Luckily, I wrote the sensor code a long time ago (remember all the headaches with mosquitto?). All I have to do is have the PHP code find the directory where the sensor data is and store those files in the appropriate tables in the database.
Until the next post...