Executing Python Script At Boot Time; Example: Inquiring Near Devices And Transferring File - Sena Parani MSP1000 User Manual

For wireless multi-serial communications, based on bluetooth technology
Table of Contents

Advertisement

Warning: Permanently added '192.168.7.8' (RSA) to the list of known hosts.
root@192.168.7.8's password:
array.so
[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",
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"),
100%
"Computer",
"Phone",
"LAN/Network Access point",
"Audio/Video",
"Peripheral",
"Imaging" )
(17, "networking"),
(18, "rendering"),
(19, "capturing"),
(20, "object transfer"),
(21, "audio"),
(22, "telephony"),
75
101KB 101.4KB/s
00:01

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents