Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Bluetooth (plugin.bt) - Read data from buffer (smart wristband)
Started by a.sobreiroduarte Jan 10 2018 04:25 AM

7 replies to this topic
bluetooth
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

a.sobreiroduarte

[GLOBAL: userInfoPane.html]
a.sobreiroduarte
  • Observer

  • 1 posts
  • Corona SDK

Hi,
 
Is it possible to read buffer data from a smart wristband with this plugin?
 
In the documentation I can not find a "bt.read()"
 
Thanks,
António
 


[TOPIC: post.html]
#2

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,822 posts
  • Enterprise

You can receive inside .init

bt.init(function (event)
    
    if (event.type == "message") then
        native.showAlert( "Message Received", "Name:"..event.message, {"Ok"} )    end
end)


[TOPIC: post.html]
#3

g921002

[GLOBAL: userInfoPane.html]
g921002
  • Observer

  • 4 posts
  • Corona SDK

I had tried to sent data to device, but no event called. Have any suggest to this problem?

 

Phone type

Galaxy J7

Android 5.1.1



[TOPIC: post.html]
#4

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,822 posts
  • Enterprise

The plugin will only accept string data

[TOPIC: post.html]
#5

g921002

[GLOBAL: userInfoPane.html]
g921002
  • Observer

  • 4 posts
  • Corona SDK

Yes, I had used the "0123456789" string for testing via pc uart port.

Due to the froum info. It had seen no one have the same problem. May be I had been something wrong in programing or my hardware too old.XD

The bt.send is ok for checking connecting.

[TOPIC: post.html]
#6

Scott Harrison

[GLOBAL: userInfoPane.html]
Scott Harrison
  • Corona Geek

  • 1,822 posts
  • Enterprise

Have you tried using letters

[TOPIC: post.html]
#7

g921002

[GLOBAL: userInfoPane.html]
g921002
  • Observer

  • 4 posts
  • Corona SDK

Thanks your help.

It suddenly can work and I don't know why. XD

"0123456789" and "ABCDEFGHabcdefgh" are ok both.  :P 

 

/*add info*/

I found my mistake. it should be add "\n"



[TOPIC: post.html]
#8

jason.carnahan99

[GLOBAL: userInfoPane.html]
jason.carnahan99
  • Observer

  • 1 posts
  • Corona SDK

 

 

I found my mistake. it should be add "\n"

Would you mind expanding on your solution? Thanks!




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: bluetooth