see the packets sent in nrf connect debugger - bluetooth

I'm trying to see what a specific app is sending via Bluetooth.
I open the app on my android phone and the NRF-Connect app and started debugging the connection.
when I'm using the app I can see the logs that I'm receiving but not the ones I send.
How can I see what my phone is sending?
NRF also allows cloning the device's services. Is there an option to mimic the device, so the app would connect to my phone and not the real device then I would be able to see the packets I receive?
other options not including NRF-Connect app are welcome.
I tried several sniffer applications but for some reason, it did not show the packets sent. do you have a recommendation for a good sniffer for the phone or computer?

Related

Ways to make a sever-client connection between desktop-phone?

Idea
I am tring to make two applications one on PC and one on android phones(maybe IOS). My desktop app is build on python and the phone app with .dart on flutter emul.
Basically the only thing I want is to pass a variable from my phone to a desktop and do something with it. Of course the 2 devices will be on the same home network.
Question
I have already tested HTTP requests and TCP connection and I got both of them to work. My problem is that I want this app to go online eventually and as things are the connection is made on my IPv4, that is different in every device.
How can I make the desktop server side to wait for a phone to connect on it and the phone to search and find the open IP and port and the name of the device?

Can I find out what type of mobile phone is connected via Bluetooth to a Linux PC?

Is it an Android phone or IOs? Of course on the PC side. I want to implement different behavior of my code depending on the OS on the connected phone.
Thanks!
From Bluetooth Perspective, you cannot find which OS version/OS/model is connected. This information can be modified in a phone (by changing name, service records etc.).
If you have your own application running on the phone, that is connected to the PC, then it is possible for your application to read the information(from the phone) and send it through Bluetooth Serial port (or) object exchange profile (or) by registering a record in the bluetooth service discovery database of the phone. If you can register a SDP record with the model and os information through your app, then it is possible to know the model , without establishing a active connection.

Is it possible to make a Chromecast device discoverable to devices that are not whitelisted?

For example, if I have a friend over and he wants to show me a video using a given app that runs both on my device and his device. Could that app display a QR code on the screen or something that he could scan and instantly be granted access to my Chromecast device?
As Ali mentioned, Chromecast devices are discovered and apps launched via local network applications. One an app is started, it could easily connect with a cloud service that allows other (non-local) devices to talk w/ your Chromecast via the cloud service. A Chromecast Receiver application is just a HTML5 application (HTML, CSS, and JavaScript). You can really do what ever you want once your application gets launched.
If displaying a QR code that allows some kind of rendezvous with your cloud application is what you want to do, you can certainly do that.
I presume your friend's mobile device is on the same wifi network, right? Currently, a chromecast device has no identity outside of its local wifi network, so if the sender is not on the same network as the receiver, there is no way they can exchange messages. Back to your question, if your friend is on your network, then he could see your device except from those applications for which your device is not whitelisted for. Is that the case you want to handle through, say, a QR code? If so, that is currently not doable either since whitelisting is not just a local setup. Maybe I misunderstood your question?
Based on your questions, you are saying that both you and your friend have the same app. If so, and if your friend connects to your wifi network, then he will see your chromecast (you do not whitelist a device for a phone, you whitelist a device for an app id and as long as your friend has the same app (hence the same app id I resume), your whitelisted device will be discoverable by his phone. On the other hand, if you do not want to give him credentials to get on your network, then you need a cloud backend and a lot of work, since although your chromecast device can send a message to cloud and your cloud service can notify the other user's phone (using, say notification or some other mechanism that you employ in your app), the reverse (i.e. sending a message from your friend's phone to your chromecast (through your cloud service)) is much harder. Your friend's phone can send your phone a message (again via a back end service, a bluetooth communication, NFC, etc and then your phone using your app can send that to the chromecast receiver but I am sure you are getting the idea that it is a lot of work. Signing up on your wifi network can be made easier with a QR code or something so at this pint, that would be the easiest solution.

Build own Chromecast device

The Chromecast device is a "receiver device [that] runs a scaled-down Chrome browser with a receiver application". Can I download and install this receiver app on a chrome browser for example on my Windows notebook?
I have implemented a complete chromecast v2 receiver, called YouMap ChromeCast Receiver, available in Google play store and Amazon store, xda-developer thread here: http://forum.xda-developers.com/android-tv/chromecast/app-youmap-chromecast-receiver-android-t3161851
The current Chromecast protocol is a completely different one from the original DIAL based protocol. Right now, only YouTube still uses the old protocol, which chromecast maintains its backward compatibility.
The discovery is mDNS, exactly same as Apple TV bonjour protocol.
The most difficult part is device authentication, the sender and the receiver perform handshakes by exchanging keys and certificates in a way extremely difficult to crack. AppleTV does the same using FairPlay encryption.
The next difficult part is the mirroring protocol, which is also very complicated, need to deal with packet splits, packet retransmissions. Overall, chromecast mirroring protocol is well designed, better than miracast, better than AirPlay mirroring (I have also implemented both of them, so I know what I am talking about).
When I get chances, will write more here.
The chromecast device works using the DIAL protocol. It is completely possible to emulate this protocol using some simple code to listen on the multicast group for discovery and then handle the HTTP requests to launch applications. It is then the launched application that communicates with the casting device, I believe using the RAMP protocol.
Luckily for us the applications that the chromecast device uses are mostly web applications meaning our device emulator just needs to launch a web browser and point it to a specific url when it receives an application request.
For example the youtube app, after device discovery and establishing where the applications are located (part of DIAL). Will send a HTTP POST request containing a pairing key to /<apps url>/YouTube. All the emulating device needs to do now is open https://www.youtube.com/tv?<pairing key> in a browser window. From here, I believe, communication for controlling the youtube app is not sent through the casting device but through the open tabs on the casting device and the emulator.
This is my understanding of how the chromecast device works and specifically the youtube app from looking at https://github.com/dz0ny/leapcast which is a python emulator that has youtube and google music working.
Google is in progress of open sourcing some part of the chrome cast.
https://code.google.com/p/chromium/codesearch#chromium/src/chromecast/
https://code.google.com/p/chromium/issues/list?q=label:Chromecast
So theoretically you can build a similar device.

Data Exchange between applications over ActiveSync

Can anyone tell me how to send receive data between two applications over an ActiveSync connection?
In my scenario there will be one application running on a desktop and another on a windows mobile device, both these applications need to communicate among them. The connection between the desktop and the mobile device can be ActiveSync over USB or Bluetooth. I need the applications to exchange a continuous stream of data, more like a chat application. Ideally, the mobile device application will be sending out data 10-15 times a second (maybe more) and the desktop application will receive the data and display it.
For e.g., let’s consider the ‘Notes’ application for mobile device. Basically it allows user to save small textual notes. Now my application would be something similar, with the exception that it will send out all input it receives to the desktop application. The desktop app will receive the ‘inputs’ and process it.
Finally, I'm open to using any other option then ActiveSync, provided it supports Bluetooth.
You should check out ActiveSync api documentation for informations.
There is also an alternative solution, which I use.
Windows Mobile activates a temporary LAN when the device is connected on the USB.
You can use Window Sockets for the communication and avoid ActiveSync,
if it's not too much trouble for you.
Usually, the device gets IP 169.254.2.1 and the PC the 169.254.2.2.

Resources