Hello all! I am trying to make Gideros talk to a sensor peripheral (accelerometer and such) via BLE. I'm using the Red Bear Labs BLEmini board (redbearlab.com/blemini/), and I can successfully talk with it using Red Bear's sample Xcode project (github.com/RedBearLab/iOS). Searching around this forum / the rest of the internet, it seems the way to add Bluetooth functionality to a Lua script framework is via a plugin. I used @OZApps very nice plugin tutorial to get started (howto.oz-apps.com/2013/11/creating-plug-in-for-lua-framework.html), and can successfully send data to and from the test.mm plugin.
All good so far! So I rebuilt GiderosiOSPlayer with the BLE (github.com/RedBearLab/iOS/tree/master/BLEFramework/BLE) and CoreBluetooth frameworks. However when I try to initialize a new BLE object I run into trouble. I added
at the top of test.mm, and then attempt to init the BLE object using
bleShield = [[BLE alloc] init];
from inside the test() function in test.mm. When calling
local t = require "mytest"
from Gideros Studio, I get the following error:
main.lua:33: Error calling 'init' on ''
Could not find function named "init" associated with object BLE(0x15e66b50).(It may have been released by the GC)
stack traceback: main.lua:33: in main chunk
I'm definitely out of my depth here hacking around with the C++ / ObjC code. Can anyone point me towards a resource which might get me closer to BLE integration? I think this would be quite a nice addition to the world of Gideros, and I am more than happy to share my progress.