C++ APIs for you to easily setup and communicate via smart P2P (using available p2p modules among Wi-Fi Direct / Bluetooth / Bluetooth LE)
= Supported Devices = Raspberry-pi 3 NVIDIA Jetson-TX1
$ git clone https://github.com/sinban04/P2PForYourThings.git
$ cd P2PForYourThings
- Install Bluetooth library
$ sudo apt-get install libbluetooth-dev
Check your bluetooth version and if it's > 5.x, then
$ sudo vi /etc/systemd/system/dbus-org.bluez.service
ExecStart=/usr/lib/bluetooth/bluetoothd --compat
$ sudo systemctl daemon-reload
$ sudo systemctl restart bluetooth
$ sudo chmod 777 /var/run/sdp
- Check the wifi module support p2p
$ iw list
- Modify the wpa_supplicant.conf (/etc/wpa_supplicant/wpa_supplicant.conf) Add two parameters
update_config=1
driver_param=p2p_device=1
- Install UDHCPD for wifi-direct
$ sudo apt-get install udhcpd
$ sudo touch /var/lib/misc/udhcpd.leases
- Set wpa_supplicant configuration
sudo wpa_supplicant -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
// No need to make the new directories now (Already exists)
$ mkdir bin obj ./device/obj
$ make
Then you can find the binary file of the communicator test example, which is in the tests/ directory.
$ sudo ./bin/test
Check your bluetooth version using
$ sudo vi /etc/systemd/system/dbus-org.bluez.service
ExecStart=/usr/lib/bluetooth/bluetoothd --compat
$ sudo systemctl daemon-reload
$ sudo systemctl restart bluetooth
$ sudo chmod 777 /var/run/sdp
$ hciconfig -a
Set page scan and inquiry can (Discoverable)
$ sudo hciconfig hci0 piscan
e.g., change the name of the bluetooth interface to 'pi'
$ sudo hciconfig hci0 name pi
$ sudo hciconfig hci0 up
sudo service bluetooth start
When the bluetooth.target is masked, unmask it
$ sudo systemctl unmask bluetooth
Check the bluetoothd exists
$ ps -ef | grep bluetooth
remove group p2p-wlan0-1 on the wifi interface wlan0
sudo wpa_cli -i wlan0 p2p_group_remove p2p-wlan0-1