Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vesta
meta-volansys-gw-demo
Commits
002f245f
Commit
002f245f
authored
Sep 04, 2017
by
Pete Tucker
Browse files
Support NXP demo on vesta developer image
parent
2e04c352
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
recipes-fsl/packagegroup/packagegroup-volansys-gw-demo.bb
View file @
002f245f
...
...
@@ -11,9 +11,9 @@ RDEPENDS_${PN} = " \
DeviceControl \
LedControl \
ThreadControl \
wificommission \
controlwifi \
DiagnosticRead \
nfcreg \
wificommission \
"
recipes-volansys/controlwifi/controlwifi.bb
View file @
002f245f
...
...
@@ -11,14 +11,13 @@ PR = "r0"
SRC_URI = "file://controlSTA-init \
file://0001-rigado.patch \
"
S = "${WORKDIR}"
inherit update-rc.d
INITSCRIPT_NAME = "controlSTA"
INITSCRIPT_PARAMS = "defaults 92"
#
inherit update-rc.d
#
INITSCRIPT_NAME = "controlSTA"
#
INITSCRIPT_PARAMS = "defaults 92"
inherit autotools pkgconfig
...
...
recipes-volansys/controlwifi/files/0001-rigado.patch
deleted
100644 → 0
View file @
2e04c352
diff --git a/controlSTA-init b/controlSTA-init
index 3a91ecd..ee37c1c 100644
--- a/controlSTA-init
+++ b/controlSTA-init
@@ -29,7 +29,11 @@
set -e
start_station() {
echo "Starting Station mode "
-
+ # Set device 'serial number'
+ $IFCONFIG eth0 hw ether 70:B3:D5:9A:E0:EC
+ # Disable power control
+ iwconfig wlan0 power off
+
# Validate file exist or not
if [ ! -f $NETWORK_FILE ]; then
echo "File not found!"
@@ -40,7 +44,6 @@
start_station() {
$IFCONFIG $NET_STA up
echo -e "set WiFi txpower to $TXPOWER\n"
- wl txpwr1 -o -d $TXPOWER
# Write WPA supplicant configuration file
CNT=0
recipes-volansys/nfcreg/nfcreg.bb
View file @
002f245f
...
...
@@ -21,9 +21,10 @@ DEPENDS = " libnfc-nci "
inherit autotools pkgconfig
inherit update-rc.d
INITSCRIPT_NAME = "BRDeamons"
INITSCRIPT_PARAMS = "defaults 93"
#Don't include BRDeamons in init process by default
#inherit update-rc.d
#INITSCRIPT_NAME = "BRDeamons"
#INITSCRIPT_PARAMS = "defaults 93"
do_install_append() {
install -d ${D}${sysconfdir} ${D}${sysconfdir}/init.d
...
...
recipes-volansys/nfcreg/nfcreg/nfc_reg/inittab
View file @
002f245f
...
...
@@ -39,5 +39,3 @@ mxc0:12345:respawn:/sbin/getty -L 115200 ttymxc0
#
1:12345:respawn:/sbin/getty 38400 tty1
781:23456:respawn:/usr/bin/DeviceControl
782:23456:respawn:/usr/bin/CloudRegistration
recipes-volansys/wificommission/files/0001-rigado.patch
deleted
100644 → 0
View file @
2e04c352
diff --git a/BluetoothHCI-init b/BluetoothHCI-init
index 4d3766c..40bc3ca 100644
--- a/BluetoothHCI-init
+++ b/BluetoothHCI-init
@@ -5,7 +5,7 @@
DESC="Bluetooth HCI Deamons "
BLUETOOTH_HCI_BIN=/usr/bin/hciattach
BLUETOOTH_HCI_BIN_PID=/var/run/hciattach.pid
-BLUETOOTH_HCI_BIN_ARG="/dev/ttymxc1 bcm43xx 3000000 -t 20"
+BLUETOOTH_HCI_BIN_ARG="/dev/ttymxc0 ath3k 3000000 -t 20"
# source function library
. /etc/init.d/functions
@@ -13,10 +13,6 @@
BLUETOOTH_HCI_BIN_ARG="/dev/ttymxc1 bcm43xx 3000000 -t 20"
case "$1" in
start)
echo -n "Starting $DESC: "
- echo 47 > /sys/class/gpio/export
- echo out > /sys/class/gpio/gpio47/direction
- echo 0 > /sys/class/gpio/gpio47/value
- echo 1 > /sys/class/gpio/gpio47/value
start-stop-daemon -S -p $BLUETOOTH_HCI_BIN_PID -m -b -x $BLUETOOTH_HCI_BIN -- $BLUETOOTH_HCI_BIN_ARG
;;
stop)
recipes-volansys/wificommission/wificommission.bb
View file @
002f245f
...
...
@@ -15,20 +15,25 @@ REDEPENDS += " bluez5"
TARGET_CC_ARCH+="${LDFLAGS}"
SRC_URI = "file://WiFicommission \
file://0001-rigado.patch \
"
S = "${WORKDIR}/WiFicommission"
inherit
autotools
pkgconfig
inherit pkgconfig
inherit update-rc.d
INITSCRIPT_NAME = "BluetoothHCI"
INITSCRIPT_PARAMS = "defaults 98"
do_compile() {
}
do_install_append() {
install -d ${D}${sysconfdir} ${D}${sysconfdir}/init.d
install -m 0755 ${S}/BluetoothHCI-init ${D}${sysconfdir}/init.d/BluetoothHCI
install -d ${D}${sysconfdir}
install -m 0755 ${S}/BLE.sh ${D}${sysconfdir}/.
install -d ${D}${exec_prefix}/lib/python3.5
install -m 0755 ${S}/wificommission.py ${D}/usr/lib/python3.5/.
}
FILES_${PN} += " \
${sysconfdir}/BLE.sh \
${exec_prefix}/lib/python3.5/wificommission.py \
"
recipes-volansys/wificommission/wificommission/WiFicommission/.WiFicommission.c.swp
deleted
100644 → 0
View file @
2e04c352
File deleted
recipes-volansys/wificommission/wificommission/WiFicommission/BLE.sh
View file @
002f245f
DESC
=
"starting BLE "
WIFI_CREDENTIAL_GATT_SERVER
_BIN
=
/usr/
bin/WiF
icommission
WIFI_CREDENTIAL_GATT_SERVER_BIN_PID
=
/var/run/WiFicommission.pid
WIFI_CREDENTIAL_GATT_SERVER_ARG
=
"-i hci0 -s low -t public"
WIFI_CREDENTIAL_GATT_SERVER
=
/usr/
lib/python3.5/wif
icommission
.py
WIFI_CREDENTIAL_GATT_SERVER_PID
=
/var/run/wificommission.pid
HCIATTACH
=
/etc/init.d/hciattach.sh
HCIATTACH_PID
=
/var/run/hciattach.pid
IFACE
=
eth0
read
MAC </sys/class/net/
$IFACE
/address
...
...
@@ -15,6 +15,9 @@ VAR1="VTBR_$MAC_ADDRESS"
case
"
$1
"
in
start
)
export
>
/home/root/blesh_export
start-stop-daemon
--start
--background
--pidfile
$HCIATTACH_PID
--make-pidfile
--exec
$HCIATTACH
sleep
1
echo
-n
"Starting
$DESC
: "
hciconfig hci0 down
...
...
@@ -27,13 +30,18 @@ case "$1" in
hciconfig hci0 noscan
hciconfig hci0 pscan
hciconfig hci0 leadv 0
start-stop-daemon
-S
-p
$WIFI_CREDENTIAL_GATT_SERVER_BIN_PID
-m
-b
-x
$WIFI_CREDENTIAL_GATT_SERVER_BIN
--
$WIFI_CREDENTIAL_GATT_SERVER_ARG
start-stop-daemon
--start
--background
--pidfile
$WIFI_CREDENTIAL_GATT_SERVER_PID
--make-pidfile
--exec
$WIFI_CREDENTIAL_GATT_SERVER
echo
500000000
>
/sys/class/pwm/pwmchip1/pwm0/duty_cycle
;;
stop
)
echo
-n
"Stopping BLE "
hciconfig hci0 noleadv
hciconfig hci0 down
start-stop-daemon
-K
--oknodo
-s
9
-x
$WIFI_CREDENTIAL_GATT_SERVER_BIN
start-stop-daemon
--stop
--pidfile
$WIFI_CREDENTIAL_GATT_SERVER_PID
start-stop-daemon
--stop
--pidfile
$HCIATTACH_PID
echo
0000000000
>
/sys/class/pwm/pwmchip1/pwm0/duty_cycle
;;
restart
)
$0
stop
...
...
recipes-volansys/wificommission/wificommission/WiFicommission/BluetoothHCI-init
deleted
100644 → 0
View file @
2e04c352
#!/bin/sh
NAME
=
Bluetooth_HCI_Deamons
DESC
=
"Bluetooth HCI Deamons "
BLUETOOTH_HCI_BIN
=
/usr/bin/hciattach
BLUETOOTH_HCI_BIN_PID
=
/var/run/hciattach.pid
BLUETOOTH_HCI_BIN_ARG
=
"/dev/ttymxc1 bcm43xx 3000000 -t 20"
# source function library
.
/etc/init.d/functions
case
"
$1
"
in
start
)
echo
-n
"Starting
$DESC
: "
echo
47
>
/sys/class/gpio/export
echo
out
>
/sys/class/gpio/gpio47/direction
echo
0
>
/sys/class/gpio/gpio47/value
echo
1
>
/sys/class/gpio/gpio47/value
start-stop-daemon
-S
-p
$BLUETOOTH_HCI_BIN_PID
-m
-b
-x
$BLUETOOTH_HCI_BIN
--
$BLUETOOTH_HCI_BIN_ARG
;;
stop
)
echo
-n
"Stopping
$DESC
: "
start-stop-daemon
-K
--oknodo
-x
$BLUETOOTH_HCI_BIN
;;
restart
)
$0
stop
sleep
1
$0
start
;;
*
)
echo
"Usage:
$0
{start|stop|restart}"
exit
1
;;
esac
exit
0
recipes-volansys/wificommission/wificommission/WiFicommission/Debug.h
deleted
100644 → 0
View file @
2e04c352
/*
* Debug.h
*
* Created on: 13-Apr-2017
* Author: tejas
*/
#ifndef CLOUDREG_CLOUDREG_CLOUD_REG_DEBUG_H_
#define CLOUDREG_CLOUDREG_CLOUD_REG_DEBUG_H_
#include <syslog.h>
#define DEBUG
#define CONSOLE
#undef CONSOLE
/* Comment this to show prints on screen*/
//#undef DEBUG /* Comment this to log the details in syslog*/
typedef
enum
Severity
{
emergency
=
LOG_EMERG
,
/* system is unusable */
alert
,
/* action must be taken immediately */
critical
,
/* critical conditions */
err
,
/* error conditions */
warning
,
/* warning conditions */
notice
,
/* normal but significant condition */
info
,
/* informational */
debug
,
/* debug-level messages */
console
,
/* show information on console*/
}
LOG_LEVEL
;
#ifdef DEBUG
#define LOG(log_level,fmt, ...) if(log_level < console) \
syslog(log_level,"%s:%d: "fmt, __func__, __LINE__, ##__VA_ARGS__)
#ifdef CONSOLE
#define LOG(log_level,fmt, ...) if(log_level == console) \
printf(fmt,##__VA_ARGS__)
#endif
#endif
#endif
/* CLOUDREG_CLOUDREG_CLOUD_REG_DEBUG_H_ */
recipes-volansys/wificommission/wificommission/WiFicommission/Makefile.am
deleted
100644 → 0
View file @
2e04c352
bin_PROGRAMS
=
WiFicommission
LDFLAGS
=
-Bstatic
WiFicommission_FLAGS
=
-I
=
/usr/include/
-I
=
/usr/include/bluetooth/
AM_CPPFLAGS
=
\
-I
$(srcdir)
/src/include/
\
$(INCLUDE_PARAMS)
\
$(WiFicommission_LDFLAGS)
\
$(WiFicommission_FLAGS)
\
$(LDFLAGS)
WiFicommission_SOURCES
:=
\
WiFicommission.c
WiFicommission_LDFLAGS
=
-lpthread
-lrt
-L
=
/usr/lib/bluez5/
-lshared-mainloop
-lshared-glib
-lbluetooth-internal
recipes-volansys/wificommission/wificommission/WiFicommission/WiFicommission.c
deleted
100644 → 0
View file @
2e04c352
This diff is collapsed.
Click to expand it.
recipes-volansys/wificommission/wificommission/WiFicommission/configure.ac
deleted
100644 → 0
View file @
2e04c352
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([WiFicommission], 1.0)
AM_INIT_AUTOMAKE([1.9 foreign])
AC_CONFIG_HEADERS([config.h])
AC_PROG_CC
AM_PROG_LEX
AC_PROG_YACC
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_LIBTOOL
# Init Libtool
LT_INIT()
AC_CONFIG_MACRO_DIR([m4])
AC_OUTPUT(Makefile )
recipes-volansys/wificommission/wificommission/WiFicommission/uuid.h
deleted
100644 → 0
View file @
2e04c352
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2011 Nokia Corporation
* Copyright (C) 2011 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __BLUETOOTH_UUID_H
#define __BLUETOOTH_UUID_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <stdint.h>
#define GENERIC_AUDIO_UUID "00001203-0000-1000-8000-00805f9b34fb"
#define HSP_HS_UUID "00001108-0000-1000-8000-00805f9b34fb"
#define HSP_AG_UUID "00001112-0000-1000-8000-00805f9b34fb"
#define HFP_HS_UUID "0000111e-0000-1000-8000-00805f9b34fb"
#define HFP_AG_UUID "0000111f-0000-1000-8000-00805f9b34fb"
#define ADVANCED_AUDIO_UUID "0000110d-0000-1000-8000-00805f9b34fb"
#define A2DP_SOURCE_UUID "0000110a-0000-1000-8000-00805f9b34fb"
#define A2DP_SINK_UUID "0000110b-0000-1000-8000-00805f9b34fb"
#define AVRCP_REMOTE_UUID "0000110e-0000-1000-8000-00805f9b34fb"
#define AVRCP_TARGET_UUID "0000110c-0000-1000-8000-00805f9b34fb"
#define PANU_UUID "00001115-0000-1000-8000-00805f9b34fb"
#define NAP_UUID "00001116-0000-1000-8000-00805f9b34fb"
#define GN_UUID "00001117-0000-1000-8000-00805f9b34fb"
#define BNEP_SVC_UUID "0000000f-0000-1000-8000-00805f9b34fb"
#define PNPID_UUID "00002a50-0000-1000-8000-00805f9b34fb"
#define DEVICE_INFORMATION_UUID "0000180a-0000-1000-8000-00805f9b34fb"
#define GATT_UUID "00001801-0000-1000-8000-00805f9b34fb"
#define IMMEDIATE_ALERT_UUID "00001802-0000-1000-8000-00805f9b34fb"
#define LINK_LOSS_UUID "00001803-0000-1000-8000-00805f9b34fb"
#define TX_POWER_UUID "00001804-0000-1000-8000-00805f9b34fb"
#define BATTERY_UUID "0000180f-0000-1000-8000-00805f9b34fb"
#define SCAN_PARAMETERS_UUID "00001813-0000-1000-8000-00805f9b34fb"
#define SAP_UUID "0000112D-0000-1000-8000-00805f9b34fb"
#define HEART_RATE_UUID "0000180d-0000-1000-8000-00805f9b34fb"
#define HEART_RATE_MEASUREMENT_UUID "00002a37-0000-1000-8000-00805f9b34fb"
#define BODY_SENSOR_LOCATION_UUID "00002a38-0000-1000-8000-00805f9b34fb"
#define HEART_RATE_CONTROL_POINT_UUID "00002a39-0000-1000-8000-00805f9b34fb"
#define HEALTH_THERMOMETER_UUID "00001809-0000-1000-8000-00805f9b34fb"
#define TEMPERATURE_MEASUREMENT_UUID "00002a1c-0000-1000-8000-00805f9b34fb"
#define TEMPERATURE_TYPE_UUID "00002a1d-0000-1000-8000-00805f9b34fb"
#define INTERMEDIATE_TEMPERATURE_UUID "00002a1e-0000-1000-8000-00805f9b34fb"
#define MEASUREMENT_INTERVAL_UUID "00002a21-0000-1000-8000-00805f9b34fb"
#define CYCLING_SC_UUID "00001816-0000-1000-8000-00805f9b34fb"
#define CSC_MEASUREMENT_UUID "00002a5b-0000-1000-8000-00805f9b34fb"
#define CSC_FEATURE_UUID "00002a5c-0000-1000-8000-00805f9b34fb"
#define SENSOR_LOCATION_UUID "00002a5d-0000-1000-8000-00805f9b34fb"
#define SC_CONTROL_POINT_UUID "00002a55-0000-1000-8000-00805f9b34fb"
#define RFCOMM_UUID_STR "00000003-0000-1000-8000-00805f9b34fb"
#define HDP_UUID "00001400-0000-1000-8000-00805f9b34fb"
#define HDP_SOURCE_UUID "00001401-0000-1000-8000-00805f9b34fb"
#define HDP_SINK_UUID "00001402-0000-1000-8000-00805f9b34fb"
#define HID_UUID "00001124-0000-1000-8000-00805f9b34fb"
#define DUN_GW_UUID "00001103-0000-1000-8000-00805f9b34fb"
#define GAP_UUID "00001800-0000-1000-8000-00805f9b34fb"
#define PNP_UUID "00001200-0000-1000-8000-00805f9b34fb"
#define SPP_UUID "00001101-0000-1000-8000-00805f9b34fb"
#define OBEX_SYNC_UUID "00001104-0000-1000-8000-00805f9b34fb"
#define OBEX_OPP_UUID "00001105-0000-1000-8000-00805f9b34fb"
#define OBEX_FTP_UUID "00001106-0000-1000-8000-00805f9b34fb"
#define OBEX_PCE_UUID "0000112e-0000-1000-8000-00805f9b34fb"
#define OBEX_PSE_UUID "0000112f-0000-1000-8000-00805f9b34fb"
#define OBEX_PBAP_UUID "00001130-0000-1000-8000-00805f9b34fb"
#define OBEX_MAS_UUID "00001132-0000-1000-8000-00805f9b34fb"
#define OBEX_MNS_UUID "00001133-0000-1000-8000-00805f9b34fb"
#define OBEX_MAP_UUID "00001134-0000-1000-8000-00805f9b34fb"
/* GATT UUIDs section */
#define GATT_PRIM_SVC_UUID 0x2800
#define GATT_SND_SVC_UUID 0x2801
#define GATT_INCLUDE_UUID 0x2802
#define GATT_CHARAC_UUID 0x2803
/* GATT Characteristic Types */
#define GATT_CHARAC_DEVICE_NAME 0x2A00
#define GATT_CHARAC_APPEARANCE 0x2A01
#define GATT_CHARAC_PERIPHERAL_PRIV_FLAG 0x2A02
#define GATT_CHARAC_RECONNECTION_ADDRESS 0x2A03
#define GATT_CHARAC_PERIPHERAL_PREF_CONN 0x2A04
#define GATT_CHARAC_SERVICE_CHANGED 0x2A05
#define GATT_CHARAC_SYSTEM_ID 0x2A23
#define GATT_CHARAC_MODEL_NUMBER_STRING 0x2A24
#define GATT_CHARAC_SERIAL_NUMBER_STRING 0x2A25
#define GATT_CHARAC_FIRMWARE_REVISION_STRING 0x2A26
#define GATT_CHARAC_HARDWARE_REVISION_STRING 0x2A27
#define GATT_CHARAC_SOFTWARE_REVISION_STRING 0x2A28
#define GATT_CHARAC_MANUFACTURER_NAME_STRING 0x2A29
#define GATT_CHARAC_PNP_ID 0x2A50
/* GATT Characteristic Descriptors */
#define GATT_CHARAC_EXT_PROPER_UUID 0x2900
#define GATT_CHARAC_USER_DESC_UUID 0x2901
#define GATT_CLIENT_CHARAC_CFG_UUID 0x2902
#define GATT_SERVER_CHARAC_CFG_UUID 0x2903
#define GATT_CHARAC_FMT_UUID 0x2904
#define GATT_CHARAC_AGREG_FMT_UUID 0x2905
#define GATT_CHARAC_VALID_RANGE_UUID 0x2906
#define GATT_EXTERNAL_REPORT_REFERENCE 0x2907
#define GATT_REPORT_REFERENCE 0x2908
typedef
struct
{
enum
{
BT_UUID_UNSPEC
=
0
,
BT_UUID16
=
16
,
BT_UUID32
=
32
,
BT_UUID128
=
128
,
}
type
;
union
{
uint16_t
u16
;
uint32_t
u32
;
uint128_t
u128
;
}
value
;
}
bt_uuid_t
;
int
bt_uuid_strcmp
(
const
void
*
a
,
const
void
*
b
);
int
bt_uuid16_create
(
bt_uuid_t
*
btuuid
,
uint16_t
value
);
int
bt_uuid32_create
(
bt_uuid_t
*
btuuid
,
uint32_t
value
);
int
bt_uuid128_create
(
bt_uuid_t
*
btuuid
,
uint128_t
value
);
int
bt_uuid_cmp
(
const
bt_uuid_t
*
uuid1
,
const
bt_uuid_t
*
uuid2
);
void
bt_uuid_to_uuid128
(
const
bt_uuid_t
*
src
,
bt_uuid_t
*
dst
);
#define MAX_LEN_UUID_STR 37
int
bt_uuid_to_string
(
const
bt_uuid_t
*
uuid
,
char
*
str
,
size_t
n
);
int
bt_string_to_uuid
(
bt_uuid_t
*
uuid
,
const
char
*
string
);
int
bt_uuid_to_le
(
const
bt_uuid_t
*
uuid
,
void
*
dst
);
static
inline
int
bt_uuid_len
(
const
bt_uuid_t
*
uuid
)
{
return
uuid
->
type
/
8
;
}
#ifdef __cplusplus
}
#endif
#endif
/* __BLUETOOTH_UUID_H */
recipes-volansys/wificommission/wificommission/WiFicommission/wificommission.py
0 → 100755
View file @
002f245f
#!/usr/bin/env python3
import
dbus
import
dbus.exceptions
import
dbus.mainloop.glib
import
dbus.service
import
array
import
socket
try
:
from
gi.repository
import
GObject
except
ImportError
:
import
gobject
as
GObject
import
sys
from
random
import
randint
mainloop
=
None
WifiSsid
=
""
WifiPassword
=
""
WifiType
=
""
InterfaceType
=
""
flag
=
0
BLUEZ_SERVICE_NAME
=
'org.bluez'
GATT_MANAGER_IFACE
=
'org.bluez.GattManager1'
DBUS_OM_IFACE
=
'org.freedesktop.DBus.ObjectManager'
DBUS_PROP_IFACE
=
'org.freedesktop.DBus.Properties'
GATT_SERVICE_IFACE
=
'org.bluez.GattService1'
GATT_CHRC_IFACE
=
'org.bluez.GattCharacteristic1'
GATT_DESC_IFACE
=
'org.bluez.GattDescriptor1'
class
InvalidArgsException
(
dbus
.
exceptions
.
DBusException
):
_dbus_error_name
=
'org.freedesktop.DBus.Error.InvalidArgs'
class
NotSupportedException
(
dbus
.
exceptions
.
DBusException
):
_dbus_error_name
=
'org.bluez.Error.NotSupported'
class
NotPermittedException
(
dbus
.
exceptions
.
DBusException
):
_dbus_error_name
=
'org.bluez.Error.NotPermitted'
class
InvalidValueLengthException
(
dbus
.
exceptions
.
DBusException
):
_dbus_error_name
=
'org.bluez.Error.InvalidValueLength'
class
FailedException
(
dbus
.
exceptions
.
DBusException
):
_dbus_error_name
=
'org.bluez.Error.Failed'
class
Application
(
dbus
.
service
.
Object
):
"""
org.bluez.GattApplication1 interface implementation
"""
def
__init__
(
self
,
bus
):
self
.
path
=
'/'
self
.
services
=
[]
dbus
.
service
.
Object
.
__init__
(
self
,
bus
,
self
.
path
)
self
.
add_service
(
WifiCredentialService
(
bus
,
0
))
def
get_path
(
self
):
return
dbus
.
ObjectPath
(
self
.
path
)
def
add_service
(
self
,
service
):
self
.
services
.
append
(
service
)
@
dbus
.
service
.
method
(
DBUS_OM_IFACE
,
out_signature
=
'a{oa{sa{sv}}}'
)
def
GetManagedObjects
(
self
):
response
=
{}
print
(
'GetManagedObjects'
)
for
service
in
self
.
services
:
response
[
service
.
get_path
()]
=
service
.
get_properties
()
chrcs
=
service
.
get_characteristics
()
for
chrc
in
chrcs
:
response
[
chrc
.
get_path
()]
=
chrc
.
get_properties
()
descs
=
chrc
.
get_descriptors
()
for
desc
in
descs
:
response
[
desc
.
get_path
()]
=
desc
.
get_properties
()
return
response
class
Service
(
dbus
.
service
.
Object
):
"""
org.bluez.GattService1 interface implementation
"""
PATH_BASE
=
'/org/bluez/example/service'
def
__init__
(
self
,
bus
,
index
,
uuid
,
primary
):
self
.
path
=
self
.
PATH_BASE
+
str
(
index
)
self
.
bus
=
bus
self
.
uuid
=
uuid
self
.
primary
=
primary
self
.
characteristics
=
[]
dbus
.
service
.
Object
.
__init__
(
self
,
bus
,
self
.
path
)
def
get_properties
(
self
):
return
{
GATT_SERVICE_IFACE
:
{
'UUID'
:
self
.
uuid
,
'Primary'
:
self
.
primary
,
'Characteristics'
:
dbus
.
Array
(
self
.
get_characteristic_paths
(),
signature
=
'o'
)
}
}
def
get_path