Bluetooth promiscuity - mergBLE confusion

2020-02-03 Thread Ben Rubinstein via use-livecode



If I execute `mergBLEScanForPeripheralsWithServices` with no parameters, I 
then get a shed-load of `mergBLEDidDiscoverPeripheral` messages, as expected 
(and as warned by the documentation for the service UUIDs parameter:

If empty all discovered peripherals are returned regardless of their supported 
services (not recommended).



One of the many peripherals that `mergBLEDidDiscoverPeripheral` reports has 
the service I'm expecting. If I specify this service UUID in 
`mergBLEScanForPeripheralsWithServices`, I get... exactly the same result as 
before, i.e. all the peripherals in range are discovered, regardless of the 
fact that only one is advertising the service.


I'm also monitoring the `mergBLEPeripheralDidDiscoverServices` message; but 
this is never received.


Another indication that I may not fully understand what I'm doing: I notice 
that of all the peripherals reported via `mergBLEDidDiscoverPeripheral`, only 
one includes any service info - the one which is actually a phone running 
another LiveCode stack which has used `mergBLECreateService`. While it is 
gratifying to find this one, it's surprising to me that none of the large 
cloud of other BLE devices that the scan is picking up advertise any services.


What am I doing wrong?

TIA,

Ben

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: mergBLE usage

2018-04-23 Thread Douglas Ruisaard via use-livecode
Actually... I didn't make that association... so thanks for your help in my 
previous exploits in mergBLE ... *AND*, of course (as you probably guessed), 
your offering this time was spot on!.. I'm still getting a handle on how LC 
handles things like background processing.  I'm used to having explicit 
commands to send code off to run in the background.  So the "timer" code runs 
in the "background" while the BLE commands and functions search for a 
connection.  Cool!  I'll get my head wrapped around this eventually...

As to "dr_mumps", those are my initials "dr" and the MUMPS environment (used 
extensively in the VA hospitals lab systems) is my true expertise

Cheers and thanks again!
Doug

Douglas Ruisaard
Trilogy Software
(250) 573-3935

> 
> Ah... I didn't connect the "Doug" aka dr_mumps with your full name.  (And you 
> can probably guess that
> I'm milbybw).
> 
> That's what I was saying, you need to write your own timeout.
> 
> local sTimeoutCounter
> 
> on openCard
>   -- do your other stuff
>   put 20 into sTimeoutCounter
>   send "timeoutCheck" to me in 100 milliseconds end openCard
> 
> on timeoutCheck
>   -- using "-1" as the signal that we have found a device
>   if sTimeoutCounter = -1 then
> exit timeoutCheck
>   end if
> 
>   subtract 1 from sTimeoutCounter
>   if sTimeoutCounter = 0 then
> answer "Did not find anything in time"
> -- call your timeout handler
>   else
> send "timeoutCheck" to me in 100 milliseconds
>   end if
> end timeoutCheck
> 
> on mergBLEDidDiscoverPeripheral pPeripheral, pName, pRSSI
>   -- in the code where you identify that you have found your particular 
> device, add this
>   put -1 into sTimeoutCounter
> end mergBLEDidDiscoverPeripheral
> 
> 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: mergBLE usage

2018-04-22 Thread Brian Milby via use-livecode
Ah... I didn't connect the "Doug" aka dr_mumps with your full name.  (And
you can probably guess that I'm milbybw).

That's what I was saying, you need to write your own timeout.

local sTimeoutCounter

on openCard
  -- do your other stuff
  put 20 into sTimeoutCounter
  send "timeoutCheck" to me in 100 milliseconds
end openCard

on timeoutCheck
  -- using "-1" as the signal that we have found a device
  if sTimeoutCounter = -1 then
exit timeoutCheck
  end if

  subtract 1 from sTimeoutCounter
  if sTimeoutCounter = 0 then
answer "Did not find anything in time"
-- call your timeout handler
  else
send "timeoutCheck" to me in 100 milliseconds
  end if
end timeoutCheck

on mergBLEDidDiscoverPeripheral pPeripheral, pName, pRSSI
  -- in the code where you identify that you have found your particular
device, add this
  put -1 into sTimeoutCounter
end mergBLEDidDiscoverPeripheral
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: mergBLE usage

2018-04-22 Thread Brian Milby via use-livecode
I’m guessing you have a card that when you open it will initiate a look for
available connections. You have the appropriate handlers in place that work
if one is found. Now you want the card to not wait forever though?

If that is the case, there are a couple threads on the forum that may help:
https://forums.livecode.com/viewtopic.php?f=75=30892
https://forums.livecode.com/viewtopic.php?f=66=30853

When you initialize the card, you need to start a process that checks for
an active connection. If time runs out before a connection is made then
call the exception routine. If a connection is made, cancel the check
process. Here is an example from the other threads:

https://forums.livecode.com/viewtopic.php?f=9=30862#p165981

(Not exact since in that case a device had already been discovered and it
was waiting on a reply message.)
On Sun, Apr 22, 2018 at 10:16 AM Douglas Ruisaard via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Monte... or anyone else brave enough to contribute :-) (no colored emoji,
> sorry) ...
>
>
>
> Is there a way to time out the attempted connection to a BLE device using
> the mergBLE functions.  I can't seem to find a command which doesn't need a
> peripheral UUID  ... like "mergBLEConnectPeripheral pPeripheral" ...  which
> has a corresponding "fail" message: "mergBLEDidFailToConnectPeripheral
> pPeripheral, pError " ... or can I use this command/message combo in some
> way to look for a BLE device and if not present (or if NO BLE device is
> present / active), timeout and fail?  I need my LC code to be able to
> detect whether a BLE device is present and if not "move on" ... right now,
> my modified code, taken from the example mergBLE script, just waits forever
> for a peripheral which may never appear.
>
>
>
> Thanks in advance
>
> Doug
>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

mergBLE usage

2018-04-22 Thread Douglas Ruisaard via use-livecode
Monte... or anyone else brave enough to contribute :-) (no colored emoji, 
sorry) ... 

 

Is there a way to time out the attempted connection to a BLE device using the 
mergBLE functions.  I can't seem to find a command which doesn't need a 
peripheral UUID  ... like "mergBLEConnectPeripheral pPeripheral" ...  which has 
a corresponding "fail" message: "mergBLEDidFailToConnectPeripheral pPeripheral, 
pError " ... or can I use this command/message combo in some way to look for a 
BLE device and if not present (or if NO BLE device is present / active), 
timeout and fail?  I need my LC code to be able to detect whether a BLE device 
is present and if not "move on" ... right now, my modified code, taken from the 
example mergBLE script, just waits forever for a peripheral which may never 
appear.

 

Thanks in advance

Doug

 

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: mergBLE?

2017-12-10 Thread Monte Goulding via use-livecode
The mac side could certainly be done with mergBLE. The iOS side would require a 
Call Directory Extension using CallKit and CoreBluetooth then add that into the 
LC app when building. I think you would be breaking new ground doing that 
though so it would be worthwhile discussing with LC Business Services.

> On 9 Dec 2017, at 11:14 pm, Mats Åström via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> Hi all,
> 
> for a client I would like to build an OSX app that would use the phone number 
> of an incoming call on an iPhone to present the documents associated with the 
> client calling.
> 
> I then need to connect to the iPhone (maybe using mergBLE) and obtain the 
> phone number of an incoming call.
> 
> Is this at all doable in LiveCode?
> 
> /Mats
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

mergBLE?

2017-12-09 Thread Mats Åström via use-livecode
Hi all,

for a client I would like to build an OSX app that would use the phone number 
of an incoming call on an iPhone to present the documents associated with the 
client calling.

I then need to connect to the iPhone (maybe using mergBLE) and obtain the phone 
number of an incoming call.

Is this at all doable in LiveCode?

/Mats
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode