-
• #2
Hi,
If you can find a way of sending a call from a keyboard shortcut (or sequence of keys) then it should be pretty easy to set Puck.js up as a keyboard to make the required keypresses.
Otherwise you'll need an app - you could make your own, or there's almost certainly a keyboard shortcut app available.
-
• #3
Wat about the DroidScript app?
Making a call from within your DroidScript app seems built in, using BLE API s could require paid plugins.
-
• #4
Yes, I forgot about that - that'd be a nice easy solution.
-
• #5
If your phone is rooted, and you have installed Tasker, (and understood its' complexities) then I would think what you want to achieve might be possible. Bluetooth Tasker Wiki search - might lead to some recipes, or maybe onto other clues.
-
• #6
+1 for Tasker - I did something similar with the amazon dash buttons
http://daniel-stone.uk/2016/09/27/amazon-dash-with-tasker.htmlYou'd have to work out how to get the puck to post some sort of notification to your phone, or maybe Tasker can listen for bluetooth messages..
-
• #7
The reason I piped up was one of the most useful Tasker recipes I found was "disable wifi if out of range of either home wifi or office wifi". Given the plethora of MITM (Man in the middle) attacks and access point spoofing, this stuck in my mind. I am guessing its the same with Tasker and Bluetooth. "When x happens send SMS" features quite a lot on Tasker, so I'd be surprised if you couldn't make a call.
-
• #8
It works with an APP. You simply need to listen for advertising. Take a look at stackoverflow for working code.
-
• #9
Just to add: Can Android be set up to associate a long-press of a key with calling someone in particular like you used to be able to do with older phones? Puck.js acting as a HID device could easily long-press a number key.
-
• #10
I think there are two solutions : a. use Bluetooth phonebook access profile (pbap) when bonding gets implemented. This is the way car stereos do the call. b. use telerik NativeScript that's basically JavaScript doing native API calls to the device. This way you can use puck with the HID profile https://www.npmjs.com/package/nativescript-phone
-
• #11
Cool - thanks! I wonder whether PBAP works over Bluetooth LE? If so that'd be excellent
-
• #12
I have used below code, that was mentioned in this link npmjs.com/package/nativescript-phone but I am getting error - execution interrupted.
var phone = require( "nativescript-phone" );
phone.dial("212-555-1234",false); -
• #13
Are you trying to run that on Espruino? If so that won't work - NativeScript is meant to run on phones: https://www.nativescript.org/
-
• #14
Ok, how I will know in my nativescript app that puck is clicked and now app should call the number.
-
• #15
There are a whole lot of threads on this kind of thing already. Either:
- Set Puck.js up to advertise the state of the button - subscribe to BLE advertising events with nativescript and then call the number then.
- Set Puck.js up as a BLE HID device - you can then just set a listener up for a specific keypress
- Keep a connection to Puck.js open and set yourself up to be notified if a characteristic changes - that's the way you'd do it with normal BLE devices, but it's a bit more trouble
- Set Puck.js up to advertise the state of the button - subscribe to BLE advertising events with nativescript and then call the number then.
-
• #16
Hi Again,
After doing some research I came across button (Flic) which is similar to puck.js.
https://partners.flic.io/partners/developers/android-tutorial
We can integrate this with our android app but the problem with this is we have to install its default app to integrate it with android phone, which I don't want to use.I want to know is there a similar way to just listen when Puck button is clicked? If got when button is clicked at my android app then I can write code in my android app which can make phone call.
Regards
-
• #17
Yes. See the post I wrote above.
-
• #18
The Puck plugin (BLE) is free in DroidScript. It should be very easy in DroidScript too. Probably take about 5 mins to write
-
• #19
OK, I was wrong. It took 2 minutes :)
Here is the code:-
app.LoadPlugin( "PuckJS" ); function OnStart() { lay = app.CreateLayout( "Linear", "VCenter,FillXY" ); txt = app.CreateText( "Press your puck" ); lay.AddChild( txt ); app.AddLayout( lay ); puck = app.CreatePuckJS(); puck.SetOnConnect( OnConnect ); puck.SetOnButton( OnButton ); puck.Scan( "Puck" ); } function OnConnect() { puck.WatchButton( true ); } function OnButton( state ) { app.Call( "01359555555" ); }
-
• #20
You could also build a DroidScript service which stays always running in the background and watches for the button presses.
-
• #21
Here is a more sophisticated solution that does not require a constant (battery draining) connection:-
http://forum.espruino.com/conversations/298102/#comment13448826
-
• #22
Thanks Dave, at android side I am using android studio. So is there any link or guide for achieving this using android studio?
Hi All,
I want, that when I press Puck.js a phone call can be made from android mobile.
Is this feasible?
Regards
Sachin