How to control shutter switches via bluetooth - android

I have electric shutter switches (schneider electric, Model: DT1_IT10) that can be controled with an android app via bluetooth (You connect them by long-pressing on the shutter switch and then add them on the phone). I thought that when the app can control them, i can control them, too. So i want to write a remote control in GO.
But i dont have any experience and just need a starting point. So the questions are:
Is this even possible? Maybe the Bluetooth connection is secured?
How and where do i get informations about how to connect to such a device? I couldnt find any information on the manufacturer page.

Yes, this is possible. The magics of free software (as in freedom, not beer) enables us to do whatever we want with the things we own. Protect FOSS, protect our freedom.
Political agenda aside, to answer your questions:
Bluetooth connections are secured, yes. But that does not mean we can't peek and see how they work.
I would start by sniffing the connections (see this and this) and dumping whatever traffic is going through. While doing that, I'd check some libraries for bluetooth in Go (this and this might give you a good idea on that).
It'll not be easy (I've done a few things like that in the past) but if you're into that kind of thing, it'll definitely be fun :)

Related

How to detect if two Android devices are near each other without using GPS?

I am planning a social app that needs a functionality to detect when two people are really close to each other, and preferably something that would be hard to cheat. I know I could use GPS but since there are GPS spoofing apps and the accuracy is not as narrow as I would need (for instance, two people on the same building but many floors apart should yield negative) I wanted to see if I could do it through WiFi or Bluetooth.
Is it possible to have two Android devices detect each other on the same wifi network from an app? No other information besides their presence is necessary.
I know Bluetooth can easily be done if the devices agree on the connection everytime. But I needed automatic detection, meaning the devices would accept the connection only once, and everytime they get close to each other the detection would be automatic without asking for permissions, and without requiring one of them to perform any actions to scan for bluetooth devices. I assume this is not possible for privacy reasons, right? Although no exchange of data is necessary, just the presence.
If anyone has any suggestions of other ways to achieve this, feel free to suggest. I don't need details about the code, just to know what is possible and what isn't and what do I need to look into (for instance libraries or components from the sdk).
I know detecting devices unconditionally is very unlikely to exist, for obvious reasons, but what I am looking for should go through an initial "handshake" or permission between the two devices, in order to enable the detection to happen (over a limited time window of maybe a couple of days), so I guess it may be possible, although I couldn't find anything.

Is there any way to monitor bluetooth traffic?

So, what I want is just to scan the environment and see if any packages are sent without pairing or connecting to a device. Just a general scan of bluetooth in the air and being able to see some of what comes up, like packages exchanged and maybe some information of them. Everything I've read so far is about pairing or connecting first.
Thanks in advance!
The question is old, but since nobody gave an answer I try to fill the gap.
Bluetooth is, because of its technical specifications (frequency hopping etc.), difficult to sniff. A monitor mode like in WiFi doesn't exist out of the box. You would need to scan all Bluetooth channels at the same time. And then there is the challenge that since you managed to detect something, you need to know the next hop (to which channel the devices jump next). There are commercial hardware that can do that. Also some open source projects come up like Ubertooth, but with less capabilities.
You could try to purchase an Ubertooth and play with it.

Can a Bluetooth end device limit what apps can connect to it?

My company is looking at developing a mobile(Tablet) app that will need to connect to various sensors made by others using Bluetooth. These other companies have their own apps to connect with their individual sensors.
I need my app to be able to connect to their hardware (sensors).
Working with each manufacturer... What is the best way for their development teams to offer what I need without giving away all their code? In almost all cases their current sensor and app provide many more features than what we need.
Is there some middle ground where we ask only for the portions of code to perform the couple of functions we need?
Should they even be concerned about sharing their Bluetooth App code when they are the manufacturer of the sensor itself? Our app is only used to talk to their device which still needs to be purchased from them.
It's going to depend on their business model. Just ask. If they are willing to open up their peripheral, they will provide you with the API. Some might charge you for the "SDK".
You may be able to become a vendor and sign some contracts to ensure that they will continue providing the peripherals and support for them to some degree.
If they say no, it's generally not a good idea to reverse engineer it outside of hobby work. If they change their API, you'll have to change the app, and maybe they'll change it just to make your app stop working.
They can't really limit what devices can connect to it, but knowing how to communicate with the peripheral and having any credentials that it might ask for, is a different matter.

Simulate USB/Bluetooth HID device locally in order to inject events?

Is it possible to simulate a USB or Bluetooth device connected to Android?
I would like to make an app which is able to simulate an HID device locally. What I mean by this is: the app should make Android believe that an USB/Bluetooth HID device is connected. This would allow my app to inject touch events globally, I hope. Is there anyway to simulate a (virtual) device? Note that I don't really care about the device, I just want to use the built-in support for HID input.
I know a lot of people already asked about touch event injections but this approach seems to be a little bit different. I do not want to use this for testing purpose, so InstrumentationTestCase and the like won't help.
Rooting the device might be an option, although I can also imagine to ask my endusers to install a specifically signed app manually (according to https://stackoverflow.com/a/16737083/2923406 and https://stackoverflow.com/a/22902808/2923406 this works, but it would be device specific).
I am aware of:
Simulate a mouse input on android - This guy seems to do it in his own app, although his questions wasn't answered ;)
http://www.pocketmagic.net/2013/01/programmatically-injecting-events-on-android-part-2/#.U58SqfldVHV - Needs Root. Did anyone succeeded in using this? Also, the solution seems very device-specific again.
Bluetooth + simulating mouse - That's not what I want. The phone itself should not be an HID device, but use the (virtually created) one itself. Same for this:
https://stackoverflow.com/a/8174973/2923406
Note that I do not want to turn my phone into an HID device of any kind.
Simulating is a broad term. When I created my Bluetooth app I "simulated" a Bluetooth connection in two ways.
Way 1: Use a serial port UART converter and hook it up to a Bluetooth module transmitter.
Then you can use a terminal program like CoolTerm, to send your data.
Like so. In this case I coded in a string to send on successful connection with the device however you can make a infinite loop for testing purposes effectively not requiring your phone to be turned into a HID device.
Way 2 (not easy): Use your computers bluetooth in a server/client relashionship model.
This is harder to do. What you can do is convert your pc/mac into a server and the Android phone into a client or vice-versa. For this you will need to write external code which will need to be compiled separately on a jvm(java virtual machine). The procedure to do this can be found here. If you are using a Linux machine you have to separately download the Bluez module. I have not tried this on any other operating sytem other than Ubuntu, and it was a pain to get functional.
Hopefully that helped.
Yes, it's quite easy using the AOA2 protocol check this & this links for details ( you'll need to switch your device to the Accessory mode )
This may be possible (or at least be easier) using the Robolectric library, which simulates a full Android device locally. Although it is intended primarily for testing, the fact that it simulates a whole device locally - including Bluetooth and USB - means adding to it may be an easier approach.
In other words, you may be able to modify the classes it uses to simulate these abilities locally (i.e. in the IDE itself without an emulator or device) in order to simulate them on the device itself. After all, it does provide full simulations of these functions. You could simply change these Bluetooth and USB simulating classes to load onto the device itself rather than onto the local Robolectric test "device."
This is just an idea though - I can't confirm this will work - it just might be a good place for you to start.

Bluetooth trackball and screen mirroring

I've very interested in a new project, but it requires the user be able to access the phone's display via a wireless trackpad and screen. I'm thinking bluetooth is the best way to go. I can find a few resources regarding the bluetooth classes, but I can't find any resources for mirroring the phone's display or manipulating the ui with a trackball using blue tooth.
Are these two things possible? Could someone give me some information or point me towards some resources?
So you want to remotely control your Android Device with a Trackpad using Bluetooth for the connection? Do you need this for the whole Android System or just for your App?
If just for your App, their should be a way of doing this since communication between two Bluetooth-Devices runs over Sockets (like Client-Server communication). See the Androids Bluetooth API. But I'm also not sure how you plan to make the Android Device understand the Bluetooth-Commands which the Trackpad is sending to it (if you can even get both of them to connect to each other).
If you need it for the whole System, I'm not sure if this is possible (without rooting the phone and maybe writing some drivers for it), as I don't know any way of emulating a touch/click on the screen (which is basically what you want).
Although I know that there are some experiments running to connect a Bluetooth-Keyboard with an Android Device. But their is nothing official yet and nothing to look into (like SourceCode) as far as I can tell.
But maybe I'm looking at this a lot too complicated...

Categories

Resources