![chknet-connect to chknet-connect to](https://i.ytimg.com/vi/BlY6-2g9UDw/maxresdefault.jpg)
After the reboot, RPi will be connected to the required AP. Now do same like Service-1 to enable the service: sudo systemctl daemon-reload sudo systemctl enable rvice sudo systemctl start rviceĪt this stage we have enabled our RPi to receive the config file from mobile, move to the right folder and reboot. Run: sudo nano /etc/systemd/system/rviceĪnd put below contents: Description=File Handler After=multi-user.target Type=simple ExecStart=/usr/bin/python3 /home/pi/file_handler.py Restart=always WantedBy=multi-user.target After this, we need to make it executable and change its ownership to user pi chmod +x file_handler.py sudo chown pi file_handler.py sudo chgrp pi file_handler.py
![chknet-connect to chknet-connect to](https://i.ytimg.com/vi/lhtpSQMwssE/hqdefault.jpg)
This script will check if there is any existing file in our tmp directory and if there is any then move it to the right folder and reboot RPi. In order to achieve this, we will create a python script (name it file_handler.py): import os import time while(1): if(os.path.exists('/home/pi/tmp/wpa_nf')): os.system('sudo mv /home/pi/tmp/wpa_nf /etc/wpa_supplicant') time.sleep(4) os.system('sudo reboot -h now') else: print("no exist") time.sleep(2) We will receive the file in the tmp directory we created during Service-1 step and then move this file to /etc/wpa_supplicant/. As we already have this file (wpa_nf) in /etc/wpa_supplicant/ folder and if mobile sends the same file it can not be replaced. This service is created to move the wpa config file that will be sent by mobile. Goto end of file, before exit 0 and put below lines: sudo bluetoothctl < Do daemon reload and restart bluetooth service: sudo systemctl daemon-reload sudo systemctl restart rvice In this file uncomment DiscoverableTimeout = 0 (by removing # from start). This can be done by running: sudo nano /etc/bluetooth/nf Next step is to make our RPi always in discoverable mode. Then start this service: sudo systemctl start rvice If it asks to do daemon reload then do it. Enable the service using: sudo systemctl enable obexpush Run below command now: sudo nano /etc/systemd/system/rviceĪnd put below lines in it: Description=OBEX Push service After=rvice Requires=rvice ExecStart=/usr/bin/obexpushd -B23 -o /home/pi/tmp -n (destination folder) Restart=always WantedBy=multi-user.target Create a folder where you want to receive the file from mobile (e.g. In that locate below line:Īnd add -C at end of it to make it look like:ĮxecStart=/usr/lib/bluetooth/bluetoothd -C Run below command: sudo apt-get install obexpushd sudo nano /etc/systemd/system/Ģnd command will open a file. In order to create this service, we need to run some commands and perform some actions before we create service. #Chknet connect to Bluetooth
#Chknet connect to install
#Chknet connect to update
Following all this with so much hardware becomes more challenging when you take your RPi to a new network and you need to update your wpa config file again. To perform above tasks, you need a laptop with card reader and then you need micro SD adapter.
![chknet-connect to chknet-connect to](https://www.siteprice.org/SiteThumbs/a/anatoliko.gr.jpeg)
After RPi boots, it connects to the AP mentioned in the wpa config file.wpa_nf file is updated with SSID and AP and copied to /boot.When we want to connect our RPi that has GUI less OS and also you want to go headless (no monitor and no keyboard/mouse), you do below after putting OS image on SD card: