Connect raspberries using Android via Wifi Direct (p2p) services

I am trying to connect an Android application with raspberries using jessie 8 OS.

I can connect manually if only one Android device is available next to raspberries. But if more than one Android device is available, I can’t determine which device should connect to the raspberry. To solve this problem, I am trying to use WifiP2P Services.

I am using something like configuration .

p2p_supplicant.conf:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev driver_param=p2p_device=1 update_config=1 device_name=Pi device_type=1-0050F204-1 p2p_go_intent=1 p2p_go_ht40=1 

Configuration for wlan interface:

 sudo wpa_supplicant -B -dd -iwlan0 -Dnl80211 -c/etc/wpa_supplicant/p2p_supplicant.conf 

I am using wpa_cli v2.3 to connect manually to an Android device. But I can’t get any information about the service (for example, the name of the service or any information related to the service), I get only the following:

 >p2p_find <3>P2P-DEVICE-FOUND 8a:79:7e:12:0f:22 p2p_dev_addr=8a:79:7e:12:0f:22 pri_dev_type=10-0050F204-5 name='Moto G (4)' config_methods=0x188 dev_capab=0x25 group_capab=0x0 >p2p_peers 8a:79:7e:12:0f:22 >p2p_serv_disc_req 00:00:00:00:00:00 02000001 P2P-SERV-DISC-RESP 8a:79:7e:12:0f:22 82 81000101002436383539646564652d383537342d353961622d393333322d313233343536373839303132095f70726573656e6365c00c0010011562756464796e616d653d4a6f686e20446f65363234116e616d653d5f766963696e69747961707011617661696c61626c653d76697369626c650f6c697374656e706f72743d363736373900010100095f70726573656e6365c00c000c012436383539646564652d383537342d353961622d393333322d313233343536373839303132c027 

From the documentation I know that the P2P-SERV-DISC-RESP event should have the format:

P2P-SERV-DISC-RESP: indicate the reception of a P2P service discovery response. The following parameters are included after the prefix event: source address, service update indicator, TLV (s) service response as hexdump.

But I can not decode tlv response. I tried to use online decoders, but they do not work either.

How can I decode this tlv answer? or if I can’t, How can I detect an Android device?

+5
source share

Source: https://habr.com/ru/post/1260458/


All Articles