Bluetooth Low Energy

Hi dear,

I’m testing your plugging due I need a way to connect one device with other. The idea is to transfer a little amount of data, and, if possible, perhaps a file with about 10-20Kbyts.

Can your plugging allow to connect 2 devices (android or iOS in future), that run the very same lua application, and can send/receive information between two devices?

Thanks again,

Yes, that’s the goal of the plugin.

I’m trying to connect to my Polar H7 device with my Android phone without success.

When the App starts I can see the Init event: {“name” “init”, “isError”: false}. I’ve switched all “print” to “showAlert” in order to see them on my device.

After that, if I tap the “Start Scan” button, nothing happens. “Is active?” button says “Yes”.

I’ve seen that gc34 accessed succesfully to the H7, so maybe am I missing something?

UPDATE:

I’ve tried it with another device and it worked. I have no idea what’s wrong with my Z3…

Could someone kindly guide me on how to send a character once connected to a device? I can’t seem to get this working.

Dear, could you share a little chunk of code where we can understund how to connect 2 devices (2 smartphones running corona app) and send from one to other some file?

As mentioned, i need to send from one smartphone to other a file, and im testing with this bt and also thinking in nfc plugging. For example, remember the bump app where installing it in both smartphone you cand share and send photos or other from one device to other? Thats what i need for my app. Possible? Thanks so much for your great job and support.

Hi, 

Any updates on this plug-in? Please let me know if there is any further work planned for this anytime soon. If not I will try to look into another SDK as bluetooth is now essential for communication for my project and I cannot keep waiting. 

Thank you. 

rsp355, hi. Sorry, there won’t be any work on that plugin for a while. Too complex to support and I don’t have the time for that unfortunately.

Thanks.

Hi there,

Thanks very much for creating this BLE library…

Just getting started with having a go at Corona and Bluetooth, and just wondered if anyone could point me in the right direction. All I need to do is list all the currently available BLE devices (unpaired or paired). What code would I use to do this?

I’m guessing from the example code it is something similar to this:

 bluetooth.startScan(function (event)

            if event.device.name == deviceToSearch then

                device = event.device

            end

            print(‘Scan event:’, json.prettify(event))

        end, 5000)

But instead of checking if each device matchs the search string (deviceToSearch), it just appends it into an array?

Thanks!

Hello,

Please can some one help? I’m trying to use the bluetooth plugin but keep getting the following error message:

ERROR: Runtime error/Users/liamyoung/Desktop/Mirror/Smart Mirror/ENGINE/storyboard.lua:1642: module 'plugin\_bluetooth' not found: no field package.preload['plugin\_bluetooth'] no file '/Users/liamyoung/Library/Application Support/Corona/Simulator/Plugins/plugin\_bluetooth.lua' no file '/Users/liamyoung/Desktop/Mirror/Smart Mirror/plugin\_bluetooth.lua' no file '/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/plugin\_bluetooth.lua' no file '/Users/liamyoung/Library/Application Support/Corona/Simulator/Plugins/plugin\_bluetooth.dylib' no file './plugin\_bluetooth.dylib' no file '/Applications/CoronaSDK/Corona Simulator.app/Contents/Resources/plugin\_bluetooth.dylib'

I’ve added the plugin in build settings and then the required plugin request in Menu Scene but every time it says the plugin can’t be found. I’added the two bits of code in my app for using the bluetooth plugin. 

Build Settings:

plugins =          {                 ['plugin.bluetooth'] =                  {                     publisherId = 'com.spiralcodestudio',                     supportedPlatforms = { android=true };                 },         },

Menu Scene:

local bluetoothObj = require( "plugin.bluetooth" );

I’m currently using Enterprise v2016.2830, hopefully that not the cause as it not to old of a version of Corona. 

Many thanks

Liam 

The minimum build of Corona that works with the Bluetooth plugin is 2906.

Rob

I have an problem in Scanning Near by devices

It will not show the all mobile device.

Any solution for this…??

Thank you

I have also same problem with BLE plugin…

Mobile devices which having bluetooth is ON but its not showing those devices…

Please help me out

Hi, i’m new in corona labs.

How can I use the plugin to check the status of the bluetooth, without receiving the alert message where the user activates or rejects it?

Thanks in advance for your answer.

Solón

My plugin can check that

https://marketplace.coronalabs.com/plugin/bluetooth-for-android

I noticed that the BLE code hasn’t been updated in about a year. I am curious if I can still use it for my current project or if it is dead in the water because it might take me a while to figure it out (I am a novice). Also, does it work with iPhone? Lastly, I saw that @Lerg is too busy to work on the project as of May. Is this still the case?

Thanks

Hi @jonathan.carle.  Really, only @lerg can answer this question. Maybe send him a PM?

Rob

Hi…i am a new user here. In my case I need a way to connect one device with other. The idea is to transfer a little amount of data, and, if possible, perhaps a file with about 10-20Kbyts.Can your plugging allow to connect 2 devices , that run the very same lua application, and can send/receive information between two devices?

printed board assembly

Good evening

I’m using this LERG plugin.

I was able to connect to the bluetooth module and read the feature.

my code:

           if event.name == ‘onConnectionStateChange’ then

                event.gatt:discoverServices() 

            end

            

             if event.name == ‘onServicesDiscovered’ and not event.isError then

                local services = event.gatt:getServices()

                for i = 1, #services do

                    print(‘Service:’, json.prettify(services[i]))

                    testo3.text = json.prettify(services[4])

                    testo1.text =  #services

                    local characteristics = services[4]:getCharacteristics()

                    

                    for j = 1, #characteristics do

                        timer.performWithDelay(j * 3000, function()

                            event.gatt:readCharacteristic(characteristics[j])

                        end)

                    end

                end

            end

   

           if event.name == ‘onCharacteristicRead’ and not event.isError then

                testo1.text = event.characteristic:getValue()  

           end

           

           

           if event.name == ‘onCharacteristicWrite’ and not event.isError then

                event.characteristic:SetValue("")  

           end

            

        end

        bluetooth.connect({

            device = device,

            autoconnect = true,

            onCharacteristicChanged = listener,

            onCharacteristicRead = listener,

            onCharacteristicWrite = listener,

            onConnectionStateChange = listener,

            onDescriptorRead = listener,

            onDescriptorWrite = listener,

            onReadRemoteRssi = listener,

            onReliableWriteCompleted = listener,

            onServicesDiscovered = listener

        })

    end}

now the problem I could not write the feature.

I added the event ‘onCharacteristicWrite’ but I never go there.

can someone help me with a small code?

I need to write a string to the module’s characteristic

I really need it for a project to be delivered right away.

Please help me

Thank you all

I’m sorry for the lack of response but it seems to have found what I need.

I can not just disconnect the bluetooth module through the command:

bluetooth.disconnect (address)

As an address I tried both to enter the address of my module as a string and to take it as the value of the bluetooth function:

         bluetooth.startScan (function (event)

              if event.device.name == deviceToSearch then

                 device = event.device

                 address = device.address

             end

         end, 5000)

the only way I have to disconnect my bluetooth module is to use event.gatt: disconnect () but I do not like the operation.

Can someone help me or tell me if there is a problem in the plugin ??

Best regards