C.3. executing python script at boot time – SENA Parani-MSP1000 User Manual
Page 75

75
Warning: Permanently added '192.168.7.8' (RSA) to the list of known hosts.
[email protected]'s password:
array.so
100%
101KB 101.4KB/s
00:01
[root@MSP1000 usr2]#
C.3. Executing Python script at boot time
The Parani-MSP1000 executes the /usr2/rc.user at boot time. Users should make the rc.user execute
the Python script.
C.3.1 Example: Inquiring near devices and transferring file.
Step 1. Make a Python code. (btsender.py)
#!/bin/python
import bluetooth
import lightblue
import select
from time import *
import threading
scan_interval = 90
send_interval = 300
file_path = "/usr2/advertising.jpg"
# Available class
# Miscellaneous, Computer, Phone, LAN/Network Access point, Audio/Video,
Peripheral, Imaging
# Usage
: available_class = ["class_name", ...]
# example : available_class = ["Computer"]
#
available_class = ["Computer", "Phone"]
available_class = ["Phone"]
class MyDiscoverer(bluetooth.DeviceDiscoverer):
def pre_inquiry(self):
self.done = False
def device_discovered(self, address, device_class, name):
major_classes = ( "Miscellaneous",
"Computer",
"Phone",
"LAN/Network Access point",
"Audio/Video",
"Peripheral",
"Imaging" )
major_class = (device_class >> 8) & 0xf
if major_class >= 7:
return
for item in available_class:
if item == major_classes[major_class]:
service_classes = ( (16, "positioning"),
(17, "networking"),
(18, "rendering"),
(19, "capturing"),
(20, "object transfer"),
(21, "audio"),
(22, "telephony"),