Merge setting screen code.

This commit is contained in:
zyj 2023-10-20 12:49:15 +08:00
commit 0f935f16ea
8532 changed files with 320434 additions and 1215 deletions

13
.gitignore vendored
View File

@ -6,7 +6,6 @@
*.ko
**/*.o
**/*.a
**/*.so
**/*nvt_finish
**/*.sln
*.vcxproj
@ -46,3 +45,15 @@ rtos/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S550/
configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S550/ModelConfig.mk
configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S550/nvt-evb.dtb
configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S550/nvt-evb.tmp.dts
build/nvt-tools/__pycache__/
rtos/build/nvt-tools/__pycache__/
BSP/root-fs/rootfs/var/lib/dbus/
BSP/root-fs/rootfs/lib/firmware/
BSP/root-fs/rootfs/usr/lib/libdbus-1.so.3
BSP/root-fs/rootfs/usr/lib/libexpat.so.1
BSP/root-fs/rootfs/usr/lib/libgettextlib-0.22.so
BSP/root-fs/rootfs/usr/lib/libgettextpo.so.0
BSP/root-fs/rootfs/usr/lib/libglib-2.0.so.0
BSP/root-fs/rootfs/usr/lib/libintl.so.8
BSP/root-fs/rootfs/usr/lib/libncurses.so.6
BSP/root-fs/rootfs/usr/lib/libreadline.so.8

View File

@ -80,6 +80,8 @@ CONFIG_PREEMPT_COUNT=y
CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
# CONFIG_IRQ_TIME_ACCOUNTING is not set
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_TASKSTATS is not set
#
# RCU Subsystem
@ -96,6 +98,7 @@ CONFIG_LOG_BUF_SHIFT=15
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=12
CONFIG_GENERIC_SCHED_CLOCK=y
# CONFIG_CGROUPS is not set
# CONFIG_NAMESPACES is not set
# CONFIG_CHECKPOINT_RESTORE is not set
# CONFIG_SCHED_AUTOGROUP is not set
# CONFIG_SYSFS_DEPRECATED is not set
@ -116,7 +119,8 @@ CONFIG_ANON_INODES=y
CONFIG_HAVE_UID16=y
CONFIG_BPF=y
CONFIG_EXPERT=y
# CONFIG_MULTIUSER is not set
CONFIG_UID16=y
CONFIG_MULTIUSER=y
# CONFIG_SGETMASK_SYSCALL is not set
CONFIG_SYSFS_SYSCALL=y
# CONFIG_SYSCTL_SYSCALL is not set
@ -128,7 +132,7 @@ CONFIG_PRINTK_NMI=y
# CONFIG_BASE_FULL is not set
CONFIG_FUTEX=y
CONFIG_FUTEX_PI=y
# CONFIG_EPOLL is not set
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
@ -653,7 +657,30 @@ CONFIG_BQL=y
# CONFIG_NET_PKTGEN is not set
# CONFIG_HAMRADIO is not set
# CONFIG_CAN is not set
# CONFIG_BT is not set
CONFIG_BT=y
CONFIG_BT_BREDR=y
# CONFIG_BT_RFCOMM is not set
# CONFIG_BT_BNEP is not set
CONFIG_BT_HS=y
CONFIG_BT_LE=y
# CONFIG_BT_SELFTEST is not set
CONFIG_BT_DEBUGFS=y
#
# Bluetooth device drivers
#
# CONFIG_BT_HCIBTUSB is not set
# CONFIG_BT_HCIBTSDIO is not set
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_H4=y
# CONFIG_BT_HCIUART_BCSP is not set
CONFIG_BT_HCIUART_RTKH5=y
# CONFIG_BT_HCIUART_LL is not set
# CONFIG_BT_HCIBCM203X is not set
# CONFIG_BT_HCIBPA10X is not set
# CONFIG_BT_HCIBFUSB is not set
# CONFIG_BT_HCIVHCI is not set
# CONFIG_BT_MRVL is not set
# CONFIG_AF_RXRPC is not set
# CONFIG_AF_KCM is not set
CONFIG_WIRELESS=y
@ -2521,7 +2548,7 @@ CONFIG_SQUASHFS_FILE_CACHE=y
CONFIG_SQUASHFS_DECOMP_SINGLE=y
# CONFIG_SQUASHFS_DECOMP_MULTI is not set
# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set
# CONFIG_SQUASHFS_XATTR is not set
CONFIG_SQUASHFS_XATTR=y
CONFIG_SQUASHFS_ZLIB=y
# CONFIG_SQUASHFS_LZ4 is not set
CONFIG_SQUASHFS_LZO=y
@ -2602,6 +2629,7 @@ CONFIG_KEYS=y
# CONFIG_ENCRYPTED_KEYS is not set
# CONFIG_KEY_DH_OPERATIONS is not set
# CONFIG_SECURITY_DMESG_RESTRICT is not set
# CONFIG_SECURITY is not set
# CONFIG_SECURITYFS is not set
CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y
# CONFIG_HARDENED_USERCOPY is not set
@ -2628,10 +2656,11 @@ CONFIG_CRYPTO_RNG_DEFAULT=y
CONFIG_CRYPTO_AKCIPHER2=y
CONFIG_CRYPTO_AKCIPHER=y
CONFIG_CRYPTO_KPP2=y
CONFIG_CRYPTO_KPP=y
CONFIG_CRYPTO_ACOMP2=y
CONFIG_CRYPTO_RSA=y
# CONFIG_CRYPTO_DH is not set
# CONFIG_CRYPTO_ECDH is not set
CONFIG_CRYPTO_ECDH=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
# CONFIG_CRYPTO_USER is not set
@ -2677,7 +2706,7 @@ CONFIG_CRYPTO_ECB=y
#
# Hash modes
#
CONFIG_CRYPTO_CMAC=m
CONFIG_CRYPTO_CMAC=y
CONFIG_CRYPTO_HMAC=y
# CONFIG_CRYPTO_XCBC is not set
# CONFIG_CRYPTO_VMAC is not set

View File

@ -1,28 +1,10 @@
# SPDX-License-Identifier: GPL-2.0
menu "Bluetooth device drivers"
depends on BT
config BT_INTEL
tristate
select REGMAP
config BT_BCM
tristate
select FW_LOADER
config BT_RTL
tristate
select FW_LOADER
config BT_QCA
tristate
select FW_LOADER
config BT_HCIBTUSB
tristate "HCI USB driver"
depends on USB
select BT_INTEL
help
Bluetooth HCI USB driver.
This driver is required if you want to use Bluetooth devices with
@ -31,38 +13,6 @@ config BT_HCIBTUSB
Say Y here to compile support for Bluetooth USB devices into the
kernel or say M to compile it as module (btusb).
config BT_HCIBTUSB_AUTOSUSPEND
bool "Enable USB autosuspend for Bluetooth USB devices by default"
depends on BT_HCIBTUSB
help
Say Y here to enable USB autosuspend for Bluetooth USB devices by
default.
This can be overridden by passing btusb.enable_autosuspend=[y|n]
on the kernel commandline.
config BT_HCIBTUSB_BCM
bool "Broadcom protocol support"
depends on BT_HCIBTUSB
select BT_BCM
default y
help
The Broadcom protocol support enables firmware and patchram
download support for Broadcom Bluetooth controllers.
Say Y here to compile support for Broadcom protocol.
config BT_HCIBTUSB_RTL
bool "Realtek protocol support"
depends on BT_HCIBTUSB
select BT_RTL
default y
help
The Realtek protocol support enables firmware and configuration
download support for Realtek Bluetooth controllers.
Say Y here to compile support for Realtek protocol.
config BT_HCIBTSDIO
tristate "HCI SDIO driver"
depends on MMC
@ -76,78 +26,51 @@ config BT_HCIBTSDIO
config BT_HCIUART
tristate "HCI UART driver"
depends on SERIAL_DEV_BUS || !SERIAL_DEV_BUS
depends on NVMEM || !NVMEM
depends on TTY
help
Bluetooth HCI UART driver.
This driver is required if you want to use Bluetooth devices with
serial port interface. You will also need this driver if you have
UART based Bluetooth PCMCIA and CF devices like Xircom Credit Card
serial port interface. You will also need this driver if you have
UART based Bluetooth PCMCIA and CF devices like Xircom Credit Card
adapter and BrainBoxes Bluetooth PC Card.
Say Y here to compile support for Bluetooth UART devices into the
kernel or say M to compile it as module (hci_uart).
config BT_HCIUART_SERDEV
bool
depends on SERIAL_DEV_BUS && BT_HCIUART
default y
config BT_HCIUART_H4
bool "UART (H4) protocol support"
depends on BT_HCIUART
help
UART (H4) is serial protocol for communication between Bluetooth
device and host. This protocol is required for most Bluetooth devices
with UART interface, including PCMCIA and CF cards.
UART (H4) is serial protocol for communication between Bluetooth
device and host. This protocol is required for most Bluetooth devices
with UART interface, including PCMCIA and CF cards.
Say Y here to compile support for HCI UART (H4) protocol.
config BT_HCIUART_NOKIA
tristate "UART Nokia H4+ protocol support"
depends on BT_HCIUART
depends on BT_HCIUART_SERDEV
depends on GPIOLIB
depends on PM
select BT_HCIUART_H4
select BT_BCM
help
Nokia H4+ is serial protocol for communication between Bluetooth
device and host. This protocol is required for Bluetooth devices
with UART interface in Nokia devices.
Say Y here to compile support for Nokia's H4+ protocol.
config BT_HCIUART_BCSP
bool "BCSP protocol support"
depends on BT_HCIUART
select BITREVERSE
help
BCSP (BlueCore Serial Protocol) is serial protocol for communication
BCSP (BlueCore Serial Protocol) is serial protocol for communication
between Bluetooth device and host. This protocol is required for non
USB Bluetooth devices based on CSR BlueCore chip, including PCMCIA and
CF cards.
Say Y here to compile support for HCI BCSP protocol.
config BT_HCIUART_ATH3K
bool "Atheros AR300x serial support"
config BT_HCIUART_RTKH5
bool "Realtek H5 protocol support"
depends on BT_HCIUART
select BT_HCIUART_H4
help
HCIATH3K (HCI Atheros AR300x) is a serial protocol for
communication between host and Atheros AR300x Bluetooth devices.
This protocol enables AR300x chips to be enabled with
power management support.
Enable this if you have Atheros AR300x serial Bluetooth device.
Realtek H5 is serial protocol for communication
between Realtek Bluetooth device and host. This protocol is required for
Realtek uart h5 bluetooth controller
Say Y here to compile support for HCI UART ATH3K protocol.
Say Y here to compile support for Realtek HCI H5 protocol.
config BT_HCIUART_LL
bool "HCILL protocol support"
depends on BT_HCIUART_SERDEV
select BT_HCIUART_H4
depends on BT_HCIUART
help
HCILL (HCI Low Level) is a serial protocol for communication
between Bluetooth device and host. This protocol is required for
@ -156,95 +79,6 @@ config BT_HCIUART_LL
Say Y here to compile support for HCILL protocol.
config BT_HCIUART_3WIRE
bool "Three-wire UART (H5) protocol support"
depends on BT_HCIUART
depends on BT_HCIUART_SERDEV
help
The HCI Three-wire UART Transport Layer makes it possible to
user the Bluetooth HCI over a serial port interface. The HCI
Three-wire UART Transport Layer assumes that the UART
communication may have bit errors, overrun errors or burst
errors and thereby making CTS/RTS lines unnecessary.
Say Y here to compile support for Three-wire UART protocol.
config BT_HCIUART_INTEL
bool "Intel protocol support"
depends on BT_HCIUART
depends on GPIOLIB
select BT_HCIUART_H4
select BT_INTEL
help
The Intel protocol support enables Bluetooth HCI over serial
port interface for Intel Bluetooth controllers.
Say Y here to compile support for Intel protocol.
config BT_HCIUART_BCM
bool "Broadcom protocol support"
depends on BT_HCIUART
depends on BT_HCIUART_SERDEV
depends on (!ACPI || SERIAL_DEV_CTRL_TTYPORT)
depends on GPIOLIB
select BT_HCIUART_H4
select BT_BCM
help
The Broadcom protocol support enables Bluetooth HCI over serial
port interface for Broadcom Bluetooth controllers.
Say Y here to compile support for Broadcom protocol.
config BT_HCIUART_RTL
bool "Realtek protocol support"
depends on BT_HCIUART
depends on BT_HCIUART_SERDEV
depends on GPIOLIB
depends on ACPI
select BT_HCIUART_3WIRE
select BT_RTL
help
The Realtek protocol support enables Bluetooth HCI over 3-Wire
serial port internface for Realtek Bluetooth controllers.
Say Y here to compile support for Realtek protocol.
config BT_HCIUART_QCA
bool "Qualcomm Atheros protocol support"
depends on BT_HCIUART
depends on BT_HCIUART_SERDEV
select BT_HCIUART_H4
select BT_QCA
help
The Qualcomm Atheros protocol supports HCI In-Band Sleep feature
over serial port interface(H4) between controller and host.
This protocol is required for UART clock control for QCA Bluetooth
devices.
Say Y here to compile support for QCA protocol.
config BT_HCIUART_AG6XX
bool "Intel AG6XX protocol support"
depends on BT_HCIUART
select BT_HCIUART_H4
select BT_INTEL
help
The Intel/AG6XX protocol support enables Bluetooth HCI over serial
port interface for Intel ibt 2.1 Bluetooth controllers.
Say Y here to compile support for Intel AG6XX protocol.
config BT_HCIUART_MRVL
bool "Marvell protocol support"
depends on BT_HCIUART
select BT_HCIUART_H4
help
Marvell is serial protocol for communication between Bluetooth
device and host. This protocol is required for most Marvell Bluetooth
devices with UART interface.
Say Y here to compile support for HCI MRVL protocol.
config BT_HCIBCM203X
tristate "HCI BCM203x USB driver"
depends on USB
@ -321,6 +155,22 @@ config BT_HCIBLUECARD
Say Y here to compile support for HCI BlueCard devices into the
kernel or say M to compile it as module (bluecard_cs).
config BT_HCIBTUART
tristate "HCI UART (PC Card) device driver"
depends on PCMCIA
help
Bluetooth HCI UART (PC Card) driver.
This driver provides support for Bluetooth PCMCIA devices with
an UART interface:
Xircom CreditCard Bluetooth Adapter
Xircom RealPort2 Bluetooth Adapter
Sphinx PICO Card
H-Soft blue+Card
Cyber-blue Compact Flash Card
Say Y here to compile support for HCI UART devices into the
kernel or say M to compile it as module (btuart_cs).
config BT_HCIVHCI
tristate "HCI VHCI (Virtual HCI device) driver"
help
@ -336,7 +186,7 @@ config BT_MRVL
The core driver to support Marvell Bluetooth devices.
This driver is required if you want to support
Marvell Bluetooth devices, such as 8688/8787/8797/8887/8897/8997.
Marvell Bluetooth devices, such as 8688.
Say Y here to compile Marvell Bluetooth driver
into the kernel or say M to compile it as module.
@ -345,13 +195,12 @@ config BT_MRVL_SDIO
tristate "Marvell BT-over-SDIO driver"
depends on BT_MRVL && MMC
select FW_LOADER
select WANT_DEV_COREDUMP
help
The driver for Marvell Bluetooth chipsets with SDIO interface.
This driver is required if you want to use Marvell Bluetooth
devices with SDIO interface. Currently SD8688/SD8787/SD8797/SD8887/SD8897/SD8997
chipsets are supported.
devices with SDIO interface. Currently only SD8688 chipset is
supported.
Say Y here to compile support for Marvell BT-over-SDIO driver
into the kernel or say M to compile it as module.
@ -368,49 +217,4 @@ config BT_ATH3K
Say Y here to compile support for "Atheros firmware download driver"
into the kernel or say M to compile it as module (ath3k).
config BT_WILINK
tristate "Texas Instruments WiLink7 driver"
depends on TI_ST
help
This enables the Bluetooth driver for Texas Instrument's BT/FM/GPS
combo devices. This makes use of shared transport line discipline
core driver to communicate with the BT core of the combo chip.
Say Y here to compile support for Texas Instrument's WiLink7 driver
into the kernel or say M to compile it as module (btwilink).
config BT_MTKUART
tristate "MediaTek HCI UART driver"
depends on SERIAL_DEV_BUS
help
MediaTek Bluetooth HCI UART driver.
This driver is required if you want to use MediaTek Bluetooth
with serial interface.
Say Y here to compile support for MediaTek Bluetooth UART devices
into the kernel or say M to compile it as module (btmtkuart).
config BT_QCOMSMD
tristate "Qualcomm SMD based HCI support"
depends on RPMSG || (COMPILE_TEST && RPMSG=n)
depends on QCOM_WCNSS_CTRL || (COMPILE_TEST && QCOM_WCNSS_CTRL=n)
select BT_QCA
help
Qualcomm SMD based HCI driver.
This driver is used to bridge HCI data onto the shared memory
channels to the WCNSS core.
Say Y here to compile support for HCI over Qualcomm SMD into the
kernel or say M to compile as a module.
config BT_HCIRSI
tristate
help
Redpine BT driver.
This driver handles BT traffic from upper layers and pass
to the RSI_91x coex module for further scheduling to device
Say Y here to compile support for HCI over Redpine into the
kernel or say M to compile as a module.
endmenu

View File

@ -1,48 +1,17 @@
# SPDX-License-Identifier: GPL-2.0
#
# Makefile for the Linux Bluetooth HCI device drivers.
#
ifneq ($(KERNELRELEASE),)
obj-m := hci_uart.o
hci_uart-y := hci_ldisc.o hci_h4.o hci_rtk_h5.o rtk_coex.o
#EXTRA_CFLAGS += -DDEBUG
obj-$(CONFIG_BT_HCIVHCI) += hci_vhci.o
obj-$(CONFIG_BT_HCIUART) += hci_uart.o
obj-$(CONFIG_BT_HCIBCM203X) += bcm203x.o
obj-$(CONFIG_BT_HCIBPA10X) += bpa10x.o
obj-$(CONFIG_BT_HCIBFUSB) += bfusb.o
obj-$(CONFIG_BT_HCIDTL1) += dtl1_cs.o
obj-$(CONFIG_BT_HCIBT3C) += bt3c_cs.o
obj-$(CONFIG_BT_HCIBLUECARD) += bluecard_cs.o
else
PWD := $(shell pwd)
KVER := $(shell uname -r)
KDIR := /lib/modules/$(KVER)/build
obj-$(CONFIG_BT_HCIBTUSB) += btusb.o
obj-$(CONFIG_BT_HCIBTSDIO) += btsdio.o
all:
$(MAKE) -C $(KDIR) M=$(PWD) modules
obj-$(CONFIG_BT_INTEL) += btintel.o
obj-$(CONFIG_BT_ATH3K) += ath3k.o
obj-$(CONFIG_BT_MRVL) += btmrvl.o
obj-$(CONFIG_BT_MRVL_SDIO) += btmrvl_sdio.o
obj-$(CONFIG_BT_WILINK) += btwilink.o
obj-$(CONFIG_BT_MTKUART) += btmtkuart.o
obj-$(CONFIG_BT_QCOMSMD) += btqcomsmd.o
obj-$(CONFIG_BT_BCM) += btbcm.o
obj-$(CONFIG_BT_RTL) += btrtl.o
obj-$(CONFIG_BT_QCA) += btqca.o
clean:
rm -rf *.o *.mod.c *.mod.o *.ko *.symvers *.order *.a
obj-$(CONFIG_BT_HCIUART_NOKIA) += hci_nokia.o
obj-$(CONFIG_BT_HCIRSI) += btrsi.o
btmrvl-y := btmrvl_main.o
btmrvl-$(CONFIG_DEBUG_FS) += btmrvl_debugfs.o
hci_uart-y := hci_ldisc.o
hci_uart-$(CONFIG_BT_HCIUART_SERDEV) += hci_serdev.o
hci_uart-$(CONFIG_BT_HCIUART_H4) += hci_h4.o
hci_uart-$(CONFIG_BT_HCIUART_BCSP) += hci_bcsp.o
hci_uart-$(CONFIG_BT_HCIUART_LL) += hci_ll.o
hci_uart-$(CONFIG_BT_HCIUART_ATH3K) += hci_ath.o
hci_uart-$(CONFIG_BT_HCIUART_3WIRE) += hci_h5.o
hci_uart-$(CONFIG_BT_HCIUART_INTEL) += hci_intel.o
hci_uart-$(CONFIG_BT_HCIUART_BCM) += hci_bcm.o
hci_uart-$(CONFIG_BT_HCIUART_QCA) += hci_qca.o
hci_uart-$(CONFIG_BT_HCIUART_AG6XX) += hci_ag6xx.o
hci_uart-$(CONFIG_BT_HCIUART_MRVL) += hci_mrvl.o
hci_uart-objs := $(hci_uart-y)
endif

View File

@ -24,7 +24,6 @@
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/types.h>
@ -32,7 +31,6 @@
#include <linux/interrupt.h>
#include <linux/ptrace.h>
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/errno.h>
@ -40,18 +38,32 @@
#include <linux/signal.h>
#include <linux/ioctl.h>
#include <linux/skbuff.h>
#include <asm/unaligned.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
#include <linux/version.h>
#include "hci_uart.h"
#ifdef BTCOEX
#include "rtk_coex.h"
#endif
//#define VERSION "1.2"
struct h4_struct {
unsigned long rx_state;
unsigned long rx_count;
struct sk_buff *rx_skb;
struct sk_buff_head txq;
};
/* H4 receiver States */
#define H4_W4_PACKET_TYPE 0
#define H4_W4_EVENT_HDR 1
#define H4_W4_ACL_HDR 2
#define H4_W4_SCO_HDR 3
#define H4_W4_DATA 4
/* Initialize protocol */
static int h4_open(struct hci_uart *hu)
{
@ -59,7 +71,7 @@ static int h4_open(struct hci_uart *hu)
BT_DBG("hu %p", hu);
h4 = kzalloc(sizeof(*h4), GFP_KERNEL);
h4 = kzalloc(sizeof(*h4), GFP_ATOMIC);
if (!h4)
return -ENOMEM;
@ -108,33 +120,174 @@ static int h4_enqueue(struct hci_uart *hu, struct sk_buff *skb)
BT_DBG("hu %p skb %p", hu, skb);
/* Prepend skb with frame type */
memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1);
skb_queue_tail(&h4->txq, skb);
return 0;
}
static const struct h4_recv_pkt h4_recv_pkts[] = {
{ H4_RECV_ACL, .recv = hci_recv_frame },
{ H4_RECV_SCO, .recv = hci_recv_frame },
{ H4_RECV_EVENT, .recv = hci_recv_frame },
};
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
static inline int h4_check_data_len(struct h4_struct *h4, int len)
#else
static inline int h4_check_data_len(struct hci_dev *hdev, struct h4_struct *h4, int len)
#endif
{
register int room = skb_tailroom(h4->rx_skb);
BT_DBG("len %d room %d", len, room);
if (!len) {
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
hci_recv_frame(h4->rx_skb);
#else
hci_recv_frame(hdev, h4->rx_skb);
#endif
} else if (len > room) {
BT_ERR("Data length is too large");
kfree_skb(h4->rx_skb);
} else {
h4->rx_state = H4_W4_DATA;
h4->rx_count = len;
return len;
}
h4->rx_state = H4_W4_PACKET_TYPE;
h4->rx_skb = NULL;
h4->rx_count = 0;
return 0;
}
/* Recv data */
static int h4_recv(struct hci_uart *hu, const void *data, int count)
static int h4_recv(struct hci_uart *hu, void *data, int count)
{
struct h4_struct *h4 = hu->priv;
register char *ptr;
struct hci_event_hdr *eh;
struct hci_acl_hdr *ah;
struct hci_sco_hdr *sh;
register int len, type, dlen;
if (!test_bit(HCI_UART_REGISTERED, &hu->flags))
return -EUNATCH;
BT_DBG("hu %p count %d rx_state %ld rx_count %ld",
hu, count, h4->rx_state, h4->rx_count);
h4->rx_skb = h4_recv_buf(hu->hdev, h4->rx_skb, data, count,
h4_recv_pkts, ARRAY_SIZE(h4_recv_pkts));
if (IS_ERR(h4->rx_skb)) {
int err = PTR_ERR(h4->rx_skb);
bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
h4->rx_skb = NULL;
return err;
ptr = data;
while (count) {
if (h4->rx_count) {
len = min_t(unsigned int, h4->rx_count, count);
memcpy(skb_put(h4->rx_skb, len), ptr, len);
h4->rx_count -= len; count -= len; ptr += len;
if (h4->rx_count)
continue;
switch (h4->rx_state) {
case H4_W4_DATA:
BT_DBG("Complete data");
#ifdef BTCOEX
if(bt_cb(h4->rx_skb)->pkt_type == HCI_EVENT_PKT)
rtk_btcoex_parse_event(
h4->rx_skb->data,
h4->rx_skb->len);
if(bt_cb(h4->rx_skb)->pkt_type == HCI_ACLDATA_PKT)
rtk_btcoex_parse_l2cap_data_rx(
h4->rx_skb->data,
h4->rx_skb->len);
#endif
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
hci_recv_frame(h4->rx_skb);
#else
hci_recv_frame(hu->hdev, h4->rx_skb);
#endif
h4->rx_state = H4_W4_PACKET_TYPE;
h4->rx_skb = NULL;
continue;
case H4_W4_EVENT_HDR:
eh = hci_event_hdr(h4->rx_skb);
BT_DBG("Event header: evt 0x%2.2x plen %d", eh->evt, eh->plen);
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
h4_check_data_len(h4, eh->plen);
#else
h4_check_data_len(hu->hdev, h4, eh->plen);
#endif
continue;
case H4_W4_ACL_HDR:
ah = hci_acl_hdr(h4->rx_skb);
dlen = __le16_to_cpu(ah->dlen);
BT_DBG("ACL header: dlen %d", dlen);
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
h4_check_data_len(h4, dlen);
#else
h4_check_data_len(hu->hdev, h4, dlen);
#endif
continue;
case H4_W4_SCO_HDR:
sh = hci_sco_hdr(h4->rx_skb);
BT_DBG("SCO header: dlen %d", sh->dlen);
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
h4_check_data_len(h4, sh->dlen);
#else
h4_check_data_len(hu->hdev, h4, sh->dlen);
#endif
continue;
}
}
/* H4_W4_PACKET_TYPE */
switch (*ptr) {
case HCI_EVENT_PKT:
BT_DBG("Event packet");
h4->rx_state = H4_W4_EVENT_HDR;
h4->rx_count = HCI_EVENT_HDR_SIZE;
type = HCI_EVENT_PKT;
break;
case HCI_ACLDATA_PKT:
BT_DBG("ACL packet");
h4->rx_state = H4_W4_ACL_HDR;
h4->rx_count = HCI_ACL_HDR_SIZE;
type = HCI_ACLDATA_PKT;
break;
case HCI_SCODATA_PKT:
BT_DBG("SCO packet");
h4->rx_state = H4_W4_SCO_HDR;
h4->rx_count = HCI_SCO_HDR_SIZE;
type = HCI_SCODATA_PKT;
break;
default:
BT_ERR("Unknown HCI packet type %2.2x", (__u8)*ptr);
hu->hdev->stat.err_rx++;
ptr++; count--;
continue;
};
ptr++; count--;
/* Allocate packet */
h4->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
if (!h4->rx_skb) {
BT_ERR("Can't allocate mem for new packet");
h4->rx_state = H4_W4_PACKET_TYPE;
h4->rx_count = 0;
return -ENOMEM;
}
h4->rx_skb->dev = (void *) hu->hdev;
bt_cb(h4->rx_skb)->pkt_type = type;
}
return count;
@ -146,9 +299,8 @@ static struct sk_buff *h4_dequeue(struct hci_uart *hu)
return skb_dequeue(&h4->txq);
}
static const struct hci_uart_proto h4p = {
static struct hci_uart_proto h4p = {
.id = HCI_UART_H4,
.name = "H4",
.open = h4_open,
.close = h4_close,
.recv = h4_recv,
@ -159,132 +311,17 @@ static const struct hci_uart_proto h4p = {
int __init h4_init(void)
{
return hci_uart_register_proto(&h4p);
int err = hci_uart_register_proto(&h4p);
if (!err)
BT_INFO("HCI H4 protocol initialized");
else
BT_ERR("HCI H4 protocol registration failed");
return err;
}
int __exit h4_deinit(void)
{
return hci_uart_unregister_proto(&h4p);
}
struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
const unsigned char *buffer, int count,
const struct h4_recv_pkt *pkts, int pkts_count)
{
struct hci_uart *hu = hci_get_drvdata(hdev);
u8 alignment = hu->alignment ? hu->alignment : 1;
/* Check for error from previous call */
if (IS_ERR(skb))
skb = NULL;
while (count) {
int i, len;
/* remove padding bytes from buffer */
for (; hu->padding && count > 0; hu->padding--) {
count--;
buffer++;
}
if (!count)
break;
if (!skb) {
for (i = 0; i < pkts_count; i++) {
if (buffer[0] != (&pkts[i])->type)
continue;
skb = bt_skb_alloc((&pkts[i])->maxlen,
GFP_ATOMIC);
if (!skb)
return ERR_PTR(-ENOMEM);
hci_skb_pkt_type(skb) = (&pkts[i])->type;
hci_skb_expect(skb) = (&pkts[i])->hlen;
break;
}
/* Check for invalid packet type */
if (!skb)
return ERR_PTR(-EILSEQ);
count -= 1;
buffer += 1;
}
len = min_t(uint, hci_skb_expect(skb) - skb->len, count);
skb_put_data(skb, buffer, len);
count -= len;
buffer += len;
/* Check for partial packet */
if (skb->len < hci_skb_expect(skb))
continue;
for (i = 0; i < pkts_count; i++) {
if (hci_skb_pkt_type(skb) == (&pkts[i])->type)
break;
}
if (i >= pkts_count) {
kfree_skb(skb);
return ERR_PTR(-EILSEQ);
}
if (skb->len == (&pkts[i])->hlen) {
u16 dlen;
switch ((&pkts[i])->lsize) {
case 0:
/* No variable data length */
dlen = 0;
break;
case 1:
/* Single octet variable length */
dlen = skb->data[(&pkts[i])->loff];
hci_skb_expect(skb) += dlen;
if (skb_tailroom(skb) < dlen) {
kfree_skb(skb);
return ERR_PTR(-EMSGSIZE);
}
break;
case 2:
/* Double octet variable length */
dlen = get_unaligned_le16(skb->data +
(&pkts[i])->loff);
hci_skb_expect(skb) += dlen;
if (skb_tailroom(skb) < dlen) {
kfree_skb(skb);
return ERR_PTR(-EMSGSIZE);
}
break;
default:
/* Unsupported variable length */
kfree_skb(skb);
return ERR_PTR(-EILSEQ);
}
if (!dlen) {
hu->padding = (skb->len - 1) % alignment;
hu->padding = (alignment - hu->padding) % alignment;
/* No more data, complete frame */
(&pkts[i])->recv(hdev, skb);
skb = NULL;
}
} else {
hu->padding = (skb->len - 1) % alignment;
hu->padding = (alignment - hu->padding) % alignment;
/* Complete frame */
(&pkts[i])->recv(hdev, skb);
skb = NULL;
}
}
return skb;
}
EXPORT_SYMBOL_GPL(h4_recv_buf);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,908 @@
/*
*
* Bluetooth HCI UART driver
*
* Copyright (C) 2011-2014 wifi_fae<wifi_fae@realtek.com.tw>
*
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/interrupt.h>
#include <linux/ptrace.h>
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/signal.h>
#include <linux/ioctl.h>
#include <linux/skbuff.h>
#include <linux/bitrev.h>
#include <asm/unaligned.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
#include <linux/version.h>
#include "hci_uart.h"
#ifdef BTCOEX
#include "rtk_coex.h"
#endif
//#define VERSION "1.0"
static int txcrc = 1;
//static int hciextn = 1;
#define H5_TXWINSIZE 4
#define H5_ACK_PKT 0x00
#define H5_LE_PKT 0x0F
#define H5_VDRSPEC_PKT 0x0E
struct h5_struct {
struct sk_buff_head unack; /* Unack'ed packets queue */
struct sk_buff_head rel; /* Reliable packets queue */
struct sk_buff_head unrel; /* Unreliable packets queue */
unsigned long rx_count;
struct sk_buff *rx_skb;
struct delayed_work retrans_work;
struct hci_uart *hu; /* Parent HCI UART */
enum {
H5_W4_PKT_DELIMITER,
H5_W4_PKT_START,
H5_W4_HDR,
H5_W4_DATA,
H5_W4_CRC
} rx_state;
enum {
H5_ESCSTATE_NOESC,
H5_ESCSTATE_ESC
} rx_esc_state;
u16 message_crc;
u8 use_crc;
u8 rxack; /* Last packet sent by us that the peer ack'ed */
u8 rxseq_txack; /* rxseq == txack. */
u8 txack_req; /* Do we need to send ack's to the peer? */
/* Reliable packet sequence number - used to assign seq to each rel pkt. */
u8 msgq_txseq;
/* The spin lock protects seq, ack and ack req */
spinlock_t lock;
};
/* ---- H5 CRC calculation ---- */
/* Table for calculating CRC for polynomial 0x1021, LSB processed first,
initial value 0xffff, bits shifted in reverse order. */
static const u16 crc_table[] = {
0x0000, 0x1081, 0x2102, 0x3183,
0x4204, 0x5285, 0x6306, 0x7387,
0x8408, 0x9489, 0xa50a, 0xb58b,
0xc60c, 0xd68d, 0xe70e, 0xf78f
};
/* Initialise the crc calculator */
#define H5_CRC_INIT(x) x = 0xffff
/*
Update crc with next data byte
Implementation note
The data byte is treated as two nibbles. The crc is generated
in reverse, i.e., bits are fed into the register from the top.
*/
static void h5_crc_update(u16 * crc, u8 d)
{
u16 reg = *crc;
reg = (reg >> 4) ^ crc_table[(reg ^ d) & 0x000f];
reg = (reg >> 4) ^ crc_table[(reg ^ (d >> 4)) & 0x000f];
*crc = reg;
}
/* ---- H5 core ---- */
static void h5_slip_msgdelim(struct sk_buff *skb)
{
const char pkt_delim = 0xc0;
memcpy(skb_put(skb, 1), &pkt_delim, 1);
}
static void h5_slip_one_byte(struct sk_buff *skb, u8 c)
{
const char esc_c0[2] = { 0xdb, 0xdc };
const char esc_db[2] = { 0xdb, 0xdd };
const char esc_11[2] = { 0xdb, 0xde };
const char esc_13[2] = { 0xdb, 0xdf };
switch (c) {
case 0xc0:
memcpy(skb_put(skb, 2), &esc_c0, 2);
break;
case 0xdb:
memcpy(skb_put(skb, 2), &esc_db, 2);
break;
case 0x11:
memcpy(skb_put(skb, 2), &esc_11, 2);
break;
case 0x13:
memcpy(skb_put(skb, 2), &esc_13, 2);
break;
default:
memcpy(skb_put(skb, 1), &c, 1);
}
}
static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb)
{
struct h5_struct *h5 = hu->priv;
if (skb->len > 0xFFF) { //Pkt length must be less than 4095 bytes
BT_ERR("Packet too long");
kfree_skb(skb);
return 0;
}
switch (bt_cb(skb)->pkt_type) {
case HCI_ACLDATA_PKT:
case HCI_COMMAND_PKT:
skb_queue_tail(&h5->rel, skb);
break;
case HCI_SCODATA_PKT:
skb_queue_tail(&h5->unrel, skb);
break;
case H5_LE_PKT:
case H5_ACK_PKT:
case H5_VDRSPEC_PKT:
skb_queue_tail(&h5->unrel, skb); /* 3-wire LinkEstablishment */
break;
default:
BT_ERR("Unknown packet type");
kfree_skb(skb);
break;
}
return 0;
}
static struct sk_buff *h5_prepare_pkt(struct h5_struct *h5, u8 * data,
int len, int pkt_type)
{
struct sk_buff *nskb;
u8 hdr[4], chan;
u16 H5_CRC_INIT(h5_txmsg_crc);
int rel, i;
u8 tmp;
unsigned long flags;
switch (pkt_type) {
case HCI_ACLDATA_PKT:
chan = 2; /* 3-wire ACL channel */
rel = 1; /* reliable channel */
break;
case HCI_COMMAND_PKT:
chan = 1; /* 3-wire cmd channel */
rel = 1; /* reliable channel */
break;
case HCI_EVENT_PKT:
chan = 4; /* 3-wire cmd channel */
rel = 1; /* reliable channel */
break;
case HCI_SCODATA_PKT:
chan = 3; /* 3-wire SCO channel */
rel = 0; /* unreliable channel */
break;
case H5_LE_PKT:
chan = 15; /* 3-wire LinkEstablishment channel */
rel = 0; /* unreliable channel */
break;
case H5_ACK_PKT:
chan = 0; /* 3-wire ACK channel */
rel = 0; /* unreliable channel */
break;
case H5_VDRSPEC_PKT:
chan = 14; /* 3-wire Vendor Specific channel */
rel = 0; /* unreliable channel */
break;
default:
BT_ERR("Unknown packet type");
return NULL;
}
/* Max len of packet: (original len +4(h5 hdr) +2(crc))*2
(because bytes 0xc0 and 0xdb are escaped, worst case is
when the packet is all made of 0xc0 and 0xdb :) )
+ 2 (0xc0 delimiters at start and end). */
nskb = alloc_skb((len + 6) * 2 + 2, GFP_ATOMIC);
if (!nskb)
return NULL;
bt_cb(nskb)->pkt_type = pkt_type;
h5_slip_msgdelim(nskb);
spin_lock_irqsave(&h5->lock, flags);
tmp = h5->rxseq_txack;
hdr[0] = h5->rxseq_txack << 3;
h5->txack_req = 0;
spin_unlock_irqrestore(&h5->lock, flags);
BT_DBG("We request packet no %u to card", tmp);
if (rel) {
spin_lock_irqsave(&h5->lock, flags);
tmp = h5->msgq_txseq;
hdr[0] |= 0x80 + h5->msgq_txseq;
h5->msgq_txseq = (h5->msgq_txseq + 1) & 0x07;
spin_unlock_irqrestore(&h5->lock, flags);
BT_DBG("Sending packet with seqno %u", tmp);
}
if (h5->use_crc)
hdr[0] |= 0x40;
hdr[1] = ((len << 4) & 0xff) | chan;
hdr[2] = len >> 4;
hdr[3] = ~(hdr[0] + hdr[1] + hdr[2]);
/* Put H5 header */
for (i = 0; i < 4; i++) {
h5_slip_one_byte(nskb, hdr[i]);
if (h5->use_crc)
h5_crc_update(&h5_txmsg_crc, hdr[i]);
}
/* Put payload */
for (i = 0; i < len; i++) {
h5_slip_one_byte(nskb, data[i]);
if (h5->use_crc)
h5_crc_update(&h5_txmsg_crc, data[i]);
}
/* Put CRC */
if (h5->use_crc) {
h5_txmsg_crc = bitrev16(h5_txmsg_crc);
h5_slip_one_byte(nskb, (u8) ((h5_txmsg_crc >> 8) & 0x00ff));
h5_slip_one_byte(nskb, (u8) (h5_txmsg_crc & 0x00ff));
}
h5_slip_msgdelim(nskb);
return nskb;
}
/* This is a rewrite of pkt_avail in AH5 */
static struct sk_buff *h5_dequeue(struct hci_uart *hu)
{
struct h5_struct *h5 = hu->priv;
unsigned long flags;
struct sk_buff *skb;
/* First of all, check for unreliable messages in the queue,
since they have priority */
if ((skb = skb_dequeue(&h5->unrel)) != NULL) {
struct sk_buff *nskb =
h5_prepare_pkt(h5, skb->data, skb->len,
bt_cb(skb)->pkt_type);
if (nskb) {
kfree_skb(skb);
return nskb;
} else {
skb_queue_head(&h5->unrel, skb);
BT_ERR
("Could not dequeue pkt because alloc_skb failed");
}
}
/* Now, try to send a reliable pkt. We can only send a
reliable packet if the number of packets sent but not yet ack'ed
is < than the winsize */
spin_lock_irqsave_nested(&h5->unack.lock, flags, SINGLE_DEPTH_NESTING);
if (h5->unack.qlen < H5_TXWINSIZE
&& (skb = skb_dequeue(&h5->rel)) != NULL) {
struct sk_buff *nskb =
h5_prepare_pkt(h5, skb->data, skb->len,
bt_cb(skb)->pkt_type);
if (nskb) {
__skb_queue_tail(&h5->unack, skb);
schedule_delayed_work(&h5->retrans_work, HZ / 4);
spin_unlock_irqrestore(&h5->unack.lock, flags);
return nskb;
} else {
skb_queue_head(&h5->rel, skb);
BT_ERR
("Could not dequeue pkt because alloc_skb failed");
}
}
spin_unlock_irqrestore(&h5->unack.lock, flags);
/* We could not send a reliable packet, either because there are
none or because there are too many unack'ed pkts. Did we receive
any packets we have not acknowledged yet ? */
if (h5->txack_req) {
/* if so, craft an empty ACK pkt and send it on H5 unreliable
channel 0 */
struct sk_buff *nskb = h5_prepare_pkt(h5, NULL, 0, H5_ACK_PKT);
return nskb;
}
/* We have nothing to send */
return NULL;
}
static int h5_flush(struct hci_uart *hu)
{
BT_DBG("hu %p", hu);
return 0;
}
/* Remove ack'ed packets */
static void h5_pkt_cull(struct h5_struct *h5)
{
struct sk_buff *skb, *tmp;
unsigned long flags;
int i, pkts_to_be_removed;
u8 seqno;
spin_lock_irqsave(&h5->unack.lock, flags);
pkts_to_be_removed = skb_queue_len(&h5->unack);
seqno = h5->msgq_txseq;
while (pkts_to_be_removed) {
if (h5->rxack == seqno)
break;
pkts_to_be_removed--;
seqno = (seqno - 1) & 0x07;
}
if (h5->rxack != seqno)
BT_ERR("Peer acked invalid packet");
BT_DBG("Removing %u pkts out of %u, up to seqno %u",
pkts_to_be_removed, skb_queue_len(&h5->unack),
(seqno - 1) & 0x07);
i = 0;
skb_queue_walk_safe(&h5->unack, skb, tmp) {
if (i >= pkts_to_be_removed)
break;
i++;
__skb_unlink(skb, &h5->unack);
kfree_skb(skb);
}
if (skb_queue_empty(&h5->unack))
cancel_delayed_work(&h5->retrans_work);
spin_unlock_irqrestore(&h5->unack.lock, flags);
if (i != pkts_to_be_removed)
BT_ERR("Removed only %u out of %u pkts", i, pkts_to_be_removed);
}
/* Handle H5 link-establishment packets. When we
detect a "sync" packet, symptom that the BT module has reset,
we do nothing :) (yet) */
#if 0
static void h5_handle_le_pkt(struct hci_uart *hu)
{
struct h5_struct *h5 = hu->priv;
u8 conf_pkt[2] = { 0x03, 0xfc };
u8 conf_rsp_pkt[3] = { 0x04, 0x7b, 0x00 };
u8 sync_pkt[2] = { 0x01, 0x7e };
u8 sync_rsp_pkt[2] = { 0x02, 0x7d };
u8 wakeup_pkt[2] = { 0x05, 0xfa };
u8 woken_pkt[2] = { 0x06, 0xf9 };
u8 sleep_pkt[2] = { 0x07, 0x78 };
/* spot "conf" pkts and reply with a "conf rsp" pkt */
if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
!memcmp(&h5->rx_skb->data[4], conf_pkt, 2)) {
struct sk_buff *nskb = alloc_skb(3, GFP_ATOMIC);
BT_DBG("Found a LE conf pkt");
if (!nskb)
return;
conf_rsp_pkt[2] |= txcrc << 0x4; //crc check enable, version no = 0. needed to be as avariable.
memcpy(skb_put(nskb, 3), conf_rsp_pkt, 3);
bt_cb(nskb)->pkt_type = H5_LE_PKT;
skb_queue_head(&h5->unrel, nskb);
hci_uart_tx_wakeup(hu);
}
/* spot "conf resp" pkts */
else if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
!memcmp(&h5->rx_skb->data[4], conf_rsp_pkt, 2)) {
BT_DBG("Found a LE conf resp pkt, device go into active state");
txcrc = (h5->rx_skb->data[6] >> 0x4) & 0x1;
}
/* Spot "sync" pkts. If we find one...disaster! */
else if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
!memcmp(&h5->rx_skb->data[4], sync_pkt, 2)) {
BT_ERR("Found a LE sync pkt, card has reset");
//DO Something here
}
/* Spot "sync resp" pkts. If we find one...disaster! */
else if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
!memcmp(&h5->rx_skb->data[4], sync_rsp_pkt, 2)) {
BT_ERR
("Found a LE sync resp pkt, device go into initialized state");
// DO Something here
}
/* Spot "wakeup" pkts. reply woken message when in active mode */
else if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
!memcmp(&h5->rx_skb->data[4], wakeup_pkt, 2)) {
struct sk_buff *nskb = alloc_skb(2, GFP_ATOMIC);
BT_ERR("Found a LE Wakeup pkt, and reply woken message");
// DO Something here
memcpy(skb_put(nskb, 2), woken_pkt, 2);
bt_cb(nskb)->pkt_type = H5_LE_PKT;
skb_queue_head(&h5->unrel, nskb);
hci_uart_tx_wakeup(hu);
}
/* Spot "woken" pkts. receive woken message from device */
else if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
!memcmp(&h5->rx_skb->data[4], woken_pkt, 2)) {
BT_ERR("Found a LE woken pkt from device");
// DO Something here
}
/* Spot "Sleep" pkts */
else if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
!memcmp(&h5->rx_indent: Standard input:620: Error:Unmatched 'else'
skb->data[4], sleep_pkt, 2)) {
BT_ERR("Found a LE Sleep pkt");
// DO Something here
}
}
#endif
static inline void h5_unslip_one_byte(struct h5_struct *h5, unsigned char byte)
{
const u8 c0 = 0xc0, db = 0xdb;
const u8 oof1 = 0x11, oof2 = 0x13;
switch (h5->rx_esc_state) {
case H5_ESCSTATE_NOESC:
switch (byte) {
case 0xdb:
h5->rx_esc_state = H5_ESCSTATE_ESC;
break;
default:
memcpy(skb_put(h5->rx_skb, 1), &byte, 1);
if ((h5->rx_skb->data[0] & 0x40) != 0 &&
h5->rx_state != H5_W4_CRC)
h5_crc_update(&h5->message_crc, byte);
h5->rx_count--;
}
break;
case H5_ESCSTATE_ESC:
switch (byte) {
case 0xdc:
memcpy(skb_put(h5->rx_skb, 1), &c0, 1);
if ((h5->rx_skb->data[0] & 0x40) != 0 &&
h5->rx_state != H5_W4_CRC)
h5_crc_update(&h5->message_crc, 0xc0);
h5->rx_esc_state = H5_ESCSTATE_NOESC;
h5->rx_count--;
break;
case 0xdd:
memcpy(skb_put(h5->rx_skb, 1), &db, 1);
if ((h5->rx_skb->data[0] & 0x40) != 0 &&
h5->rx_state != H5_W4_CRC)
h5_crc_update(&h5->message_crc, 0xdb);
h5->rx_esc_state = H5_ESCSTATE_NOESC;
h5->rx_count--;
break;
case 0xde:
memcpy(skb_put(h5->rx_skb, 1), &oof1, 1);
if ((h5->rx_skb->data[0] & 0x40) != 0
&& h5->rx_state != H5_W4_CRC)
h5_crc_update(&h5->message_crc, oof1);
h5->rx_esc_state = H5_ESCSTATE_NOESC;
h5->rx_count--;
break;
case 0xdf:
memcpy(skb_put(h5->rx_skb, 1), &oof2, 1);
if ((h5->rx_skb->data[0] & 0x40) != 0
&& h5->rx_state != H5_W4_CRC)
h5_crc_update(&h5->message_crc, oof2);
h5->rx_esc_state = H5_ESCSTATE_NOESC;
h5->rx_count--;
break;
default:
BT_ERR("Invalid byte %02x after esc byte", byte);
kfree_skb(h5->rx_skb);
h5->rx_skb = NULL;
h5->rx_state = H5_W4_PKT_DELIMITER;
h5->rx_count = 0;
}
}
}
static void h5_complete_rx_pkt(struct hci_uart *hu)
{
struct h5_struct *h5 = hu->priv;
int pass_up;
if (h5->rx_skb->data[0] & 0x80) { /* reliable pkt */
unsigned long flags;
u8 rxseq;
spin_lock_irqsave(&h5->lock, flags);
rxseq = h5->rxseq_txack;
h5->rxseq_txack++;
h5->rxseq_txack %= 0x8;
h5->txack_req = 1;
spin_unlock_irqrestore(&h5->lock, flags);
BT_DBG("Received seqno %u from card", rxseq);
}
h5->rxack = (h5->rx_skb->data[0] >> 3) & 0x07;
BT_DBG("Request for pkt %u from card", h5->rxack);
h5_pkt_cull(h5);
hci_uart_tx_wakeup(hu);
if ((h5->rx_skb->data[1] & 0x0f) == 2 && h5->rx_skb->data[0] & 0x80) {
bt_cb(h5->rx_skb)->pkt_type = HCI_ACLDATA_PKT;
pass_up = 1;
} else if ((h5->rx_skb->data[1] & 0x0f) == 4 &&
h5->rx_skb->data[0] & 0x80) {
bt_cb(h5->rx_skb)->pkt_type = HCI_EVENT_PKT;
pass_up = 1;
} else if ((h5->rx_skb->data[1] & 0x0f) == 3) {
bt_cb(h5->rx_skb)->pkt_type = HCI_SCODATA_PKT;
pass_up = 1;
} else if ((h5->rx_skb->data[1] & 0x0f) == 15 &&
!(h5->rx_skb->data[0] & 0x80)) {
//h5_handle_le_pkt(hu);//Link Establishment Pkt
pass_up = 0;
} else if ((h5->rx_skb->data[1] & 0x0f) == 1 &&
h5->rx_skb->data[0] & 0x80) {
bt_cb(h5->rx_skb)->pkt_type = HCI_COMMAND_PKT;
pass_up = 1;
} else if ((h5->rx_skb->data[1] & 0x0f) == 14) {
bt_cb(h5->rx_skb)->pkt_type = H5_VDRSPEC_PKT;
pass_up = 1;
} else
pass_up = 0;
if (!pass_up) {
/* struct hci_event_hdr hdr; */
u8 desc = (h5->rx_skb->data[1] & 0x0f);
if (desc != H5_ACK_PKT && desc != H5_LE_PKT) {
/* if (hciextn) {
* desc |= 0xc0;
* skb_pull(h5->rx_skb, 4);
* memcpy(skb_push(h5->rx_skb, 1), &desc, 1);
* hdr.evt = 0xff;
* hdr.plen = h5->rx_skb->len;
* memcpy(skb_push(h5->rx_skb, HCI_EVENT_HDR_SIZE),
* &hdr, HCI_EVENT_HDR_SIZE);
* bt_cb(h5->rx_skb)->pkt_type = HCI_EVENT_PKT;
* hci_recv_frame(h5->rx_skb);
* } else { */
BT_ERR("Packet for unknown channel (%u %s)",
h5->rx_skb->data[1] & 0x0f,
h5->rx_skb->data[0] & 0x80 ?
"reliable" : "unreliable");
kfree_skb(h5->rx_skb);
/* } */
} else
kfree_skb(h5->rx_skb);
} else {
/* Pull out H5 hdr */
skb_pull(h5->rx_skb, 4);
#ifdef BTCOEX
if (bt_cb(h5->rx_skb)->pkt_type == HCI_EVENT_PKT)
rtk_btcoex_parse_event(h5->rx_skb->data,
h5->rx_skb->len);
if (bt_cb(h5->rx_skb)->pkt_type == HCI_ACLDATA_PKT)
rtk_btcoex_parse_l2cap_data_rx(h5->rx_skb->data,
h5->rx_skb->len);
#endif
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
hci_recv_frame(h5->rx_skb);
#else
hci_recv_frame(hu->hdev, h5->rx_skb);
#endif
}
h5->rx_state = H5_W4_PKT_DELIMITER;
h5->rx_skb = NULL;
}
static u16 bscp_get_crc(struct h5_struct *h5) {
return get_unaligned_be16(&h5->rx_skb->
data[h5->rx_skb->len - 2]);
}
/* Recv data */
static int h5_recv(struct hci_uart *hu, void *data, int count)
{
struct h5_struct *h5 = hu->priv;
register unsigned char *ptr;
u8 rxseq;
unsigned long flags;
BT_DBG("hu %p count %d rx_state %d rx_count %ld",
hu, count, h5->rx_state, h5->rx_count);
ptr = data;
while (count) {
if (h5->rx_count) {
if (*ptr == 0xc0) {
BT_ERR("Short H5 packet");
kfree_skb(h5->rx_skb);
h5->rx_state = H5_W4_PKT_START;
h5->rx_count = 0;
} else
h5_unslip_one_byte(h5, *ptr);
ptr++;
count--;
continue;
}
switch (h5->rx_state) {
case H5_W4_HDR:
if ((0xff & (u8) ~
(h5->rx_skb->data[0] +
h5->rx_skb->data[1] +
h5->rx_skb->data[2])) != h5->rx_skb->data[3]) {
BT_ERR("Error in H5 hdr checksum");
kfree_skb(h5->rx_skb);
h5->rx_state = H5_W4_PKT_DELIMITER;
h5->rx_count = 0;
continue;
}
rxseq = h5->rxseq_txack;
if (h5->rx_skb->data[0] & 0x80 /* reliable pkt */
&& (h5->rx_skb->data[0] & 0x07) != rxseq) {
BT_ERR("Out-of-order packet arrived, got %u expected %u",
h5->rx_skb->data[0] & 0x07, rxseq);
spin_lock_irqsave(&h5->lock, flags);
h5->txack_req = 1;
spin_unlock_irqrestore(&h5->lock, flags);
hci_uart_tx_wakeup(hu);
kfree_skb(h5->rx_skb);
h5->rx_state = H5_W4_PKT_DELIMITER;
h5->rx_count = 0;
continue;
}
h5->rx_state = H5_W4_DATA;
h5->rx_count = (h5->rx_skb->data[1] >> 4) + (h5->rx_skb->data[2] << 4); /* May be 0 */
continue;
case H5_W4_DATA:
if (h5->rx_skb->data[0] & 0x40) { /* pkt with crc */
h5->rx_state = H5_W4_CRC;
h5->rx_count = 2;
} else
h5_complete_rx_pkt(hu);
continue;
case H5_W4_CRC:
if (bitrev16(h5->message_crc) != bscp_get_crc(h5)) {
BT_ERR
("Checksum failed: computed %04x received %04x",
bitrev16(h5->message_crc),
bscp_get_crc(h5));
kfree_skb(h5->rx_skb);
h5->rx_state = H5_W4_PKT_DELIMITER;
h5->rx_count = 0;
continue;
}
skb_trim(h5->rx_skb, h5->rx_skb->len - 2);
h5_complete_rx_pkt(hu);
continue;
case H5_W4_PKT_DELIMITER:
switch (*ptr) {
case 0xc0:
h5->rx_state = H5_W4_PKT_START;
break;
default:
/*BT_ERR("Ignoring byte %02x", *ptr); */
break;
}
ptr++;
count--;
break;
case H5_W4_PKT_START:
switch (*ptr) {
case 0xc0:
ptr++;
count--;
break;
default:
h5->rx_state = H5_W4_HDR;
h5->rx_count = 4;
h5->rx_esc_state = H5_ESCSTATE_NOESC;
H5_CRC_INIT(h5->message_crc);
/* Do not increment ptr or decrement count
* Allocate packet. Max len of a H5 pkt=
* 0xFFF (payload) +4 (header) +2 (crc) */
h5->rx_skb = bt_skb_alloc(0x1005, GFP_ATOMIC);
if (!h5->rx_skb) {
BT_ERR
("Can't allocate mem for new packet");
h5->rx_state = H5_W4_PKT_DELIMITER;
h5->rx_count = 0;
return 0;
}
h5->rx_skb->dev = (void *)hu->hdev;
break;
}
break;
}
}
return count;
}
/* Arrange to retransmit all messages in the relq. */
static void h5_timed_event(struct work_struct *work)
{
struct h5_struct *h5;
struct hci_uart *hu;
unsigned long flags;
unsigned long flags2;
struct sk_buff *skb;
h5 = container_of(work, struct h5_struct, retrans_work.work);
hu = h5->hu;
BT_INFO("hu %p retransmitting %u pkts", hu, h5->unack.qlen);
spin_lock_irqsave_nested(&h5->unack.lock, flags, SINGLE_DEPTH_NESTING);
/* Move the pkt from unack queue to the head of reliable tx queue and
* roll back the tx seq number
*/
while ((skb = __skb_dequeue_tail(&h5->unack)) != NULL) {
spin_lock_irqsave(&h5->lock, flags2);
h5->msgq_txseq = (h5->msgq_txseq - 1) & 0x07;
spin_unlock_irqrestore(&h5->lock, flags2);
skb_queue_head(&h5->rel, skb);
}
spin_unlock_irqrestore(&h5->unack.lock, flags);
hci_uart_tx_wakeup(hu);
}
static int h5_open(struct hci_uart *hu)
{
struct h5_struct *h5;
BT_DBG("hu %p", hu);
BT_INFO("h5_open");
h5 = kzalloc(sizeof(*h5), GFP_ATOMIC);
if (!h5)
return -ENOMEM;
hu->priv = h5;
skb_queue_head_init(&h5->unack);
skb_queue_head_init(&h5->rel);
skb_queue_head_init(&h5->unrel);
spin_lock_init(&h5->lock);
h5->hu = hu;
INIT_DELAYED_WORK(&h5->retrans_work, (void *)h5_timed_event);
h5->rx_state = H5_W4_PKT_DELIMITER;
if (txcrc)
h5->use_crc = 1;
return 0;
}
static int h5_close(struct hci_uart *hu)
{
struct h5_struct *h5 = hu->priv;
BT_INFO("h5_close");
cancel_delayed_work_sync(&h5->retrans_work);
hu->priv = NULL;
skb_queue_purge(&h5->unack);
skb_queue_purge(&h5->rel);
skb_queue_purge(&h5->unrel);
kfree(h5);
return 0;
}
static struct hci_uart_proto h5 = {
.id = HCI_UART_3WIRE,
.open = h5_open,
.close = h5_close,
.enqueue = h5_enqueue,
.dequeue = h5_dequeue,
.recv = h5_recv,
.flush = h5_flush
};
int h5_init(void)
{
int err = hci_uart_register_proto(&h5);
if (!err)
BT_INFO("HCI Realtek H5 protocol initialized");
else
BT_ERR("HCI Realtek H5 protocol registration failed");
return err;
}
int h5_deinit(void)
{
return hci_uart_unregister_proto(&h5);
}

View File

@ -22,11 +22,40 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/version.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
/* #define HCI_VERSION_CODE KERNEL_VERSION(3, 14, 41) */
#define HCI_VERSION_CODE LINUX_VERSION_CODE
#ifndef N_HCI
#define N_HCI 15
#endif
#ifndef CONFIG_BT_HCIUART_H4
#define CONFIG_BT_HCIUART_H4
#endif
#define BTCOEX
/* Send host sleep notification to Controller */
#define WOBT_NOTIFY 0 /* 1 enable; 0 disable */
/* Send LE whitelist only for Background scan parameters */
#define WOBT_NOTIFY_BG_SCAN_LE_WHITELIST_ONLY (0 * WOBT_NOTIFY) /* 1 enable; 0 disable */
/* RTKBT Power-on Whitelist for sideband wake-up by LE Advertising from Remote.
* Note that it's necessary to apply TV FW Patch. */
#define RTKBT_TV_POWERON_WHITELIST (0 * WOBT_NOTIFY) /* 1 enable; 0 disable */
/* RTKBT Power-on Data Filter for Manufacturer field */
/* Note that please edit the datafilter in
* rtkbt_set_le_device_poweron_data_filter() of hci_ldisc.c */
#define RTKBT_TV_POWERON_DATA_FILTER (0 * WOBT_NOTIFY) /* 1 enable; 0 disable */
#define RTKBT_POWERKEY_WAKEUP
/* Ioctls */
#define HCIUARTSETPROTO _IOW('U', 200, int)
#define HCIUARTGETPROTO _IOR('U', 201, int)
@ -35,7 +64,7 @@
#define HCIUARTGETFLAGS _IOR('U', 204, int)
/* UART protocols */
#define HCI_UART_MAX_PROTO 12
#define HCI_UART_MAX_PROTO 6
#define HCI_UART_H4 0
#define HCI_UART_BCSP 1
@ -43,12 +72,6 @@
#define HCI_UART_H4DS 3
#define HCI_UART_LL 4
#define HCI_UART_ATH3K 5
#define HCI_UART_INTEL 6
#define HCI_UART_BCM 7
#define HCI_UART_QCA 8
#define HCI_UART_AG6XX 9
#define HCI_UART_NOKIA 10
#define HCI_UART_MRVL 11
#define HCI_UART_RAW_DEVICE 0
#define HCI_UART_RESET_ON_INIT 1
@ -58,46 +81,43 @@
#define HCI_UART_VND_DETECT 5
struct hci_uart;
struct serdev_device;
struct hci_uart_proto {
unsigned int id;
const char *name;
unsigned int manufacturer;
unsigned int init_speed;
unsigned int oper_speed;
int (*open)(struct hci_uart *hu);
int (*close)(struct hci_uart *hu);
int (*flush)(struct hci_uart *hu);
int (*setup)(struct hci_uart *hu);
int (*set_baudrate)(struct hci_uart *hu, unsigned int speed);
int (*recv)(struct hci_uart *hu, const void *data, int len);
int (*recv)(struct hci_uart *hu, void *data, int len);
int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb);
struct sk_buff *(*dequeue)(struct hci_uart *hu);
};
struct hci_uart {
struct tty_struct *tty;
struct serdev_device *serdev;
struct hci_dev *hdev;
unsigned long flags;
unsigned long hdev_flags;
struct work_struct init_ready;
struct work_struct write_work;
struct workqueue_struct *hci_uart_wq;
const struct hci_uart_proto *proto;
struct percpu_rw_semaphore proto_lock; /* Stop work for proto close */
struct hci_uart_proto *proto;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
struct percpu_rw_semaphore proto_lock; /* Stop work for proto close */
#else
struct rw_semaphore proto_lock;
#endif
void *priv;
struct semaphore tx_sem; /* semaphore for tx */
struct sk_buff *tx_skb;
unsigned long tx_state;
unsigned int init_speed;
unsigned int oper_speed;
u8 alignment;
u8 padding;
#if WOBT_NOTIFY
struct notifier_block pm_notify_block;
struct notifier_block shutdown_notifier;
#endif
};
/* HCI_UART proto flag bits */
@ -109,100 +129,20 @@ struct hci_uart {
#define HCI_UART_SENDING 1
#define HCI_UART_TX_WAKEUP 2
int hci_uart_register_proto(const struct hci_uart_proto *p);
int hci_uart_unregister_proto(const struct hci_uart_proto *p);
int hci_uart_register_device(struct hci_uart *hu, const struct hci_uart_proto *p);
void hci_uart_unregister_device(struct hci_uart *hu);
int hci_uart_tx_wakeup(struct hci_uart *hu);
int hci_uart_init_ready(struct hci_uart *hu);
void hci_uart_init_work(struct work_struct *work);
void hci_uart_set_baudrate(struct hci_uart *hu, unsigned int speed);
bool hci_uart_has_flow_control(struct hci_uart *hu);
void hci_uart_set_flow_control(struct hci_uart *hu, bool enable);
void hci_uart_set_speeds(struct hci_uart *hu, unsigned int init_speed,
unsigned int oper_speed);
extern int hci_uart_register_proto(struct hci_uart_proto *p);
extern int hci_uart_unregister_proto(struct hci_uart_proto *p);
extern int hci_uart_tx_wakeup(struct hci_uart *hu);
#ifdef CONFIG_BT_HCIUART_H4
int h4_init(void);
int h4_deinit(void);
struct h4_recv_pkt {
u8 type; /* Packet type */
u8 hlen; /* Header length */
u8 loff; /* Data length offset in header */
u8 lsize; /* Data length field size */
u16 maxlen; /* Max overall packet length */
int (*recv)(struct hci_dev *hdev, struct sk_buff *skb);
};
#define H4_RECV_ACL \
.type = HCI_ACLDATA_PKT, \
.hlen = HCI_ACL_HDR_SIZE, \
.loff = 2, \
.lsize = 2, \
.maxlen = HCI_MAX_FRAME_SIZE \
#define H4_RECV_SCO \
.type = HCI_SCODATA_PKT, \
.hlen = HCI_SCO_HDR_SIZE, \
.loff = 2, \
.lsize = 1, \
.maxlen = HCI_MAX_SCO_SIZE
#define H4_RECV_EVENT \
.type = HCI_EVENT_PKT, \
.hlen = HCI_EVENT_HDR_SIZE, \
.loff = 1, \
.lsize = 1, \
.maxlen = HCI_MAX_EVENT_SIZE
struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
const unsigned char *buffer, int count,
const struct h4_recv_pkt *pkts, int pkts_count);
extern int h4_init(void);
extern int h4_deinit(void);
#endif
#ifdef CONFIG_BT_HCIUART_BCSP
int bcsp_init(void);
int bcsp_deinit(void);
#endif
extern int h5_init(void);
extern int h5_deinit(void);
#ifdef CONFIG_BT_HCIUART_LL
int ll_init(void);
int ll_deinit(void);
#endif
#ifdef CONFIG_BT_HCIUART_ATH3K
int ath_init(void);
int ath_deinit(void);
#endif
#ifdef CONFIG_BT_HCIUART_3WIRE
int h5_init(void);
int h5_deinit(void);
#endif
#ifdef CONFIG_BT_HCIUART_INTEL
int intel_init(void);
int intel_deinit(void);
#endif
#ifdef CONFIG_BT_HCIUART_BCM
int bcm_init(void);
int bcm_deinit(void);
#endif
#ifdef CONFIG_BT_HCIUART_QCA
int qca_init(void);
int qca_deinit(void);
#endif
#ifdef CONFIG_BT_HCIUART_AG6XX
int ag6xx_init(void);
int ag6xx_deinit(void);
#endif
#ifdef CONFIG_BT_HCIUART_MRVL
int mrvl_init(void);
int mrvl_deinit(void);
#if HCI_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
extern int hci_uart_send_frame(struct sk_buff *skb);
#else
extern int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,377 @@
/*
*
* Realtek Bluetooth USB driver
*
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <net/bluetooth/hci_core.h>
#include <linux/list.h>
/***********************************
** Realtek - For coexistence **
***********************************/
#define BTRTL_HCIUSB 0
#define BTRTL_HCIUART 1
#define BTRTL_HCI_IF BTRTL_HCIUART
#define TRUE 1
#define FALSE 0
#define CONNECT_PORT 30001
#define CONNECT_PORT_WIFI 30000
#define invite_req "INVITE_REQ"
#define invite_rsp "INVITE_RSP"
#define attend_req "ATTEND_REQ"
#define attend_ack "ATTEND_ACK"
#define wifi_leave "WIFI_LEAVE"
#define leave_ack "LEAVE_ACK"
#define bt_leave "BT_LEAVE"
#define HCI_OP_PERIODIC_INQ 0x0403
#define HCI_EV_LE_META 0x3e
#define HCI_EV_LE_CONN_COMPLETE 0x01
#define HCI_EV_LE_CONN_UPDATE_COMPLETE 0x03
#define HCI_EV_LE_ENHANCED_CONN_COMPLETE 0x0a
//vendor cmd to fw
#define HCI_VENDOR_ENABLE_PROFILE_REPORT_COMMAND 0xfc18
#define HCI_VENDOR_SET_PROFILE_REPORT_LEGACY_COMMAND 0xfc19
#define HCI_VENDOR_SET_PROFILE_REPORT_COMMAND 0xfc1B
#define HCI_VENDOR_MAILBOX_CMD 0xfc8f
#define HCI_VENDOR_SET_BITPOOL 0xfc51
//subcmd to fw
#define HCI_VENDOR_SUB_CMD_WIFI_CHANNEL_AND_BANDWIDTH_CMD 0x11
#define HCI_VENDOR_SUB_CMD_WIFI_FORCE_TX_POWER_CMD 0x17
#define HCI_VENDOR_SUB_CMD_BT_ENABLE_IGNORE_WLAN_ACT_CMD 0x1B
#define HCI_VENDOR_SUB_CMD_BT_REPORT_CONN_SCO_INQ_INFO 0x23
#define HCI_VENDOR_SUB_CMD_BT_AUTO_REPORT_STATUS_INFO 0x27
#define HCI_VENDOR_SUB_CMD_BT_AUTO_REPORT_ENABLE 0x28
#define HCI_VENDOR_SUB_CMD_BT_SET_TXRETRY_REPORT_PARAM 0x29
#define HCI_VENDOR_SUB_CMD_BT_SET_PTATABLE 0x2A
#define HCI_VENDOR_SUB_CMD_SET_BT_PSD_MODE 0x31
#define HCI_VENDOR_SUB_CMD_SET_BT_LNA_CONSTRAINT 0x32
#define HCI_VENDOR_SUB_CMD_GET_AFH_MAP_L 0x40
#define HCI_VENDOR_SUB_CMD_GET_AFH_MAP_M 0x41
#define HCI_VENDOR_SUB_CMD_GET_AFH_MAP_H 0x42
#define HCI_VENDOR_SUB_CMD_RD_REG_REQ 0x43
#define HCI_VENDOR_SUB_CMD_WR_REG_REQ 0x44
#define HCI_EV_VENDOR_SPECIFIC 0xff
//sub event from fw start
#define HCI_VENDOR_PTA_REPORT_EVENT 0x24
#define HCI_VENDOR_PTA_AUTO_REPORT_EVENT 0x25
//vendor cmd to wifi driver
#define HCI_GRP_VENDOR_SPECIFIC (0x3f << 10)
#define HCI_OP_HCI_EXTENSION_VERSION_NOTIFY (0x0100 | HCI_GRP_VENDOR_SPECIFIC)
#define HCI_OP_BT_OPERATION_NOTIFY (0x0102 | HCI_GRP_VENDOR_SPECIFIC)
#define HCI_OP_HCI_BT_INFO_NOTIFY (0x0106 | HCI_GRP_VENDOR_SPECIFIC)
#define HCI_OP_HCI_BT_COEX_NOTIFY (0x0107 | HCI_GRP_VENDOR_SPECIFIC)
#define HCI_OP_HCI_BT_PATCH_VER_NOTIFY (0x0108 | HCI_GRP_VENDOR_SPECIFIC)
#define HCI_OP_HCI_BT_AFH_MAP_NOTIFY (0x0109 | HCI_GRP_VENDOR_SPECIFIC)
#define HCI_OP_HCI_BT_REGISTER_VALUE_NOTIFY (0x010a | HCI_GRP_VENDOR_SPECIFIC)
//bt info reason to wifi
#define HOST_RESPONSE 0 //Host response when receive the BT Info Control Event
#define POLLING_RESPONSE 1 //The BT Info response for polling by BT firmware.
#define AUTO_REPORT 2 //BT auto report by BT firmware.
#define STACK_REPORT_WHILE_DEVICE_D2 3 //Stack report when BT firmware is under power save state(ex:D2)
// vendor event from wifi
#define RTK_HS_EXTENSION_EVENT_WIFI_SCAN 0x01
#define RTK_HS_EXTENSION_EVENT_RADIO_STATUS_NOTIFY 0x02
#define RTK_HS_EXTENSION_EVENT_HCI_BT_INFO_CONTROL 0x03
#define RTK_HS_EXTENSION_EVENT_HCI_BT_COEX_CONTROL 0x04
//op code from wifi
#define BT_PATCH_VERSION_QUERY 0x00
#define IGNORE_WLAN_ACTIVE_CONTROL 0x01
#define LNA_CONSTRAIN_CONTROL 0x02
#define BT_POWER_DECREASE_CONTROL 0x03
#define BT_PSD_MODE_CONTROL 0x04
#define WIFI_BW_CHNL_NOTIFY 0x05
#define QUERY_BT_AFH_MAP 0x06
#define BT_REGISTER_ACCESS 0x07
//bt operation to notify
#define BT_OPCODE_NONE 0
#define BT_OPCODE_INQUIRY_START 1
#define BT_OPCODE_INQUIRY_END 2
#define BT_OPCODE_PAGE_START 3
#define BT_OPCODE_PAGE_SUCCESS_END 4
#define BT_OPCODE_PAGE_UNSUCCESS_END 5
#define BT_OPCODE_PAIR_START 6
#define BT_OPCODE_PAIR_END 7
#define BT_OPCODE_ENABLE_BT 8
#define BT_OPCODE_DISABLE_BT 9
#define HCI_EXTENSION_VERSION 0x0004
#define HCI_CMD_PREAMBLE_SIZE 3
#define PAN_PACKET_COUNT 5
#define STREAM_TO_UINT16(u16, p) {u16 = ((uint16_t)(*(p)) + (((uint16_t)(*((p) + 1))) << 8)); (p) += 2;}
#define UINT16_TO_STREAM(p, u16) {*(p)++ = (uint8_t)(u16); *(p)++ = (uint8_t)((u16) >> 8);}
#define PSM_SDP 0x0001
#define PSM_RFCOMM 0x0003
#define PSM_PAN 0x000F
#define PSM_HID 0x0011
#define PSM_HID_INT 0x0013
#define PSM_AVCTP 0x0017
#define PSM_AVDTP 0x0019
#define PSM_FTP 0x1001
#define PSM_BIP 0x1003
#define PSM_OPP 0x1005
//--add more if needed--//
enum {
profile_sco = 0,
profile_hid = 1,
profile_a2dp = 2,
profile_pan = 3,
profile_hid_interval = 4,
profile_hogp = 5,
profile_voice = 6,
profile_sink = 7,
profile_max = 8
};
#define A2DP_SIGNAL 0x01
#define A2DP_MEDIA 0x02
//profile info data
typedef struct {
struct list_head list;
uint16_t handle;
uint16_t psm;
uint16_t dcid;
uint16_t scid;
uint8_t profile_index;
uint8_t flags;
} rtk_prof_info, *prtk_prof_info;
//profile info for each connection
typedef struct rtl_hci_conn {
struct list_head list;
uint16_t handle;
struct delayed_work a2dp_count_work;
struct delayed_work pan_count_work;
struct delayed_work hogp_count_work;
uint32_t a2dp_packet_count;
uint32_t pan_packet_count;
uint32_t hogp_packet_count;
uint32_t voice_packet_count;
uint8_t type; // 0:l2cap, 1:sco/esco, 2:le
uint16_t profile_bitmap;
uint16_t profile_status;
int8_t profile_refcount[8];
} rtk_conn_prof, *prtk_conn_prof;
#ifdef RTB_SOFTWARE_MAILBOX
struct rtl_btinfo {
u8 cmd;
u8 len;
u8 data[6];
};
#define RTL_BTINFO_LEN (sizeof(struct rtl_btinfo))
/* typedef struct {
* uint8_t cmd_index;
* uint8_t cmd_length;
* uint8_t link_status;
* uint8_t retry_cnt;
* uint8_t rssi;
* uint8_t mailbox_info;
* uint16_t acl_throughput;
* } hci_linkstatus_report; */
typedef struct {
uint8_t type;
uint32_t offset;
uint32_t value;
} hci_mailbox_register;
struct rtl_btinfo_ctl {
uint8_t polling_enable;
uint8_t polling_time;
uint8_t autoreport_enable;
};
#endif /* RTB_SOFTWARE_MAILBOX */
#define MAX_LEN_OF_HCI_EV 32
#define NUM_RTL_HCI_EV 32
struct rtl_hci_ev {
__u8 data[MAX_LEN_OF_HCI_EV];
__u16 len;
struct list_head list;
};
#define L2_MAX_SUBSEC_LEN 128
#define L2_MAX_PKTS 16
struct rtl_l2_buff {
__u8 data[L2_MAX_SUBSEC_LEN];
__u16 len;
__u16 out;
struct list_head list;
};
struct rtl_coex_struct {
struct list_head conn_hash; //hash for connections
struct list_head profile_list; //hash for profile info
struct hci_dev *hdev;
#ifdef RTB_SOFTWARE_MAILBOX
struct socket *udpsock;
struct sockaddr_in addr;
struct sockaddr_in wifi_addr;
struct timer_list polling_timer;
#endif
#ifdef RTB_SOFTWARE_MAILBOX
struct workqueue_struct *sock_wq;
struct delayed_work sock_work;
#endif
struct workqueue_struct *fw_wq;
struct workqueue_struct *timer_wq;
struct delayed_work fw_work;
struct delayed_work l2_work;
#ifdef RTB_SOFTWARE_MAILBOX
struct sock *sk;
#endif
struct urb *urb;
spinlock_t spin_lock_sock;
struct mutex profile_mutex;
uint16_t profile_bitmap;
uint16_t profile_status;
int8_t profile_refcount[8];
uint8_t ispairing;
uint8_t isinquirying;
uint8_t ispaging;
#ifdef RTB_SOFTWARE_MAILBOX
uint8_t wifi_state;
uint8_t autoreport;
uint8_t polling_enable;
uint8_t polling_interval;
uint8_t piconet_id;
uint8_t mode;
uint8_t afh_map[10];
#endif
uint16_t hci_reversion;
uint16_t lmp_subversion;
#ifdef RTB_SOFTWARE_MAILBOX
uint8_t wifi_on;
uint8_t sock_open;
#endif
unsigned long cmd_last_tx;
/* hci ev buff */
struct list_head ev_used_list;
struct list_head ev_free_list;
spinlock_t rxlock;
__u8 pkt_type;
__u16 expect;
__u8 *tbuff;
__u16 elen;
__u8 back_buff[HCI_MAX_EVENT_SIZE];
/* l2cap rx buff */
struct list_head l2_used_list;
struct list_head l2_free_list;
/* buff addr and size */
spinlock_t buff_lock;
unsigned long pages_addr;
unsigned long buff_size;
#define RTL_COEX_RUNNING (1 << 0)
unsigned long flags;
};
#ifdef __LITTLE_ENDIAN
struct sbc_frame_hdr {
uint8_t syncword:8; /* Sync word */
uint8_t subbands:1; /* Subbands */
uint8_t allocation_method:1; /* Allocation method */
uint8_t channel_mode:2; /* Channel mode */
uint8_t blocks:2; /* Blocks */
uint8_t sampling_frequency:2; /* Sampling frequency */
uint8_t bitpool:8; /* Bitpool */
uint8_t crc_check:8; /* CRC check */
} __attribute__ ((packed));
/* NOTE: The code is copied from pa.
* only the bit field in 8-bit is affected by endian, not the 16-bit or 32-bit.
* why?
*/
struct rtp_header {
unsigned cc:4;
unsigned x:1;
unsigned p:1;
unsigned v:2;
unsigned pt:7;
unsigned m:1;
uint16_t sequence_number;
uint32_t timestamp;
uint32_t ssrc;
uint32_t csrc[0];
} __attribute__ ((packed));
#else
/* big endian */
struct sbc_frame_hdr {
uint8_t syncword:8; /* Sync word */
uint8_t sampling_frequency:2; /* Sampling frequency */
uint8_t blocks:2; /* Blocks */
uint8_t channel_mode:2; /* Channel mode */
uint8_t allocation_method:1; /* Allocation method */
uint8_t subbands:1; /* Subbands */
uint8_t bitpool:8; /* Bitpool */
uint8_t crc_check:8; /* CRC check */
} __attribute__ ((packed));
struct rtp_header {
unsigned v:2;
unsigned p:1;
unsigned x:1;
unsigned cc:4;
unsigned m:1;
unsigned pt:7;
uint16_t sequence_number;
uint32_t timestamp;
uint32_t ssrc;
uint32_t csrc[0];
} __attribute__ ((packed));
#endif /* __LITTLE_ENDIAN */
void rtk_btcoex_parse_event(uint8_t *buffer, int count);
void rtk_btcoex_parse_cmd(uint8_t *buffer, int count);
void rtk_btcoex_parse_l2cap_data_tx(uint8_t *buffer, int count);
void rtk_btcoex_parse_l2cap_data_rx(uint8_t *buffer, int count);
void rtk_btcoex_open(struct hci_dev *hdev);
void rtk_btcoex_close(void);
void rtk_btcoex_probe(struct hci_dev *hdev);
void rtk_btcoex_init(void);
void rtk_btcoex_exit(void);

View File

@ -1 +1,2 @@
root:x:0:
messagebus:x:1000:

View File

@ -1 +1,2 @@
root::0:0:root:/root:/bin/sh
messagebus:vftT1/bpULeAU:1000:1000:Linux User,,,:/home/messagebus:/bin/sh

View File

@ -79,4 +79,5 @@ alias ftpsw='cardv sys ftpsw'
alias ftpset='cardv sys ftpset'
alias ftpsset='cardv sys ftpsset'
alias stampsw='cardv sys stampsw'
alias gprssw='cardv sys gprssw'
alias gprssw='cardv sys gprssw'
alias multiintevel='cardv sys multiintevel'

View File

@ -0,0 +1,80 @@
<!-- This configuration file controls the per-user-login-session message bus.
Add a session-local.conf and edit that rather than changing this
file directly. -->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Our well-known bus type, don't change this -->
<type>session</type>
<!-- If we fork, keep the user's original umask to avoid affecting
the behavior of child processes. -->
<keep_umask/>
<listen>unix:tmpdir=/tmp</listen>
<!-- On Unix systems, the most secure authentication mechanism is
EXTERNAL, which uses credential-passing over Unix sockets.
This authentication mechanism is not available on Windows,
is not suitable for use with the tcp: or nonce-tcp: transports,
and will not work on obscure flavours of Unix that do not have
a supported credentials-passing mechanism. On those platforms/transports,
comment out the <auth> element to allow fallback to DBUS_COOKIE_SHA1. -->
<auth>EXTERNAL</auth>
<standard_session_servicedirs />
<policy context="default">
<!-- Allow everything to be sent -->
<allow send_destination="*" eavesdrop="true"/>
<!-- Allow everything to be received -->
<allow eavesdrop="true"/>
<!-- Allow anyone to own anything -->
<allow own="*"/>
</policy>
<!-- Include legacy configuration location -->
<include ignore_missing="yes">/home/payton/blue/etc/dbus-1/session.conf</include>
<!-- Config files are placed here that among other things,
further restrict the above policy for specific services. -->
<includedir>session.d</includedir>
<includedir>/home/payton/blue/etc/dbus-1/session.d</includedir>
<!-- This is included last so local configuration can override what's
in this standard file -->
<include ignore_missing="yes">/home/payton/blue/etc/dbus-1/session-local.conf</include>
<include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>
<!-- For the session bus, override the default relatively-low limits
with essentially infinite limits, since the bus is just running
as the user anyway, using up bus resources is not something we need
to worry about. In some cases, we do set the limits lower than
"all available memory" if exceeding the limit is almost certainly a bug,
having the bus enforce a limit is nicer than a huge memory leak. But the
intent is that these limits should never be hit. -->
<!-- the memory limits are 1G instead of say 4G because they can't exceed 32-bit signed int max -->
<limit name="max_incoming_bytes">1000000000</limit>
<limit name="max_incoming_unix_fds">250000000</limit>
<limit name="max_outgoing_bytes">1000000000</limit>
<limit name="max_outgoing_unix_fds">250000000</limit>
<limit name="max_message_size">1000000000</limit>
<!-- We do not override max_message_unix_fds here since the in-kernel
limit is also relatively low -->
<limit name="service_start_timeout">120000</limit>
<limit name="auth_timeout">240000</limit>
<limit name="pending_fd_timeout">150000</limit>
<limit name="max_completed_connections">100000</limit>
<limit name="max_incomplete_connections">10000</limit>
<limit name="max_connections_per_user">100000</limit>
<limit name="max_pending_service_starts">10000</limit>
<limit name="max_names_per_connection">50000</limit>
<limit name="max_match_rules_per_connection">50000</limit>
<limit name="max_replies_per_connection">50000</limit>
</busconfig>

View File

@ -0,0 +1,142 @@
<!-- This configuration file controls the systemwide message bus.
Add a system-local.conf and edit that rather than changing this
file directly. -->
<!-- Note that there are any number of ways you can hose yourself
security-wise by screwing up this file; in particular, you
probably don't want to listen on any more addresses, add any more
auth mechanisms, run as a different user, etc. -->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Our well-known bus type, do not change this -->
<type>system</type>
<!-- Run as special user -->
<user>messagebus</user>
<!-- Fork into daemon mode -->
<fork/>
<!-- We use system service launching using a helper -->
<standard_system_servicedirs/>
<!-- This is a setuid helper that is used to launch system services -->
<servicehelper>/home/payton/blue/libexec/dbus-daemon-launch-helper</servicehelper>
<!-- Write a pid file -->
<pidfile>/usr/var/run/dbus/pid</pidfile>
<!-- Enable logging to syslog -->
<syslog/>
<!-- Only allow socket-credentials-based authentication -->
<auth>EXTERNAL</auth>
<!-- Only listen on a local socket. (abstract=/path/to/socket
means use abstract namespace, don't really create filesystem
file; only Linux supports this. Use path=/whatever on other
systems.) -->
<listen>unix:path=/usr/var/run/dbus/system_bus_socket</listen>
<policy context="default">
<!-- All users can connect to system bus -->
<allow user="*"/>
<!-- Holes must be punched in service configuration files for
name ownership and sending method calls -->
<deny own="*"/>
<deny send_type="method_call"/>
<!-- Signals and reply messages (method returns, errors) are allowed
by default -->
<allow send_type="signal"/>
<allow send_requested_reply="true" send_type="method_return"/>
<allow send_requested_reply="true" send_type="error"/>
<!-- All messages may be received by default -->
<allow receive_type="method_call"/>
<allow receive_type="method_return"/>
<allow receive_type="error"/>
<allow receive_type="signal"/>
<!-- Allow anyone to talk to the message bus -->
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus" />
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus.Introspectable"/>
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus.Properties"/>
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus.Containers1"/>
<!-- But disallow some specific bus services -->
<deny send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus"
send_member="UpdateActivationEnvironment"/>
<deny send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus.Debug.Stats"/>
<deny send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.systemd1.Activator"/>
</policy>
<!-- Only systemd, which runs as root, may report activation failures. -->
<policy user="root">
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.systemd1.Activator"/>
</policy>
<!-- root may monitor the system bus. -->
<policy user="root">
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus.Monitoring"/>
</policy>
<!-- If the Stats interface was enabled at compile-time, root may use it.
Copy this into system.local.conf or system.d/*.conf if you want to
enable other privileged users to view statistics and debug info -->
<policy user="root">
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus.Debug.Stats"/>
</policy>
<!-- Include legacy configuration location -->
<include ignore_missing="yes">/home/payton/blue/etc/dbus-1/system.conf</include>
<!-- The defaults for these limits are hard-coded in dbus-daemon.
Some clarifications:
Times are in milliseconds (ms); 1000ms = 1 second
133169152 bytes = 127 MiB
33554432 bytes = 32 MiB
150000ms = 2.5 minutes -->
<!-- <limit name="max_incoming_bytes">133169152</limit> -->
<!-- <limit name="max_incoming_unix_fds">64</limit> -->
<!-- <limit name="max_outgoing_bytes">133169152</limit> -->
<!-- <limit name="max_outgoing_unix_fds">64</limit> -->
<!-- <limit name="max_message_size">33554432</limit> -->
<!-- <limit name="max_message_unix_fds">16</limit> -->
<!-- <limit name="service_start_timeout">25000</limit> -->
<!-- <limit name="auth_timeout">5000</limit> -->
<!-- <limit name="pending_fd_timeout">150000</limit> -->
<!-- <limit name="max_completed_connections">2048</limit> -->
<!-- <limit name="max_incomplete_connections">64</limit> -->
<!-- <limit name="max_connections_per_user">256</limit> -->
<!-- <limit name="max_pending_service_starts">512</limit> -->
<!-- <limit name="max_names_per_connection">512</limit> -->
<!-- <limit name="max_match_rules_per_connection">512</limit> -->
<!-- <limit name="max_replies_per_connection">128</limit> -->
<!-- Config files are placed here that among other things, punch
holes in the above policy for specific services. -->
<includedir>system.d</includedir>
<includedir>/home/payton/blue/etc/dbus-1/system.d</includedir>
<!-- This is included last so local configuration can override what's
in this standard file -->
<include ignore_missing="yes">/home/payton/blue/etc/dbus-1/system-local.conf</include>
<include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>
</busconfig>

View File

@ -0,0 +1,30 @@
<!-- This configuration file specifies the required security policies
for Bluetooth core daemon to work. -->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- ../system.conf have denied everything, so we just punch some holes -->
<policy user="root">
<allow own="org.bluez"/>
<allow send_destination="org.bluez"/>
<allow send_interface="org.bluez.AdvertisementMonitor1"/>
<allow send_interface="org.bluez.Agent1"/>
<allow send_interface="org.bluez.MediaEndpoint1"/>
<allow send_interface="org.bluez.MediaPlayer1"/>
<allow send_interface="org.bluez.Profile1"/>
<allow send_interface="org.bluez.GattCharacteristic1"/>
<allow send_interface="org.bluez.GattDescriptor1"/>
<allow send_interface="org.bluez.LEAdvertisement1"/>
<allow send_interface="org.freedesktop.DBus.ObjectManager"/>
<allow send_interface="org.freedesktop.DBus.Properties"/>
<allow send_interface="org.mpris.MediaPlayer2.Player"/>
</policy>
<policy context="default">
<allow send_destination="org.bluez"/>
</policy>
</busconfig>

View File

@ -345,6 +345,7 @@ extern BOOL GPIOMap_DetPoweroff(void);
#define SF_ADC_MUXA DSI_GPIO_0
#define SF_ADC_MUXB DSI_GPIO_1
#define SF_WIFI_EN P_GPIO_11
#define SF_BT_EN L_GPIO_2
#define LED_FOCUS_CTRL LED_RED_DUMMY
#define GPIO_FOCUS_LED x_GPIO_x //FPGA

View File

@ -923,7 +923,7 @@
#define HUNTING_MCU_UART ENABLE
#define HUNTING_IR_LED_940 ENABLE
#define SF_EXIF_MN_BUF_SIZE 256
#define SF_BASE_VERSION "8MD4RCwA901"
#define SF_BASE_VERSION "8MA4RCwDA01"
#define HW_S530 DISABLE
#define DCF_DIR_NAME "MEDIA" /* 100MEDIA */
#define DCF_FILE_NAME "SYGW" /* SYFW0001.JPG */

View File

@ -138,9 +138,9 @@ static KEY_OBJ g_KeyTable[] = {
{FLGKEY_LEFT, KEY_PRESS, NVTEVT_KEY_LEFT, NVTEVT_KEY_PRESS, DEMOSOUND_SOUND_KEY_TONE},
{FLGKEY_LEFT, KEY_CONTINUE, NVTEVT_KEY_LEFT, NVTEVT_KEY_CONTINUE, 0},
{FLGKEY_LEFT, KEY_RELEASE, NVTEVT_KEY_LEFT, NVTEVT_KEY_RELEASE, 0},
{FLGKEY_SHUTTER2, KEY_PRESS, NVTEVT_KEY_SHUTTER2, NVTEVT_KEY_PRESS, DEMOSOUND_SOUND_KEY_TONE},
{FLGKEY_SHUTTER2, KEY_CONTINUE, NVTEVT_KEY_SHUTTER2, NVTEVT_KEY_CONTINUE, 0},
{FLGKEY_SHUTTER2, KEY_RELEASE, NVTEVT_KEY_SHUTTER2, NVTEVT_KEY_RELEASE, 0},
{FLGKEY_SHUTTER2, KEY_PRESS, NVTEVT_KEY_SELECT, NVTEVT_KEY_PRESS, DEMOSOUND_SOUND_KEY_TONE},
{FLGKEY_SHUTTER2, KEY_CONTINUE, NVTEVT_KEY_SELECT, NVTEVT_KEY_CONTINUE, 0},
{FLGKEY_SHUTTER2, KEY_RELEASE, NVTEVT_KEY_SELECT, NVTEVT_KEY_RELEASE, 0},
// {FLGKEY_RIGHT, KEY_PRESS, NVTEVT_KEY_SELECT, NVTEVT_KEY_PRESS, DEMOSOUND_SOUND_KEY_TONE},
// {FLGKEY_RIGHT, KEY_CONTINUE, NVTEVT_KEY_SELECT, NVTEVT_KEY_CONTINUE, 0},
// {FLGKEY_RIGHT, KEY_RELEASE, NVTEVT_KEY_SELECT, NVTEVT_KEY_RELEASE, 0},

View File

@ -466,11 +466,16 @@ INT32 System_OnShutdown(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray)
DBG_ERR("lens error **********\r\n");
} else {
#if (POWEROFFLOGO_FUNCTION == ENABLE)
GxDisplay_Set(LAYER_OSD1, LAYER_STATE_ENABLE, 0); //turn off OSD1
GxDisplay_Flush(LAYER_OSD1);
#if HUNTING_CAMERA_MCU == ENABLE
if(sf_get_mode_flag())
#endif
{
GxDisplay_Set(LAYER_OSD1, LAYER_STATE_ENABLE, 0); //turn off OSD1
GxDisplay_Flush(LAYER_OSD1);
Display_ShowSplash(SPLASH_POWEROFF);
SwTimer_DelayMs(500);
Display_ShowSplash(SPLASH_POWEROFF);
SwTimer_DelayMs(500);
}
#endif
}
#if HUNTING_CAMERA_MCU == ENABLE

View File

@ -203,6 +203,7 @@ SXCMD_ITEM("videosize %", sf_cmd_video_size, "videosize 0/1/2")
SXCMD_ITEM("videolen %", sf_cmd_video_lenth, "videolen 5/10/15/20/30/40/50/59")
SXCMD_ITEM("flashled %", sf_cmd_flash_led, "flashled 0/1")
SXCMD_ITEM("nightmode %", sf_cmd_night_mode, "nightmode 0/1/2 ")
SXCMD_ITEM("multiintevel %", sf_cmd_multishot_intevel, "multishotintevel 0/1/2")
SXCMD_ITEM("multishot %", sf_cmd_multishot, "multishot 0/1/2/3/4 ")
SXCMD_ITEM("pirsw %", sf_cmd_pir_switch, "pirsw 0/1")
SXCMD_ITEM("pirsen %", sf_cmd_pir_sensitivity, "pirsen 0-9")
@ -259,7 +260,7 @@ SXCMD_ITEM("ftpsset %", sf_cmd_ftps, "ftpsset v1 v2 v3 v4")
SXCMD_ITEM("sfota %", sf_cmd_ftp_ota, "sf_ota v1 v2 v3 v4")
SXCMD_ITEM("sf_sw_esim %", sf_cmd_switch_esim, "sf_switch_esim")
SXCMD_ITEM("gprssw %", sf_cmd_gprs_switch, "gprssw 0/1")
SXCMD_ITEM("uiprint %", sf_cmd_para_printf, "uiprint")
#endif

View File

@ -628,6 +628,9 @@ lv_plugin_string_t lv_plugin_DE_string_table[] = {
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_MODE_FW_UPGRADE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_RESET */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_STRING */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_ENTER_WORK */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_DELETE_FILE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_FILE */
};

View File

@ -628,6 +628,9 @@ lv_plugin_string_t lv_plugin_EN_string_table[] = {
{ "Module FW Upgrade", 17 }, /* LV_PLUGIN_STRING_ID_STRING_MODE_FW_UPGRADE */
{ "Reset", 5 }, /* LV_PLUGIN_STRING_ID_STRING_RESET */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_STRING */
{ "Entering Work Mode", 18 }, /* LV_PLUGIN_STRING_ID_STRING_ENTER_WORK */
{ "Comfirm Delete?", 15 }, /* LV_PLUGIN_STRING_ID_STRING_DELETE_FILE */
{ "No File", 7 }, /* LV_PLUGIN_STRING_ID_STRING_NO_FILE */
};

View File

@ -628,6 +628,9 @@ lv_plugin_string_t lv_plugin_ES_string_table[] = {
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_MODE_FW_UPGRADE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_RESET */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_STRING */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_ENTER_WORK */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_DELETE_FILE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_FILE */
};

View File

@ -628,6 +628,9 @@ lv_plugin_string_t lv_plugin_FR_string_table[] = {
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_MODE_FW_UPGRADE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_RESET */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_STRING */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_ENTER_WORK */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_DELETE_FILE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_FILE */
};

View File

@ -628,6 +628,9 @@ lv_plugin_string_t lv_plugin_IT_string_table[] = {
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_MODE_FW_UPGRADE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_RESET */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_STRING */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_ENTER_WORK */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_DELETE_FILE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_FILE */
};

View File

@ -628,6 +628,9 @@ lv_plugin_string_t lv_plugin_JP_string_table[] = {
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_MODE_FW_UPGRADE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_RESET */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_STRING */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_ENTER_WORK */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_DELETE_FILE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_FILE */
};

View File

@ -628,6 +628,9 @@ lv_plugin_string_t lv_plugin_PO_string_table[] = {
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_MODE_FW_UPGRADE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_RESET */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_STRING */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_ENTER_WORK */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_DELETE_FILE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_FILE */
};

View File

@ -628,6 +628,9 @@ lv_plugin_string_t lv_plugin_RU_string_table[] = {
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_MODE_FW_UPGRADE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_RESET */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_STRING */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_ENTER_WORK */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_DELETE_FILE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_FILE */
};

View File

@ -628,6 +628,9 @@ lv_plugin_string_t lv_plugin_SC_string_table[] = {
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_MODE_FW_UPGRADE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_RESET */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_STRING */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_ENTER_WORK */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_DELETE_FILE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_FILE */
};

View File

@ -628,6 +628,9 @@ lv_plugin_string_t lv_plugin_TC_string_table[] = {
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_MODE_FW_UPGRADE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_RESET */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_STRING */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_ENTER_WORK */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_DELETE_FILE */
{ "", 0 }, /* LV_PLUGIN_STRING_ID_STRING_NO_FILE */
};

View File

@ -931,7 +931,7 @@
"font type": "Font_Type0",
"geometry": {
"height": 28,
"width": 37,
"width": 32,
"x": 0,
"y": 6
},
@ -987,7 +987,7 @@
"event callback": "",
"geometry": {
"height": 28,
"width": 36,
"width": 32,
"x": 50,
"y": 202
},
@ -998,7 +998,7 @@
"X": 0,
"Y": 0
},
"source": "sy_bg_msg",
"source": "sy_bg_32X28",
"styles": [
{
"part": 0,
@ -1043,7 +1043,7 @@
"font type": "Font_Type0",
"geometry": {
"height": 28,
"width": 37,
"width": 32,
"x": 0,
"y": 6
},
@ -1099,7 +1099,7 @@
"event callback": "",
"geometry": {
"height": 28,
"width": 36,
"width": 32,
"x": 96,
"y": 202
},
@ -1110,7 +1110,7 @@
"X": 0,
"Y": 0
},
"source": "sy_bg_msg",
"source": "sy_bg_32X28",
"styles": [
{
"part": 0,
@ -1155,7 +1155,7 @@
"font type": "Font_Type0",
"geometry": {
"height": 28,
"width": 103,
"width": 120,
"x": 0,
"y": 6
},
@ -1211,7 +1211,7 @@
"event callback": "",
"geometry": {
"height": 28,
"width": 102,
"width": 120,
"x": 142,
"y": 202
},
@ -1222,7 +1222,7 @@
"X": 0,
"Y": 0
},
"source": "sy_bg_msg2",
"source": "sy_bg_102X28",
"styles": [
{
"part": 0,
@ -1436,7 +1436,7 @@
"X": 0,
"Y": 0
},
"source": "sf_wifi_connected",
"source": "sf_wifi_unconnected",
"styles": [
{
"part": 0,

View File

@ -1179,55 +1179,37 @@
"opa_scale": 120
},
"Text": {
"text_color": "0x31404f",
"text_sel_bg_color": "0x00b495"
"text_color": "0x31404f"
},
"part": 0,
"state": 0
},
{
"Text": {
"text_color": "0xffffff",
"text_font": "montserrat 16 4bpp",
"text_sel_bg_color": "0x01a2b1"
"text_color": "0xffffff"
},
"part": 0,
"state": 1
},
{
"Text": {
"text_font": "montserrat 16 4bpp",
"text_sel_bg_color": "0x01a2b1"
},
"part": 0,
"state": 2
},
{
"Text": {
"text_font": "montserrat 16 4bpp",
"text_sel_bg_color": "0x01a2b1"
},
"part": 0,
"state": 3
},
{
"Text": {
"text_sel_bg_color": "0x01a2b1"
},
"part": 0,
"state": 4
},
{
"Text": {
"text_sel_bg_color": "0x01a2b1"
},
"part": 0,
"state": 5
},
{
"Text": {
"text_color": "0x888888",
"text_sel_bg_color": "0x01a2b1"
"text_color": "0x888888"
},
"part": 0,
"state": 6
@ -1741,7 +1723,7 @@
"X": 0,
"Y": 0
},
"source": "sf_wifi_connected",
"source": "sf_wifi_unconnected",
"styles": [
{
"part": 0,
@ -1942,7 +1924,7 @@
"font type": "Font_Type0",
"geometry": {
"height": 28,
"width": 37,
"width": 32,
"x": 0,
"y": 6
},
@ -1998,7 +1980,7 @@
"event callback": "",
"geometry": {
"height": 28,
"width": 36,
"width": 32,
"x": 50,
"y": 202
},
@ -2009,7 +1991,7 @@
"X": 0,
"Y": 0
},
"source": "sy_bg_msg",
"source": "sy_bg_32X28",
"styles": [
{
"part": 0,
@ -2054,7 +2036,7 @@
"font type": "Font_Type0",
"geometry": {
"height": 28,
"width": 37,
"width": 32,
"x": 0,
"y": 6
},
@ -2110,7 +2092,7 @@
"event callback": "",
"geometry": {
"height": 28,
"width": 36,
"width": 32,
"x": 96,
"y": 202
},
@ -2121,7 +2103,7 @@
"X": 0,
"Y": 0
},
"source": "sy_bg_msg",
"source": "sy_bg_32X28",
"styles": [
{
"part": 0,
@ -2166,7 +2148,7 @@
"font type": "Font_Type0",
"geometry": {
"height": 28,
"width": 103,
"width": 120,
"x": 0,
"y": 6
},
@ -2222,7 +2204,7 @@
"event callback": "",
"geometry": {
"height": 28,
"width": 102,
"width": 120,
"x": 142,
"y": 202
},
@ -2233,7 +2215,7 @@
"X": 0,
"Y": 0
},
"source": "sy_bg_msg2",
"source": "sy_bg_102X28",
"styles": [
{
"part": 0,

View File

@ -2033,7 +2033,7 @@
"geometry": {
"height": 4,
"width": 208,
"x": 40,
"x": 44,
"y": 18
},
"hidden": false,

View File

@ -894,7 +894,10 @@
"Camera FW Upgrade",
"Module FW Upgrade",
"Reset",
""
"",
"Entering Work Mode",
"Comfirm Delete?",
"No File"
]
},
{
@ -1525,6 +1528,9 @@
"",
"",
"",
"",
"",
"",
""
]
},
@ -2156,6 +2162,9 @@
"",
"",
"",
"",
"",
"",
""
]
},
@ -2787,6 +2796,9 @@
"",
"",
"",
"",
"",
"",
""
]
},
@ -3418,6 +3430,9 @@
"",
"",
"",
"",
"",
"",
""
]
},
@ -4049,6 +4064,9 @@
"",
"",
"",
"",
"",
"",
""
]
},
@ -4680,6 +4698,9 @@
"",
"",
"",
"",
"",
"",
""
]
},
@ -5311,6 +5332,9 @@
"",
"",
"",
"",
"",
"",
""
]
},
@ -5942,6 +5966,9 @@
"",
"",
"",
"",
"",
"",
""
]
},
@ -6573,6 +6600,9 @@
"",
"",
"",
"",
"",
"",
""
]
}
@ -7204,6 +7234,9 @@
"STRING_CAMERA_FW_UPGRADE",
"STRING_MODE_FW_UPGRADE",
"STRING_RESET",
"STRING_NO_STRING"
"STRING_NO_STRING",
"STRING_ENTER_WORK",
"STRING_DELETE_FILE",
"STRING_NO_FILE"
]
}

View File

@ -4435,6 +4435,11 @@
"filename": "icons/ICON_YES_M.bmp",
"name": "ICON_YES_M"
},
{
"colorFormat": "Indexed 256 in RGB332",
"filename": "icons/flash_power.bmp",
"name": "flash_power"
},
{
"colorFormat": "Indexed 256 in RGB332",
"filename": "icons/sf_Battery_L0.bmp",
@ -4860,6 +4865,16 @@
"filename": "icons/sf_wifi_unsupport.bmp",
"name": "sf_wifi_unsupport"
},
{
"colorFormat": "Indexed 256 in RGB332",
"filename": "icons/sy_bg_102X28.bmp",
"name": "sy_bg_102X28"
},
{
"colorFormat": "Indexed 256 in RGB332",
"filename": "icons/sy_bg_32X28.bmp",
"name": "sy_bg_32X28"
},
{
"colorFormat": "Indexed 256 in RGB332",
"filename": "icons/sy_bg_msg.bmp",
@ -4870,6 +4885,21 @@
"filename": "icons/sy_bg_msg2.bmp",
"name": "sy_bg_msg2"
},
{
"colorFormat": "Indexed 256 in RGB332",
"filename": "icons/sy_bg_tc1.bmp",
"name": "sy_bg_tc1"
},
{
"colorFormat": "Indexed 256 in RGB332",
"filename": "icons/sy_bg_tc2.bmp",
"name": "sy_bg_tc2"
},
{
"colorFormat": "Indexed 256 in RGB332",
"filename": "icons/sy_bg_tc3.bmp",
"name": "sy_bg_tc3"
},
{
"colorFormat": "Indexed 256 in RGB332",
"filename": "icons/sy_luzhi.bmp",

View File

@ -426,6 +426,7 @@ lv_plugin_img_t lv_plugin_UIFlowLVGL_img_table[] =
{ &icon_wifi_on_m },
{ &icon_yes },
{ &icon_yes_m },
{ &flash_power },
{ &sf_battery_l0 },
{ &sf_battery_l1 },
{ &sf_battery_l2 },
@ -511,8 +512,13 @@ lv_plugin_img_t lv_plugin_UIFlowLVGL_img_table[] =
{ &sf_wifi_connected },
{ &sf_wifi_unconnected },
{ &sf_wifi_unsupport },
{ &sy_bg_102x28 },
{ &sy_bg_32x28 },
{ &sy_bg_msg },
{ &sy_bg_msg2 },
{ &sy_bg_tc1 },
{ &sy_bg_tc2 },
{ &sy_bg_tc3 },
{ &sy_luzhi },
{ &sy_redline },
{ &sy_redline2 },
@ -1276,6 +1282,9 @@ lv_plugin_res_id lv_plugin_fixed_language_string_id_table[] = {
LV_PLUGIN_RES_ID_NONE, /* 625*/
LV_PLUGIN_RES_ID_NONE, /* 626*/
LV_PLUGIN_RES_ID_NONE, /* 627*/
LV_PLUGIN_RES_ID_NONE, /* 628*/
LV_PLUGIN_RES_ID_NONE, /* 629*/
LV_PLUGIN_RES_ID_NONE, /* 630*/
};
lv_plugin_res_t lv_plugin_UIFlowLVGL_res =

View File

@ -470,6 +470,7 @@ LV_IMG_DECLARE(icon_wifi_on);
LV_IMG_DECLARE(icon_wifi_on_m);
LV_IMG_DECLARE(icon_yes);
LV_IMG_DECLARE(icon_yes_m);
LV_IMG_DECLARE(flash_power);
LV_IMG_DECLARE(sf_battery_l0);
LV_IMG_DECLARE(sf_battery_l1);
LV_IMG_DECLARE(sf_battery_l2);
@ -555,8 +556,13 @@ LV_IMG_DECLARE(sf_warning_selected);
LV_IMG_DECLARE(sf_wifi_connected);
LV_IMG_DECLARE(sf_wifi_unconnected);
LV_IMG_DECLARE(sf_wifi_unsupport);
LV_IMG_DECLARE(sy_bg_102x28);
LV_IMG_DECLARE(sy_bg_32x28);
LV_IMG_DECLARE(sy_bg_msg);
LV_IMG_DECLARE(sy_bg_msg2);
LV_IMG_DECLARE(sy_bg_tc1);
LV_IMG_DECLARE(sy_bg_tc2);
LV_IMG_DECLARE(sy_bg_tc3);
LV_IMG_DECLARE(sy_luzhi);
LV_IMG_DECLARE(sy_redline);
LV_IMG_DECLARE(sy_redline2);
@ -949,97 +955,103 @@ LV_IMG_DECLARE(sy_redline2);
#define LV_PLUGIN_IMG_ID_ICON_WIFI_ON_M 386
#define LV_PLUGIN_IMG_ID_ICON_YES 387
#define LV_PLUGIN_IMG_ID_ICON_YES_M 388
#define LV_PLUGIN_IMG_ID_SF_BATTERY_L0 389
#define LV_PLUGIN_IMG_ID_SF_BATTERY_L1 390
#define LV_PLUGIN_IMG_ID_SF_BATTERY_L2 391
#define LV_PLUGIN_IMG_ID_SF_BATTERY_L3 392
#define LV_PLUGIN_IMG_ID_SF_BATTERY_L4 393
#define LV_PLUGIN_IMG_ID_SF_BATTERY_L5 394
#define LV_PLUGIN_IMG_ID_SF_DATE_TIME 395
#define LV_PLUGIN_IMG_ID_SF_EXIT 396
#define LV_PLUGIN_IMG_ID_SF_MAX_NUM_DAY 397
#define LV_PLUGIN_IMG_ID_SF_PWD_DOWN 398
#define LV_PLUGIN_IMG_ID_SF_PWD_UP 399
#define LV_PLUGIN_IMG_ID_SF_PICSIZE_12M 400
#define LV_PLUGIN_IMG_ID_SF_PICSIZE_16M 401
#define LV_PLUGIN_IMG_ID_SF_PICSIZE_5M 402
#define LV_PLUGIN_IMG_ID_SF_PICSIZE_8M 403
#define LV_PLUGIN_IMG_ID_SF_SD_LOOP 404
#define LV_PLUGIN_IMG_ID_SF_BACK 405
#define LV_PLUGIN_IMG_ID_SF_BATTERY_TYPE 406
#define LV_PLUGIN_IMG_ID_SF_BLUETOOTH_CONNECTED 407
#define LV_PLUGIN_IMG_ID_SF_BLUETOOTH_UNCONNECTED 408
#define LV_PLUGIN_IMG_ID_SF_BLUETOOTH_UNSUPPORT 409
#define LV_PLUGIN_IMG_ID_SF_BUSY_1 410
#define LV_PLUGIN_IMG_ID_SF_BUSY_2 411
#define LV_PLUGIN_IMG_ID_SF_BUSY_3 412
#define LV_PLUGIN_IMG_ID_SF_BUSY_4 413
#define LV_PLUGIN_IMG_ID_SF_BUSY_5 414
#define LV_PLUGIN_IMG_ID_SF_BUSY_6 415
#define LV_PLUGIN_IMG_ID_SF_CAMERA 416
#define LV_PLUGIN_IMG_ID_SF_CAMERA_FW_UPGRADE 417
#define LV_PLUGIN_IMG_ID_SF_CAMERA_INFO 418
#define LV_PLUGIN_IMG_ID_SF_CAMERA_MODE 419
#define LV_PLUGIN_IMG_ID_SF_CAMERA_NAME 420
#define LV_PLUGIN_IMG_ID_SF_CAMERA_NETWORK_SELECTION 421
#define LV_PLUGIN_IMG_ID_SF_CHARGE_BLACK 422
#define LV_PLUGIN_IMG_ID_SF_CHARGE_DC 423
#define LV_PLUGIN_IMG_ID_SF_CHARGE_WRITE 424
#define LV_PLUGIN_IMG_ID_SF_DELAY 425
#define LV_PLUGIN_IMG_ID_SF_DELETE 426
#define LV_PLUGIN_IMG_ID_SF_FLASH_POWER 427
#define LV_PLUGIN_IMG_ID_SF_FORMAT_SD 428
#define LV_PLUGIN_IMG_ID_SF_GPS 429
#define LV_PLUGIN_IMG_ID_SF_GREEN_SQUARE 430
#define LV_PLUGIN_IMG_ID_SF_IMAGE_SIZE 431
#define LV_PLUGIN_IMG_ID_SF_LEFT 432
#define LV_PLUGIN_IMG_ID_SF_LIST_SELECTED 433
#define LV_PLUGIN_IMG_ID_SF_MENU_BG 434
#define LV_PLUGIN_IMG_ID_SF_MENU_RELEASE 435
#define LV_PLUGIN_IMG_ID_SF_MENU_SELECT 436
#define LV_PLUGIN_IMG_ID_SF_MODE_STILL_VIDEO 437
#define LV_PLUGIN_IMG_ID_SF_MODULE_FW_UPGRADE 438
#define LV_PLUGIN_IMG_ID_SF_NET2G 439
#define LV_PLUGIN_IMG_ID_SF_NET3G 440
#define LV_PLUGIN_IMG_ID_SF_NET4G 441
#define LV_PLUGIN_IMG_ID_SF_NEXT 442
#define LV_PLUGIN_IMG_ID_SF_NEXT1 443
#define LV_PLUGIN_IMG_ID_SF_NEXT2 444
#define LV_PLUGIN_IMG_ID_SF_OFF 445
#define LV_PLUGIN_IMG_ID_SF_ON 446
#define LV_PLUGIN_IMG_ID_SF_OPERATING_TIME 447
#define LV_PLUGIN_IMG_ID_SF_PASSWORD 448
#define LV_PLUGIN_IMG_ID_SF_PICTURE_UPON_DAILY_REPORT 449
#define LV_PLUGIN_IMG_ID_SF_PLAY 450
#define LV_PLUGIN_IMG_ID_SF_QR 451
#define LV_PLUGIN_IMG_ID_SF_RESET 452
#define LV_PLUGIN_IMG_ID_SF_RIGHT 453
#define LV_PLUGIN_IMG_ID_SF_SEND_TYPE 454
#define LV_PLUGIN_IMG_ID_SF_SENSITVITY 455
#define LV_PLUGIN_IMG_ID_SF_SHOOT_1 456
#define LV_PLUGIN_IMG_ID_SF_SIGNAL0 457
#define LV_PLUGIN_IMG_ID_SF_SIGNAL1 458
#define LV_PLUGIN_IMG_ID_SF_SIGNAL2 459
#define LV_PLUGIN_IMG_ID_SF_SIGNAL3 460
#define LV_PLUGIN_IMG_ID_SF_SIGNAL4 461
#define LV_PLUGIN_IMG_ID_SF_SMS_CTRL 462
#define LV_PLUGIN_IMG_ID_SF_STOP 463
#define LV_PLUGIN_IMG_ID_SF_TAB_RELEASE 464
#define LV_PLUGIN_IMG_ID_SF_TAB_SELECT 465
#define LV_PLUGIN_IMG_ID_SF_VIDEO_LENGTH 466
#define LV_PLUGIN_IMG_ID_SF_VIDEO_SIZE 467
#define LV_PLUGIN_IMG_ID_SF_WARNING_BG 468
#define LV_PLUGIN_IMG_ID_SF_WARNING_NOT_SELECT 469
#define LV_PLUGIN_IMG_ID_SF_WARNING_SELECTED 470
#define LV_PLUGIN_IMG_ID_SF_WIFI_CONNECTED 471
#define LV_PLUGIN_IMG_ID_SF_WIFI_UNCONNECTED 472
#define LV_PLUGIN_IMG_ID_SF_WIFI_UNSUPPORT 473
#define LV_PLUGIN_IMG_ID_SY_BG_MSG 474
#define LV_PLUGIN_IMG_ID_SY_BG_MSG2 475
#define LV_PLUGIN_IMG_ID_SY_LUZHI 476
#define LV_PLUGIN_IMG_ID_SY_REDLINE 477
#define LV_PLUGIN_IMG_ID_SY_REDLINE2 478
#define LV_PLUGIN_IMG_TABLE_SIZE 479
#define LV_PLUGIN_IMG_ID_FLASH_POWER 389
#define LV_PLUGIN_IMG_ID_SF_BATTERY_L0 390
#define LV_PLUGIN_IMG_ID_SF_BATTERY_L1 391
#define LV_PLUGIN_IMG_ID_SF_BATTERY_L2 392
#define LV_PLUGIN_IMG_ID_SF_BATTERY_L3 393
#define LV_PLUGIN_IMG_ID_SF_BATTERY_L4 394
#define LV_PLUGIN_IMG_ID_SF_BATTERY_L5 395
#define LV_PLUGIN_IMG_ID_SF_DATE_TIME 396
#define LV_PLUGIN_IMG_ID_SF_EXIT 397
#define LV_PLUGIN_IMG_ID_SF_MAX_NUM_DAY 398
#define LV_PLUGIN_IMG_ID_SF_PWD_DOWN 399
#define LV_PLUGIN_IMG_ID_SF_PWD_UP 400
#define LV_PLUGIN_IMG_ID_SF_PICSIZE_12M 401
#define LV_PLUGIN_IMG_ID_SF_PICSIZE_16M 402
#define LV_PLUGIN_IMG_ID_SF_PICSIZE_5M 403
#define LV_PLUGIN_IMG_ID_SF_PICSIZE_8M 404
#define LV_PLUGIN_IMG_ID_SF_SD_LOOP 405
#define LV_PLUGIN_IMG_ID_SF_BACK 406
#define LV_PLUGIN_IMG_ID_SF_BATTERY_TYPE 407
#define LV_PLUGIN_IMG_ID_SF_BLUETOOTH_CONNECTED 408
#define LV_PLUGIN_IMG_ID_SF_BLUETOOTH_UNCONNECTED 409
#define LV_PLUGIN_IMG_ID_SF_BLUETOOTH_UNSUPPORT 410
#define LV_PLUGIN_IMG_ID_SF_BUSY_1 411
#define LV_PLUGIN_IMG_ID_SF_BUSY_2 412
#define LV_PLUGIN_IMG_ID_SF_BUSY_3 413
#define LV_PLUGIN_IMG_ID_SF_BUSY_4 414
#define LV_PLUGIN_IMG_ID_SF_BUSY_5 415
#define LV_PLUGIN_IMG_ID_SF_BUSY_6 416
#define LV_PLUGIN_IMG_ID_SF_CAMERA 417
#define LV_PLUGIN_IMG_ID_SF_CAMERA_FW_UPGRADE 418
#define LV_PLUGIN_IMG_ID_SF_CAMERA_INFO 419
#define LV_PLUGIN_IMG_ID_SF_CAMERA_MODE 420
#define LV_PLUGIN_IMG_ID_SF_CAMERA_NAME 421
#define LV_PLUGIN_IMG_ID_SF_CAMERA_NETWORK_SELECTION 422
#define LV_PLUGIN_IMG_ID_SF_CHARGE_BLACK 423
#define LV_PLUGIN_IMG_ID_SF_CHARGE_DC 424
#define LV_PLUGIN_IMG_ID_SF_CHARGE_WRITE 425
#define LV_PLUGIN_IMG_ID_SF_DELAY 426
#define LV_PLUGIN_IMG_ID_SF_DELETE 427
#define LV_PLUGIN_IMG_ID_SF_FLASH_POWER 428
#define LV_PLUGIN_IMG_ID_SF_FORMAT_SD 429
#define LV_PLUGIN_IMG_ID_SF_GPS 430
#define LV_PLUGIN_IMG_ID_SF_GREEN_SQUARE 431
#define LV_PLUGIN_IMG_ID_SF_IMAGE_SIZE 432
#define LV_PLUGIN_IMG_ID_SF_LEFT 433
#define LV_PLUGIN_IMG_ID_SF_LIST_SELECTED 434
#define LV_PLUGIN_IMG_ID_SF_MENU_BG 435
#define LV_PLUGIN_IMG_ID_SF_MENU_RELEASE 436
#define LV_PLUGIN_IMG_ID_SF_MENU_SELECT 437
#define LV_PLUGIN_IMG_ID_SF_MODE_STILL_VIDEO 438
#define LV_PLUGIN_IMG_ID_SF_MODULE_FW_UPGRADE 439
#define LV_PLUGIN_IMG_ID_SF_NET2G 440
#define LV_PLUGIN_IMG_ID_SF_NET3G 441
#define LV_PLUGIN_IMG_ID_SF_NET4G 442
#define LV_PLUGIN_IMG_ID_SF_NEXT 443
#define LV_PLUGIN_IMG_ID_SF_NEXT1 444
#define LV_PLUGIN_IMG_ID_SF_NEXT2 445
#define LV_PLUGIN_IMG_ID_SF_OFF 446
#define LV_PLUGIN_IMG_ID_SF_ON 447
#define LV_PLUGIN_IMG_ID_SF_OPERATING_TIME 448
#define LV_PLUGIN_IMG_ID_SF_PASSWORD 449
#define LV_PLUGIN_IMG_ID_SF_PICTURE_UPON_DAILY_REPORT 450
#define LV_PLUGIN_IMG_ID_SF_PLAY 451
#define LV_PLUGIN_IMG_ID_SF_QR 452
#define LV_PLUGIN_IMG_ID_SF_RESET 453
#define LV_PLUGIN_IMG_ID_SF_RIGHT 454
#define LV_PLUGIN_IMG_ID_SF_SEND_TYPE 455
#define LV_PLUGIN_IMG_ID_SF_SENSITVITY 456
#define LV_PLUGIN_IMG_ID_SF_SHOOT_1 457
#define LV_PLUGIN_IMG_ID_SF_SIGNAL0 458
#define LV_PLUGIN_IMG_ID_SF_SIGNAL1 459
#define LV_PLUGIN_IMG_ID_SF_SIGNAL2 460
#define LV_PLUGIN_IMG_ID_SF_SIGNAL3 461
#define LV_PLUGIN_IMG_ID_SF_SIGNAL4 462
#define LV_PLUGIN_IMG_ID_SF_SMS_CTRL 463
#define LV_PLUGIN_IMG_ID_SF_STOP 464
#define LV_PLUGIN_IMG_ID_SF_TAB_RELEASE 465
#define LV_PLUGIN_IMG_ID_SF_TAB_SELECT 466
#define LV_PLUGIN_IMG_ID_SF_VIDEO_LENGTH 467
#define LV_PLUGIN_IMG_ID_SF_VIDEO_SIZE 468
#define LV_PLUGIN_IMG_ID_SF_WARNING_BG 469
#define LV_PLUGIN_IMG_ID_SF_WARNING_NOT_SELECT 470
#define LV_PLUGIN_IMG_ID_SF_WARNING_SELECTED 471
#define LV_PLUGIN_IMG_ID_SF_WIFI_CONNECTED 472
#define LV_PLUGIN_IMG_ID_SF_WIFI_UNCONNECTED 473
#define LV_PLUGIN_IMG_ID_SF_WIFI_UNSUPPORT 474
#define LV_PLUGIN_IMG_ID_SY_BG_102X28 475
#define LV_PLUGIN_IMG_ID_SY_BG_32X28 476
#define LV_PLUGIN_IMG_ID_SY_BG_MSG 477
#define LV_PLUGIN_IMG_ID_SY_BG_MSG2 478
#define LV_PLUGIN_IMG_ID_SY_BG_TC1 479
#define LV_PLUGIN_IMG_ID_SY_BG_TC2 480
#define LV_PLUGIN_IMG_ID_SY_BG_TC3 481
#define LV_PLUGIN_IMG_ID_SY_LUZHI 482
#define LV_PLUGIN_IMG_ID_SY_REDLINE 483
#define LV_PLUGIN_IMG_ID_SY_REDLINE2 484
#define LV_PLUGIN_IMG_TABLE_SIZE 485
#define LV_PLUGIN_FONT_ID_LV_FONT_MONTSERRAT_16 1
#define LV_PLUGIN_FONT_ID_NOTOSANSCJKJP_BLACK_16_1BPP 2
@ -1686,7 +1698,10 @@ LV_IMG_DECLARE(sy_redline2);
#define LV_PLUGIN_STRING_ID_STRING_MODE_FW_UPGRADE 625
#define LV_PLUGIN_STRING_ID_STRING_RESET 626
#define LV_PLUGIN_STRING_ID_STRING_NO_STRING 627
#define LV_PLUGIN_STRING_TABLE_SIZE 628
#define LV_PLUGIN_STRING_ID_STRING_ENTER_WORK 628
#define LV_PLUGIN_STRING_ID_STRING_DELETE_FILE 629
#define LV_PLUGIN_STRING_ID_STRING_NO_FILE 630
#define LV_PLUGIN_STRING_TABLE_SIZE 631
#define LV_PLUGIN_LANGUAGE_ID_EN 1
#define LV_PLUGIN_LANGUAGE_ID_FR 2

View File

@ -184,6 +184,7 @@ void UIFlowMenuCommonConfirm_OnChildScrClose(lv_obj_t* obj, const LV_USER_EVENT_
}
}
static void UIFlowMenuCommonConfirm_MessageBox_ValueChanged(lv_obj_t* obj, uint32_t* value);
/***************************************************************************
*
@ -216,14 +217,19 @@ static void UIFlowMenuCommonConfirm_MessageBox_Key(lv_obj_t* obj, uint32_t key)
break;
}
// case LV_USER_KEY_SHUTTER2:
// {
// if(gp){
// // printf("ssssssssssssssssssssssssssss send enter key.\n");
// lv_group_send_data(gp, LV_USER_KEY_SHUTTER2);
// }
// break;
// }
case LV_USER_KEY_SHUTTER2:
{
// if(gp){
// lv_group_send_data(gp, LV_KEY_ENTER);
// }
// break;
static int todo = 8;
lv_event_send(obj, LV_EVENT_CLICKED, &todo);
break;
// uint32_t todo = 0;
// UIFlowMenuCommonConfirm_MessageBox_ValueChanged(obj, &todo);
break;
}
}
}
@ -232,14 +238,14 @@ static void UIFlowMenuCommonConfirm_MessageBox_ValueChanged(lv_obj_t* obj, uint3
{
if(NULL == value)
return;
if (*value == 0) {
const char* msgbox_text = lv_msgbox_get_text(obj);
const char* erase_text = lv_plugin_get_string(LV_PLUGIN_STRING_ID_STRID_ERASE_THIS)->ptr;
if(strcmp(msgbox_text, erase_text) == 0){
#if(PLAY_MODE)
printf("delete file.\n");
// #if(PLAY_MODE)
UINT32 uiLockStatus;
PB_GetParam(PBPRMID_FILE_ATTR_LOCK, &uiLockStatus);
if (uiLockStatus) {
@ -250,7 +256,7 @@ static void UIFlowMenuCommonConfirm_MessageBox_ValueChanged(lv_obj_t* obj, uint3
}
UIPlay_Delete(PB_DELETE_ONE);
UIPlay_PlaySingle(PB_SINGLE_CURR);
#endif
// #endif
UIFlowMenuCommonConfirm_CloseScr();
@ -352,6 +358,7 @@ void message_box_confirm_msg_event_callback(lv_obj_t* obj, lv_event_t event)
/* triggered by button release */
case LV_EVENT_VALUE_CHANGED:
case LV_EVENT_CLICKED:
{
UIFlowMenuCommonConfirm_MessageBox_ValueChanged(obj, (uint32_t*)lv_event_get_data());
break;

View File

@ -4,6 +4,9 @@
#include "UIApp/Network/UIAppNetwork.h"
#include "UIFlowLVGL/UIFlowMenuCommonItem/MenuId.h"
#include <kwrap/debug.h>
#if HUNTING_CAMERA_MCU == ENABLE
#include <sf_inc.h>
#endif
#define PAGE 32
#define PER_PAGE_NUM 5
@ -623,10 +626,17 @@ static void UIFlowMenuCommonItem_ScrOpen(lv_obj_t* obj)
LV_MenuItem_OnOpen(obj);
#if HUNTING_CAMERA_MCU == ENABLE
sf_set_menu_open(TRUE);
#endif
}
static void UIFlowMenuCommonItem_Key(lv_obj_t* obj, uint32_t key)
{
#if HUNTING_CAMERA_MCU == ENABLE
sf_set_auto_off_time(0);
#endif
switch(key)
{
@ -665,22 +675,27 @@ static void UIFlowMenuCommonItem_Key(lv_obj_t* obj, uint32_t key)
break;
}
case LV_USER_KEY_SELECT:
{
printf("\033[33m[UIFlowMenuCommonItem_Key]LV_USER_KEY_SELECT\033[0m\n");
CHKPNT;
printf("========================== select.\n");
LV_MenuItem_OnSelected(obj);
break;
}
// case LV_USER_KEY_SELECT:
// {
// CHKPNT;
// printf("========================== select.\n");
// LV_MenuItem_OnSelected(obj);
// break;
// }
case LV_USER_KEY_SHUTTER2:
case LV_KEY_ENTER:
{
printf("\033[33m[UIFlowMenuCommonItem_Key]LV_USER_KEY_SELECT\033[0m\n");
lv_plugin_scr_close(obj, NULL);
break;
}
#if HUNTING_CAMERA_MCU == ENABLE
case LV_USER_KEY_DATAREADY:
{
printf("[dataready] %s(%d)\n", __FUNCTION__, __LINE__);
sf_mcu_dataready_get();
break;
}
#endif
}
}

View File

@ -3,6 +3,9 @@
#include "UIFlowLVGL/UIFlowLVGL.h"
#include "UIApp/Network/UIAppNetwork.h"
#include <kwrap/debug.h>
#if HUNTING_CAMERA_MCU == ENABLE
#include <sf_inc.h>
#endif
#define OPTION_PAGE_NUM 5
@ -685,6 +688,9 @@ static void UIFlowMenuCommonOption_ScrOpen(lv_obj_t* obj, const void *data)
static void UIFlowMenuCommonOption_Key(lv_obj_t* obj, uint32_t key)
{
#if HUNTING_CAMERA_MCU == ENABLE
sf_set_auto_off_time(0);
#endif
switch(key)
{
@ -725,7 +731,14 @@ static void UIFlowMenuCommonOption_Key(lv_obj_t* obj, uint32_t key)
LV_MenuOption_OnSelected(obj);
break;
}
#if HUNTING_CAMERA_MCU == ENABLE
case LV_USER_KEY_DATAREADY:
{
printf("[dataready] %s(%d)\n", __FUNCTION__, __LINE__);
sf_mcu_dataready_get();
break;
}
#endif
}

View File

@ -1002,8 +1002,8 @@ lv_obj_t* UIFlowMovie_create(){
lv_obj_set_click(image_5, false);
lv_obj_set_drag(image_5, false);
lv_obj_set_pos(image_5, 50, 202);
lv_obj_set_size(image_5, 36, 28);
lv_img_set_src(image_5, &sy_bg_msg);
lv_obj_set_size(image_5, 32, 28);
lv_img_set_src(image_5, &sy_bg_32x28);
lv_obj_add_style(image_5, 0, &image_5_s0);
image_5_scr_uiflowmovie = image_5;
@ -1065,7 +1065,7 @@ lv_obj_t* UIFlowMovie_create(){
lv_label_set_align(label_4, LV_LABEL_ALIGN_CENTER);
lv_label_set_long_mode(label_4, LV_LABEL_LONG_SROLL);
lv_obj_set_pos(label_4, 0, 6);
lv_obj_set_size(label_4, 37, 28);
lv_obj_set_size(label_4, 32, 28);
lv_obj_add_style(label_4, 0, &label_4_s0);
label_4_scr_uiflowmovie = label_4;
@ -1113,8 +1113,8 @@ lv_obj_t* UIFlowMovie_create(){
lv_obj_set_click(image_6, false);
lv_obj_set_drag(image_6, false);
lv_obj_set_pos(image_6, 96, 202);
lv_obj_set_size(image_6, 36, 28);
lv_img_set_src(image_6, &sy_bg_msg);
lv_obj_set_size(image_6, 32, 28);
lv_img_set_src(image_6, &sy_bg_32x28);
lv_obj_add_style(image_6, 0, &image_6_s0);
image_6_scr_uiflowmovie = image_6;
@ -1176,7 +1176,7 @@ lv_obj_t* UIFlowMovie_create(){
lv_label_set_align(label_5, LV_LABEL_ALIGN_CENTER);
lv_label_set_long_mode(label_5, LV_LABEL_LONG_SROLL);
lv_obj_set_pos(label_5, 0, 6);
lv_obj_set_size(label_5, 37, 28);
lv_obj_set_size(label_5, 32, 28);
lv_obj_add_style(label_5, 0, &label_5_s0);
label_5_scr_uiflowmovie = label_5;
@ -1224,8 +1224,8 @@ lv_obj_t* UIFlowMovie_create(){
lv_obj_set_click(image_7, false);
lv_obj_set_drag(image_7, false);
lv_obj_set_pos(image_7, 142, 202);
lv_obj_set_size(image_7, 102, 28);
lv_img_set_src(image_7, &sy_bg_msg2);
lv_obj_set_size(image_7, 120, 28);
lv_img_set_src(image_7, &sy_bg_102x28);
lv_obj_add_style(image_7, 0, &image_7_s0);
image_7_scr_uiflowmovie = image_7;
@ -1287,7 +1287,7 @@ lv_obj_t* UIFlowMovie_create(){
lv_label_set_align(label_6, LV_LABEL_ALIGN_CENTER);
lv_label_set_long_mode(label_6, LV_LABEL_LONG_SROLL);
lv_obj_set_pos(label_6, 0, 6);
lv_obj_set_size(label_6, 103, 28);
lv_obj_set_size(label_6, 120, 28);
lv_obj_add_style(label_6, 0, &label_6_s0);
label_6_scr_uiflowmovie = label_6;
@ -1496,7 +1496,7 @@ lv_obj_t* UIFlowMovie_create(){
lv_obj_set_drag(image_wifi_connected, false);
lv_obj_set_pos(image_wifi_connected, 40, 0);
lv_obj_set_size(image_wifi_connected, 48, 40);
lv_img_set_src(image_wifi_connected, &sf_wifi_connected);
lv_img_set_src(image_wifi_connected, &sf_wifi_unconnected);
lv_obj_add_style(image_wifi_connected, 0, &image_wifi_connected_s0);
image_wifi_connected_scr_uiflowmovie = image_wifi_connected;

View File

@ -573,6 +573,11 @@ static void task_1sec_period_cb(lv_task_t* task)
{
update_icons();
// update_date_time();
UINT16 autoOffTime = sf_get_auto_off_time();
if (autoOffTime >= 160)
{
UIFlowWrnMsgAPI_Open_StringID(LV_PLUGIN_STRING_ID_STRING_ENTER_WORK, 1000 * 30);
}
}
static void task_motionDet_cb(lv_task_t* task)
@ -937,10 +942,10 @@ static void UIFlowMovie_OnKeyMode(lv_obj_t* obj)
}
static void UIFlowMovie_OnKeyEnter(lv_obj_t* obj)
{
// static void UIFlowMovie_OnKeyEnter(lv_obj_t* obj)
// {
}
// }
static void UIFlowMovie_OnKeyMenu(lv_obj_t* obj)
{
@ -1191,7 +1196,7 @@ static void UIFlowMovie_Key(lv_obj_t* obj, uint32_t key)
switch(key)
{
case LV_USER_KEY_SHUTTER2:
case LV_KEY_ENTER:
{
#if HUNTING_CAMERA_MCU == ENABLE
sf_rtsp_stop();
@ -1258,11 +1263,11 @@ static void UIFlowMovie_Key(lv_obj_t* obj, uint32_t key)
break;
}
case LV_KEY_ENTER:
{
UIFlowMovie_OnKeyEnter(obj);
break;
}
// case LV_KEY_ENTER:
// {
// UIFlowMovie_OnKeyEnter(obj);
// break;
// }
//#NT#2021/09/10#Philex Lin--end
case LV_KEY_DOWN:

View File

@ -1096,18 +1096,21 @@ lv_obj_t* UIFlowPhoto_create(){
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_2_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_2_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_text_color(&label_2_s0, LV_STATE_CHECKED, color);
lv_style_set_text_font(&label_2_s0,LV_STATE_CHECKED,&lv_font_montserrat_16);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_text_sel_color(&label_2_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x3a, 0x01, 0xa2, 0xb1) ; lv_style_set_text_sel_bg_color(&label_2_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_2_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_2_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_2_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0xd3, 0x31, 0x40, 0x4f) ; lv_style_set_text_color(&label_2_s0, LV_STATE_FOCUSED, color);
lv_style_set_text_font(&label_2_s0,LV_STATE_FOCUSED,&lv_font_montserrat_16);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_text_sel_color(&label_2_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x3a, 0x01, 0xa2, 0xb1) ; lv_style_set_text_sel_bg_color(&label_2_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_2_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_2_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_2_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0xd3, 0x31, 0x40, 0x4f) ; lv_style_set_text_color(&label_2_s0, LV_STATE_EDITED, color);
lv_style_set_text_font(&label_2_s0,LV_STATE_EDITED,&lv_font_montserrat_16);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_text_sel_color(&label_2_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x3a, 0x01, 0xa2, 0xb1) ; lv_style_set_text_sel_bg_color(&label_2_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_2_s0, LV_STATE_HOVERED, color);
@ -1221,7 +1224,7 @@ lv_obj_t* UIFlowPhoto_create(){
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_3_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0xd3, 0x31, 0x40, 0x4f) ; lv_style_set_text_color(&label_3_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_text_sel_color(&label_3_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x3a, 0x00, 0xb4, 0x95) ; lv_style_set_text_sel_bg_color(&label_3_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x3a, 0x01, 0xa2, 0xb1) ; lv_style_set_text_sel_bg_color(&label_3_s0, LV_STATE_DEFAULT, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_3_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_3_s0, LV_STATE_CHECKED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_3_s0, LV_STATE_CHECKED, color);
@ -1233,28 +1236,24 @@ lv_obj_t* UIFlowPhoto_create(){
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_3_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_3_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0xd3, 0x31, 0x40, 0x4f) ; lv_style_set_text_color(&label_3_s0, LV_STATE_FOCUSED, color);
lv_style_set_text_font(&label_3_s0,LV_STATE_FOCUSED,&lv_font_montserrat_16);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_text_sel_color(&label_3_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x3a, 0x01, 0xa2, 0xb1) ; lv_style_set_text_sel_bg_color(&label_3_s0, LV_STATE_FOCUSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_3_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_3_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_3_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0xd3, 0x31, 0x40, 0x4f) ; lv_style_set_text_color(&label_3_s0, LV_STATE_EDITED, color);
lv_style_set_text_font(&label_3_s0,LV_STATE_EDITED,&lv_font_montserrat_16);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_text_sel_color(&label_3_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x3a, 0x01, 0xa2, 0xb1) ; lv_style_set_text_sel_bg_color(&label_3_s0, LV_STATE_EDITED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_3_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_3_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_3_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0xd3, 0x31, 0x40, 0x4f) ; lv_style_set_text_color(&label_3_s0, LV_STATE_HOVERED, color);
lv_style_set_text_font(&label_3_s0,LV_STATE_HOVERED,&lv_font_montserrat_16);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_text_sel_color(&label_3_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x3a, 0x01, 0xa2, 0xb1) ; lv_style_set_text_sel_bg_color(&label_3_s0, LV_STATE_HOVERED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_3_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_grad_color(&label_3_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x01, 0x00, 0x00, 0x00) ; lv_style_set_border_color(&label_3_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0xd3, 0x31, 0x40, 0x4f) ; lv_style_set_text_color(&label_3_s0, LV_STATE_PRESSED, color);
lv_style_set_text_font(&label_3_s0,LV_STATE_PRESSED,&lv_font_montserrat_16);
STYLE_COLOR_PROP(0xd3, 0x3b, 0x3e, 0x42) ; lv_style_set_text_sel_color(&label_3_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x3a, 0x01, 0xa2, 0xb1) ; lv_style_set_text_sel_bg_color(&label_3_s0, LV_STATE_PRESSED, color);
STYLE_COLOR_PROP(0x02, 0xff, 0xff, 0xff) ; lv_style_set_bg_color(&label_3_s0, LV_STATE_DISABLED, color);
@ -1728,7 +1727,7 @@ lv_obj_t* UIFlowPhoto_create(){
lv_obj_set_drag(image_wifi_connected, false);
lv_obj_set_pos(image_wifi_connected, 40, 0);
lv_obj_set_size(image_wifi_connected, 48, 40);
lv_img_set_src(image_wifi_connected, &sf_wifi_connected);
lv_img_set_src(image_wifi_connected, &sf_wifi_unconnected);
lv_obj_add_style(image_wifi_connected, 0, &image_wifi_connected_s0);
image_wifi_connected_scr_uiflowphoto = image_wifi_connected;
@ -1923,8 +1922,8 @@ lv_obj_t* UIFlowPhoto_create(){
lv_obj_set_click(image_5, false);
lv_obj_set_drag(image_5, false);
lv_obj_set_pos(image_5, 50, 202);
lv_obj_set_size(image_5, 36, 28);
lv_img_set_src(image_5, &sy_bg_msg);
lv_obj_set_size(image_5, 32, 28);
lv_img_set_src(image_5, &sy_bg_32x28);
lv_obj_add_style(image_5, 0, &image_5_s0);
image_5_scr_uiflowphoto = image_5;
@ -1986,7 +1985,7 @@ lv_obj_t* UIFlowPhoto_create(){
lv_label_set_align(label_4, LV_LABEL_ALIGN_CENTER);
lv_label_set_long_mode(label_4, LV_LABEL_LONG_SROLL);
lv_obj_set_pos(label_4, 0, 6);
lv_obj_set_size(label_4, 37, 28);
lv_obj_set_size(label_4, 32, 28);
lv_obj_add_style(label_4, 0, &label_4_s0);
label_4_scr_uiflowphoto = label_4;
@ -2034,8 +2033,8 @@ lv_obj_t* UIFlowPhoto_create(){
lv_obj_set_click(image_6, false);
lv_obj_set_drag(image_6, false);
lv_obj_set_pos(image_6, 96, 202);
lv_obj_set_size(image_6, 36, 28);
lv_img_set_src(image_6, &sy_bg_msg);
lv_obj_set_size(image_6, 32, 28);
lv_img_set_src(image_6, &sy_bg_32x28);
lv_obj_add_style(image_6, 0, &image_6_s0);
image_6_scr_uiflowphoto = image_6;
@ -2097,7 +2096,7 @@ lv_obj_t* UIFlowPhoto_create(){
lv_label_set_align(label_5, LV_LABEL_ALIGN_CENTER);
lv_label_set_long_mode(label_5, LV_LABEL_LONG_SROLL);
lv_obj_set_pos(label_5, 0, 6);
lv_obj_set_size(label_5, 37, 28);
lv_obj_set_size(label_5, 32, 28);
lv_obj_add_style(label_5, 0, &label_5_s0);
label_5_scr_uiflowphoto = label_5;
@ -2145,8 +2144,8 @@ lv_obj_t* UIFlowPhoto_create(){
lv_obj_set_click(image_7, false);
lv_obj_set_drag(image_7, false);
lv_obj_set_pos(image_7, 142, 202);
lv_obj_set_size(image_7, 102, 28);
lv_img_set_src(image_7, &sy_bg_msg2);
lv_obj_set_size(image_7, 120, 28);
lv_img_set_src(image_7, &sy_bg_102x28);
lv_obj_add_style(image_7, 0, &image_7_s0);
image_7_scr_uiflowphoto = image_7;
@ -2208,7 +2207,7 @@ lv_obj_t* UIFlowPhoto_create(){
lv_label_set_align(label_6, LV_LABEL_ALIGN_CENTER);
lv_label_set_long_mode(label_6, LV_LABEL_LONG_SROLL);
lv_obj_set_pos(label_6, 0, 6);
lv_obj_set_size(label_6, 103, 28);
lv_obj_set_size(label_6, 120, 28);
lv_obj_add_style(label_6, 0, &label_6_s0);
label_6_scr_uiflowphoto = label_6;

View File

@ -356,7 +356,7 @@ static void update_4g_module_icon(void)
signal_icon_hidden(searching_index);
searching_index++;
searching_index = searching_index % 5;
printf(" searching ... [%d]\n", searching_index);
//printf(" searching ... [%d]\n", searching_index);
signal_icon_show(searching_index);
}
else if(signal != signal_new)
@ -1263,6 +1263,11 @@ static void task_update_icons_timer_cb(lv_task_t* task)
{
// printf(" task_update_icons_timer_cb\n ");
update_icons();
UINT16 autoOffTime = sf_get_auto_off_time();
if (autoOffTime >= 160)
{
UIFlowWrnMsgAPI_Open_StringID(LV_PLUGIN_STRING_ID_STRING_ENTER_WORK, 1000 * 30);
}
return;
}
@ -1423,7 +1428,7 @@ static void UIFlowPhoto_Key(lv_obj_t* obj, uint32_t key)
#endif
switch(key)
{
case LV_USER_KEY_SHUTTER2:
case LV_KEY_ENTER:
{
#if HUNTING_CAMERA_MCU == ENABLE
sf_rtsp_stop();
@ -1536,7 +1541,7 @@ void UIFlowPhotoEventCallback(lv_obj_t* obj, lv_event_t event)
break;
case LV_EVENT_CLICKED:
printf(" ============================== photo press right, rec LV_EVENT_CLICKED.\n");
break;
UIFlowPhoto_OnKeyMenu(obj);
break;

View File

@ -1880,7 +1880,7 @@ lv_obj_t* UIFlowPlay_create(){
lv_obj_set_hidden(slider_1, false);
lv_obj_set_click(slider_1, true);
lv_obj_set_drag(slider_1, false);
lv_obj_set_pos(slider_1, 40, 18);
lv_obj_set_pos(slider_1, 44, 18);
lv_obj_set_size(slider_1, 208, 4);
lv_slider_set_range(slider_1, 0, 100);
lv_slider_set_anim_time(slider_1,200);

View File

@ -1203,6 +1203,7 @@ static void play_video(lv_obj_t *obj)
printf("now sotp play the video.\n");
g_PlbData.State = PLB_ST_FULL;
lv_plugin_img_set_src(image_play_scr_uiflowplay, LV_PLUGIN_IMG_ID_SF_STOP);
lv_label_set_text_fmt(label_playtime_scr_uiflowplay, "%02d:%02d", 0, 0);
g_PlbData.VideoPBSpeed = PLB_FWD_MOV_1x;
// Close MoviePlay module.

View File

@ -32,7 +32,7 @@ typedef enum {
FLOWWRNMSG_ISSUE_MAX
} FLOWWRNMSG_ISSUE;
void UIFlowWrnMsgAPI_Open_StringID(lv_plugin_res_id id, uint16_t auto_close_time_ms);
void UIFlowWrnMsgAPI_Open_StringID(lv_plugin_res_id id, uint16_t auto_close_time_ms);
#endif /*UIFLOWWRNMSGAPI_H*/

View File

@ -9,6 +9,9 @@
static lv_group_t* gp = NULL;
static lv_obj_t* msgbox = NULL;
// static const char* btn_map[2] = {NULL, ""};
static lv_task_t* msgbox_timer = NULL;
static lv_plugin_res_id msgID = -1;
static uint16_t autoClose = 0;
static NVTEVT evt = NVTEVT_NULL;
@ -23,12 +26,34 @@ static void set_indev_keypad_group(lv_obj_t* obj)
lv_indev_set_group(indev, gp);
}
void UIFlowWrnMsgAPI_Open_StringID(lv_plugin_res_id id, uint16_t auto_close_time_ms)
static void task_msgbox_timer_cb(lv_task_t* task)
{
#define BUF_LENGTH 256
char buf[BUF_LENGTH] = {0};
printf(" task_msgbox_timer_cb\n ");
// LV_PLUGIN_STRING_ID_STRID_PLEASE_INSERT_SD
if(LV_PLUGIN_STRING_ID_STRING_ENTER_WORK == msgID)
{
const lv_plugin_string_t* string = lv_plugin_get_string(msgID);
if(string){
snprintf(buf, BUF_LENGTH, "%s (%ds)\r\n", string->ptr, autoClose/1000);
lv_msgbox_set_text(msgbox, buf);
}
autoClose = autoClose - 1000;
}
// update_icons();
return;
}
void UIFlowWrnMsgAPI_Open_StringID(lv_plugin_res_id id, uint16_t auto_close_time_ms)
{
if(msgbox){
DBG_WRN("warning message box is already opened and not closed yet, ignore request");
return;
}
msgID = id;
autoClose = auto_close_time_ms;
#if (DRAM_SIZE_64MB_DISP_OFF == ENABLE)
{
return;
@ -43,6 +68,7 @@ void UIFlowWrnMsgAPI_Open_StringID(lv_plugin_res_id id, uint16_t auto_close_tim
msgbox = lv_msgbox_create(UIFlowWrnMsg, message_box_1_scr_uiflowwrnmsg);
lv_obj_set_size(msgbox, 210, 134);
/* remember to set duplicate obj visible */
lv_obj_set_hidden(msgbox, false);
@ -83,6 +109,9 @@ void UIFlowWrnMsgAPI_Open_StringID(lv_plugin_res_id id, uint16_t auto_close_tim
}
set_indev_keypad_group(msgbox);
if(msgbox_timer == NULL){
msgbox_timer = lv_task_create(task_msgbox_timer_cb, 1000, LV_TASK_PRIO_MID, NULL);
}
lv_plugin_scr_open(UIFlowWrnMsg, NULL);
}
@ -132,6 +161,11 @@ void UIFlowWrnMsgEventCallback(lv_obj_t* obj, lv_event_t event)
void UIFlowWrnMsg_CloseScr(NVTEVT e)
{
if(msgbox_timer){
lv_task_del(msgbox_timer);
msgbox_timer = NULL;
// update_selftimer();
}
evt = e;
lv_msgbox_start_auto_close(msgbox, 0);
}

View File

@ -574,7 +574,7 @@ typedef struct _UIMenuUIMenuStoreInfo {
UINT8 WifiApPWD[16];
UINT8 Zoom;
UINT32 FileKey;
CHAR BluSsid[14];
UINT32 x1;
UINT32 x2;
UINT32 x3;

View File

@ -30,10 +30,10 @@ typedef struct {
static PHOTO_SIZE_PARAM g_PhotoCapSizeTable[PHOTO_SIZE_ID_MAX + 2] = {
#if PHOTO_PREVIEW_SLICE_ENC_FUNC || POWERON_FAST_SLICE_ENC
{7552, 4248, IMAGERATIO_4_3, "40M"}, /* 40M */
{7296, 5472, IMAGERATIO_4_3, "40M"}, /* 40M */
#endif
{6528, 4896, IMAGERATIO_4_3, "32M"}, /* 32M */
{5632, 4224, IMAGERATIO_4_3, "24M"}, //16M
{5664, 4248, IMAGERATIO_4_3, "24M"}, //16M
{4608, 3456, IMAGERATIO_4_3, "16M"}, //16M
{4032, 3024, IMAGERATIO_4_3, "12M"}, //12M
{3264, 2448, IMAGERATIO_4_3, "8M"}, // 8M

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -33,6 +33,9 @@ SIFAR_DIR = $(LIBRARY_DIR)/source/sifar/code
SIFAR_APP_DIR = $(APP_DIR)/source/sf_app/code/include
SIFAR_APP_LPA_DIR = $(APP_DIR)/source/sf_app/code/source/sf_lpa/LPA_SDK/include
LD_LIBRARY_PATH=$(LIBRARY_DIR)/output/
#LIB DIRs for C_LDFLAGS
EXTRA_LIB_DIR += \
-L$(LIBC_LIB_DIR) \
@ -54,6 +57,7 @@ EXTRA_LIB_DIR += \
-L$(NVT_VOS_DIR)/output \
-L$(NVT_DRIVER_DIR)/output \
-L$(APP_DIR)/sifarsdk/out/libs \
-L$(APP_DIR)/source/sf_app/tools/blue/lib \
# public includes
EXTRA_INCLUDE += \
@ -78,7 +82,14 @@ EXTRA_INCLUDE += \
-I$(SIFAR_APP_DIR) \
-I$(SIFAR_APP_LPA_DIR) \
-I$(APP_DIR)/sifarsdk/out/libs/include \
-I$(APP_DIR)/source/sf_app/code/source/sf_blue \
-I$(APP_DIR)/source/sf_app/code/source/sf_blue/src \
-I$(APP_DIR)/source/sf_app/code/source/sf_blue/inc/bluetooth \
-I$(APP_DIR)/source/sf_app/code/source/sf_blue/inc/dbus \
-I$(APP_DIR)/source/sf_app/code/source/sf_blue/inc/glib \
-I$(APP_DIR)/source/sf_app/tools/blue/include \
-I$(APP_DIR)/source/sf_app/tools/blue/include/dbus-1.0 \
# application local includes
EXTRA_INCLUDE += \
-I$(APP_DIR)/source/cardv/SrcCode \
@ -116,8 +127,17 @@ EXTRA_LIB = \
-lgcc_s \
-lrt \
-lm \
-l:libstdc++.a \
-lstdc++ \
-lpthread \
-lgettextlib -Wl,-rpath-link=$(LD_LIBRARY_PATH) \
-lgettextpo \
-lintl \
-lncurses \
-lbluetooth \
-ldbus-1 \
-lglib-2.0 \
# -rpath $(LIBRARY_DIR)/output \
# vos
EXTRA_LIB += \
@ -305,7 +325,17 @@ SRC = \
./code/source/debugMng/sf_debug.c \
./code/source/updataMng/sf_md5.c \
./code/source/updataMng/sf_otamng.c \
./code/source/battery/sf_battery.c
./code/source/battery/sf_battery.c \
./code/source/sf_blue/src/client.c \
./code/source/sf_blue/src/gatt_service.c \
./code/source/sf_blue/src/hciconfig.c \
./code/source/sf_blue/src/mainloop.c \
./code/source/sf_blue/src/object.c \
./code/source/sf_blue/src/polkit.c \
./code/source/sf_blue/src/sf_blue_app.c \
./code/source/sf_blue/src/sf_blue_hal.c \
./code/source/sf_blue/src/util.c \
./code/source/sf_blue/src/watch.c \
# ./code/source/wifi/sf_data_transfer.c \
# ./code/source/wifi/sf_svr_send.c \
@ -363,6 +393,7 @@ clean:
else
all: $(BIN)
$(BIN): $(OBJ)
$(CC) -o $@ $(OBJ) $(LD_FLAGS)
$(NM) -n $@ > $@.sym
@ -379,6 +410,24 @@ endif
install:
@echo ">>>>>>>>>>>>>>>>>>> $@ >>>>>>>>>>>>>>>>>>>"
@mkdir -p $(APP_DIR)/output
@mkdir -p $(ROOTFS_DIR)/rootfs/lib/firmware/rtlbt
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/dbus-1/system.d
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/etc/dbus-1
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/etc/dbus-1/session.d
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/etc/dbus-1/system.d
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/share/dbus-1/services
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/share/dbus-1/system-services
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/share/dbus-1/session.d
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/share/dbus-1/system.d
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/var/run/dbus
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/local/share/dbus-1/system-services
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/share/dbus-1/system-services
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/share/dbus-1/system.d
@mkdir -p $(ROOTFS_DIR)/rootfs/lib/dbus-1/system-services
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/etc/dbus-1/system-services
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/etc/dbus-1/system.d
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/etc/dbus-1/session.d
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/var/run/dbus
@cp -avf $(BIN) $(APP_DIR)/output
@cp -avf ${BIN} $(ROOTFS_DIR)/rootfs/usr/bin
# @cp -avf $(APP_DIR)/source/sf_app/build/QFirehose $(ROOTFS_DIR)/rootfs/usr/bin
@ -389,4 +438,26 @@ install:
@cp -avf $(APP_DIR)/sifarsdk/out/bin/quectel-CM-EG91 $(ROOTFS_DIR)/rootfs/usr/bin
@cp -avf $(APP_DIR)/sifarsdk/out/bin/QLog-EG915Q $(ROOTFS_DIR)/rootfs/usr/bin/QLog
@cp -avf $(APP_DIR)/sifarsdk/out/bin/DownloadCLI-EG915Q $(ROOTFS_DIR)/rootfs/usr/bin
@cp -avf $(APP_DIR)/sifarsdk/out/bin/QFirehose-EG91 $(ROOTFS_DIR)/rootfs/usr/bin
@cp -avf $(APP_DIR)/sifarsdk/out/bin/QFirehose-EG91 $(ROOTFS_DIR)/rootfs/usr/bin
@cp -avf $(APP_DIR)/source/sf_app/build/rtl8723d_config $(ROOTFS_DIR)/rootfs/lib/firmware/rtlbt
@cp -avf $(APP_DIR)/source/sf_app/build/rtl8723d_fw $(ROOTFS_DIR)/rootfs/lib/firmware/rtlbt
@cp -avf $(APP_DIR)/source/sf_app/build/rtk_hciattach $(ROOTFS_DIR)/rootfs/usr/bin
@cp -avf $(APP_DIR)/source/sf_app/tools/blue/bin/dbus-daemon $(ROOTFS_DIR)/rootfs/usr/bin
@cp -avf $(APP_DIR)/source/sf_app/tools/blue/bin/bluetoothctl $(ROOTFS_DIR)/rootfs/usr/bin
@cp -avf $(APP_DIR)/source/sf_app/tools/blue/libexec/bluetooth/bluetoothd $(ROOTFS_DIR)/rootfs/usr/bin
#@cp -avf /home/payton/blue/etc/dbus-1/session.conf $(ROOTFS_DIR)/rootfs/home/payton/blue/etc/dbus-1
#@cp -avf /home/payton/blue/etc/dbus-1/system.conf $(ROOTFS_DIR)/rootfs/home/payton/blue/etc/dbus-1
#@cp -avf /home/payton/blue/dbus-1/system.d/bluetooth.conf $(ROOTFS_DIR)/rootfs/home/payton/blue/dbus-1/system.d/bluetooth.conf
#@cp -avf /home/payton/blue/share/dbus-1/session.conf $(ROOTFS_DIR)/rootfs/home/payton/blue/share/dbus-1/session.conf
#@cp -avf /home/payton/blue/share/dbus-1/system.conf $(ROOTFS_DIR)/rootfs/home/payton/blue/share/dbus-1/system.conf
#@cp -avf /home/payton/blue/share/dbus-1/session.conf $(ROOTFS_DIR)/rootfs/usr/share/dbus-1/session.conf
#@cp -avf /home/payton/blue/share/dbus-1/system.conf $(ROOTFS_DIR)/rootfs/usr/share/dbus-1/system.conf
#@cp -avf /home/payton/blue/share/dbus-1 $(ROOTFS_DIR)/rootfs/usr/share
#@cp -avf /home/payton/blue/share/dbus-1 $(ROOTFS_DIR)/rootfs/home/payton/blue/share
#@cp -ravf /home/payton/blue/var/lib/dbus $(ROOTFS_DIR)/rootfs/home/payton/blue/var/lib
@cp -avf $(APP_DIR)/source/sf_app/tools/blue/var/lib/dbus $(ROOTFS_DIR)/rootfs/var/lib
@cp -avf $(APP_DIR)/source/sf_app/tools/blue/etc/dbus-1 $(ROOTFS_DIR)/rootfs/usr/etc
@cp -avf $(APP_DIR)/source/sf_app/tools/blue/share/dbus-1 $(ROOTFS_DIR)/rootfs/usr/etc
#@cp -avf /home/payton/blue/etc/dbus-1 $(ROOTFS_DIR)/rootfs/home/payton/blue
@cp -avf $(APP_DIR)/source/sf_app/tools/blue/dbus-1/system.d/bluetooth.conf $(ROOTFS_DIR)/rootfs/usr/etc/dbus-1/system.d/bluetooth.conf
@echo ">>>>>>>>>>>>>>>>>>> $@ >>>>>>>>>>>>>>>>>>>"

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -55,6 +55,8 @@ void sf_set_pir_statu_flag(SINT32 flag);
BOOL sf_load_ko(void);
BOOL sf_load_bt_ko(void);
SINT32 sf_in_update(void);
#ifdef __cplusplus

View File

@ -29,6 +29,7 @@ int sf_app_pir_statu_read(void);
UINT32 sf_app_data_ready_read(void);
void sf_set_wifi_en(UINT32 cnt);
void sf_set_bt_en(UINT32 cnt);
#ifdef __cplusplus
#if __cplusplus
}

View File

@ -163,7 +163,7 @@ extern "C" {
#define SIM_AUTO_MATCH_FILE_PATH SF_SD_ROOT"SIM Auto Match.TXT"
#define SF_DCF_DIR_NAME_SUFFIX DCF_FILE_NAME /**< DCF Directory Name (it must be 5-characters) */
#define SF_DCF_ROOT_DIR_NAME DCF_DIR_NAME /**< DCF Root Directory Name */
#define SF_DCF_ROOT_DIR_NAME "DCIM" /**< DCF Root Directory Name */
#define SF_DCF_THM_DIR_NAME "THUMB" /**< DCF Directory Name (it must be 5-characters) */
#define SF_DCF_EXT_PHOTO "JPG" /**< File extenstion name for Date DB */

View File

@ -27,7 +27,7 @@
extern "C" {
#endif
#endif
#define SF_DCF_FILENAME_LEN_MAX 64
#define SDLOOP_REMAIN_SPACE 300 /*300MB*/
#define FILETXTCNT 300
#define FILENAMELEN 128
@ -71,6 +71,8 @@ SINT32 sf_sd_status_set(SF_SD_STATUS_E enStatus);
UINT32 sf_delete_send_flie_list(void);
int sf_app_sd_loop(void);
#ifdef __cplusplus
#if __cplusplus
}

View File

@ -2417,7 +2417,11 @@ SINT32 sf_power_off_check_sd(void)
{
sf_sd_info_get(&storeattrs);
if((storeattrs.SDStatus == 0) & (storeattrs.SDFree < SDLOOP_REMAIN_SPACE))
sf_sd_loopremove(SF_DCIM_DIR);
{
// sf_sd_loopremove(SF_DCIM_DIR);
sf_app_sd_loop();
}
}
if(sf_in_card_exist())

View File

@ -103,7 +103,7 @@ int main(int argc, char *argv[])
{
printf("*********************************************\n");
printf("* *\n");
printf("* sf_app-v5-0912 *\n");
printf("* sf_app *\n");
printf("* *\n");
printf("*********************************************\n");
//gpio_direction_input(C_GPIO(10));
@ -155,9 +155,13 @@ int main(int argc, char *argv[])
if((!isUsb) && (SF_MCU_STARTUP_NORMAL != startup) && (SF_MCU_STARTUP_OFF != startup)/*&& (0 == isUpdate)*/)
{
#if SF_IQ_TEST != ENABLE
if((0 == isUpdate) && (puiPara->GprsSwitch))
if(SF_MCU_STARTUP_ONKEY == startup)
{
sf_set_wifi_en(1);
sf_set_bt_en(1);
}
if((0 == isUpdate) && (puiPara->GprsSwitch))
{
sf_4G_usb_init();
app_RegisterNet_start();
}

View File

@ -56,6 +56,8 @@ extern "C" {
#include <sf_commMng.h>
#include "sf_battery.h"
#include "sf_hal_ttyusb.h"
#include "sf_blue_app.h"
extern pthread_mutex_t Param_mutexLock;
SINT8 longClickhold = 0;
SINT8 bmoduleupdate = 0;
@ -761,6 +763,7 @@ static SINT32 sf_app_proccess_cmd_mcu(SF_MESSAGE_BUF_S *pMessageBuf)
stMessageBuf.arg3 = (SINT32)sf_get_mcu_ver();
stMessageBuf.cmdId = CMD_MCU;
sf_com_message_send_to_cardv(&stMessageBuf);
sf_blue_app_start();
break;
case SF_MCU_CMD_MODULE_SLEEP:
sf_set_module_sleep_flag(0);

View File

@ -1071,7 +1071,8 @@ SINT32 app_debug_process(SINT32 argc, SF_CHAR **argv[])
}
break;
case 5:
sf_sd_loopremove("/mnt/mmc/DCIM");
// sf_sd_loopremove("/mnt/mmc/DCIM");
sf_app_sd_loop();
MLOGI("/* Added by MaxLi 2022/12/14--15:20:19*/\n");
break;
case 6:

View File

@ -617,6 +617,18 @@ BOOL sf_load_ko(void)
return ret2;
}
BOOL sf_load_bt_ko(void)
{
BOOL ret2 = TRUE;
int ret = 0;
ret = system("modprobe hci_uart");
if(0 != ret)
{
ret2 = FALSE;
}
//MLOGI("finsihed.\n");
return ret2;
}
SINT32 sf_in_update(void)
{
SINT8 regValue = 0;

View File

@ -1327,6 +1327,7 @@ void* sf_app_load_ko_thread(void *arg)
sf_load_ko();
sf_load_bt_ko();
/*if((SF_MCU_STARTUP_NORMAL != sf_poweron_type_get()) && (0 == sf_get_fw_update()))
{
#if SF_IQ_TEST != ENABLE

View File

@ -965,7 +965,6 @@ void sf_battery_level_polling(void)
void* sf_battery_check_thread(void *arg)
{
//THREAD_ENTRY();
return NULL;
printf("[%s:%d] s\n", __FUNCTION__, __LINE__);
if(sf_is_battery_low(1, 0) == TRUE)

View File

@ -194,6 +194,17 @@ void sf_set_wifi_en(UINT32 cnt)
gpio_set_value(SF_WIFI_EN, cnt);
printf("[%s:%d] e cnt:%d\n", __FUNCTION__, __LINE__,cnt);
}
void sf_set_bt_en(UINT32 cnt)
{
static UINT8 state = 0;
if(0 == state)
{
state = 1;
gpio_direction_output(SF_BT_EN, 1);
}
gpio_set_value(SF_BT_EN, cnt);
printf("[%s:%d] e cnt:%d\n", __FUNCTION__, __LINE__,cnt);
}
#ifdef __cplusplus
#if __cplusplus

View File

@ -0,0 +1,481 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
*
*
*/
#ifndef __BLUETOOTH_H
#define __BLUETOOTH_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <endian.h>
#include <byteswap.h>
#include <netinet/in.h>
#ifndef AF_BLUETOOTH
#define AF_BLUETOOTH 31
#define PF_BLUETOOTH AF_BLUETOOTH
#endif
#define BTPROTO_L2CAP 0
#define BTPROTO_HCI 1
#define BTPROTO_SCO 2
#define BTPROTO_RFCOMM 3
#define BTPROTO_BNEP 4
#define BTPROTO_CMTP 5
#define BTPROTO_HIDP 6
#define BTPROTO_AVDTP 7
#define BTPROTO_ISO 8
#define SOL_HCI 0
#define SOL_L2CAP 6
#define SOL_SCO 17
#define SOL_RFCOMM 18
#ifndef SOL_BLUETOOTH
#define SOL_BLUETOOTH 274
#endif
#define BT_SECURITY 4
struct bt_security {
uint8_t level;
uint8_t key_size;
};
#define BT_SECURITY_SDP 0
#define BT_SECURITY_LOW 1
#define BT_SECURITY_MEDIUM 2
#define BT_SECURITY_HIGH 3
#define BT_SECURITY_FIPS 4
#define BT_DEFER_SETUP 7
#define BT_FLUSHABLE 8
#define BT_FLUSHABLE_OFF 0
#define BT_FLUSHABLE_ON 1
#define BT_POWER 9
struct bt_power {
uint8_t force_active;
};
#define BT_POWER_FORCE_ACTIVE_OFF 0
#define BT_POWER_FORCE_ACTIVE_ON 1
#define BT_CHANNEL_POLICY 10
/* BR/EDR only (default policy)
* AMP controllers cannot be used.
* Channel move requests from the remote device are denied.
* If the L2CAP channel is currently using AMP, move the channel to BR/EDR.
*/
#define BT_CHANNEL_POLICY_BREDR_ONLY 0
/* BR/EDR Preferred
* Allow use of AMP controllers.
* If the L2CAP channel is currently on AMP, move it to BR/EDR.
* Channel move requests from the remote device are allowed.
*/
#define BT_CHANNEL_POLICY_BREDR_PREFERRED 1
/* AMP Preferred
* Allow use of AMP controllers
* If the L2CAP channel is currently on BR/EDR and AMP controller
* resources are available, initiate a channel move to AMP.
* Channel move requests from the remote device are allowed.
* If the L2CAP socket has not been connected yet, try to create
* and configure the channel directly on an AMP controller rather
* than BR/EDR.
*/
#define BT_CHANNEL_POLICY_AMP_PREFERRED 2
#define BT_VOICE 11
struct bt_voice {
uint16_t setting;
};
#define BT_SNDMTU 12
#define BT_RCVMTU 13
#define BT_VOICE_TRANSPARENT 0x0003
#define BT_VOICE_CVSD_16BIT 0x0060
#define BT_PHY 14
#define BT_PHY_BR_1M_1SLOT 0x00000001
#define BT_PHY_BR_1M_3SLOT 0x00000002
#define BT_PHY_BR_1M_5SLOT 0x00000004
#define BT_PHY_EDR_2M_1SLOT 0x00000008
#define BT_PHY_EDR_2M_3SLOT 0x00000010
#define BT_PHY_EDR_2M_5SLOT 0x00000020
#define BT_PHY_EDR_3M_1SLOT 0x00000040
#define BT_PHY_EDR_3M_3SLOT 0x00000080
#define BT_PHY_EDR_3M_5SLOT 0x00000100
#define BT_PHY_LE_1M_TX 0x00000200
#define BT_PHY_LE_1M_RX 0x00000400
#define BT_PHY_LE_2M_TX 0x00000800
#define BT_PHY_LE_2M_RX 0x00001000
#define BT_PHY_LE_CODED_TX 0x00002000
#define BT_PHY_LE_CODED_RX 0x00004000
#define BT_MODE 15
#define BT_MODE_BASIC 0x00
#define BT_MODE_ERTM 0x01
#define BT_MODE_STREAMING 0x02
#define BT_MODE_LE_FLOWCTL 0x03
#define BT_MODE_EXT_FLOWCTL 0x04
#define BT_PKT_STATUS 16
#define BT_SCM_PKT_STATUS 0x03
#define BT_ISO_QOS 17
#define BT_ISO_QOS_CIG_UNSET 0xff
#define BT_ISO_QOS_CIS_UNSET 0xff
struct bt_iso_io_qos {
uint32_t interval;
uint16_t latency;
uint16_t sdu;
uint8_t phy;
uint8_t rtn;
};
struct bt_iso_qos {
union {
uint8_t cig;
uint8_t big;
};
union {
uint8_t cis;
uint8_t bis;
};
union {
uint8_t sca;
uint8_t sync_interval;
};
uint8_t packing;
uint8_t framing;
struct bt_iso_io_qos in;
struct bt_iso_io_qos out;
};
#define BT_CODEC 19
struct bt_codec {
uint8_t id;
uint16_t cid;
uint16_t vid;
uint8_t data_path_id;
uint8_t num_caps;
struct codec_caps {
uint8_t len;
uint8_t data[];
} caps[];
} __attribute__((packed));
struct bt_codecs {
uint8_t num_codecs;
struct bt_codec codecs[];
} __attribute__((packed));
/* Connection and socket states */
enum {
BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */
BT_OPEN,
BT_BOUND,
BT_LISTEN,
BT_CONNECT,
BT_CONNECT2,
BT_CONFIG,
BT_DISCONN,
BT_CLOSED
};
#define BT_ISO_BASE 20
/* Byte order conversions */
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define htobs(d) (d)
#define htobl(d) (d)
#define htobll(d) (d)
#define btohs(d) (d)
#define btohl(d) (d)
#define btohll(d) (d)
#elif __BYTE_ORDER == __BIG_ENDIAN
#define htobs(d) bswap_16(d)
#define htobl(d) bswap_32(d)
#define htobll(d) bswap_64(d)
#define btohs(d) bswap_16(d)
#define btohl(d) bswap_32(d)
#define btohll(d) bswap_64(d)
#else
#error "Unknown byte order"
#endif
/* Bluetooth unaligned access */
#define bt_get_unaligned(ptr) \
__extension__ ({ \
struct __attribute__((packed)) { \
__typeof__(*(ptr)) __v; \
} *__p = (__typeof__(__p)) (ptr); \
__p->__v; \
})
#define bt_put_unaligned(val, ptr) \
do { \
struct __attribute__((packed)) { \
__typeof__(*(ptr)) __v; \
} *__p = (__typeof__(__p)) (ptr); \
__p->__v = (val); \
} while(0)
#if __BYTE_ORDER == __LITTLE_ENDIAN
static inline uint64_t bt_get_le64(const void *ptr)
{
return bt_get_unaligned((const uint64_t *) ptr);
}
static inline uint64_t bt_get_be64(const void *ptr)
{
return bswap_64(bt_get_unaligned((const uint64_t *) ptr));
}
static inline uint32_t bt_get_le32(const void *ptr)
{
return bt_get_unaligned((const uint32_t *) ptr);
}
static inline uint32_t bt_get_be32(const void *ptr)
{
return bswap_32(bt_get_unaligned((const uint32_t *) ptr));
}
static inline uint16_t bt_get_le16(const void *ptr)
{
return bt_get_unaligned((const uint16_t *) ptr);
}
static inline uint16_t bt_get_be16(const void *ptr)
{
return bswap_16(bt_get_unaligned((const uint16_t *) ptr));
}
static inline void bt_put_le64(uint64_t val, const void *ptr)
{
bt_put_unaligned(val, (uint64_t *) ptr);
}
static inline void bt_put_be64(uint64_t val, const void *ptr)
{
bt_put_unaligned(bswap_64(val), (uint64_t *) ptr);
}
static inline void bt_put_le32(uint32_t val, const void *ptr)
{
bt_put_unaligned(val, (uint32_t *) ptr);
}
static inline void bt_put_be32(uint32_t val, const void *ptr)
{
bt_put_unaligned(bswap_32(val), (uint32_t *) ptr);
}
static inline void bt_put_le16(uint16_t val, const void *ptr)
{
bt_put_unaligned(val, (uint16_t *) ptr);
}
static inline void bt_put_be16(uint16_t val, const void *ptr)
{
bt_put_unaligned(bswap_16(val), (uint16_t *) ptr);
}
#elif __BYTE_ORDER == __BIG_ENDIAN
static inline uint64_t bt_get_le64(const void *ptr)
{
return bswap_64(bt_get_unaligned((const uint64_t *) ptr));
}
static inline uint64_t bt_get_be64(const void *ptr)
{
return bt_get_unaligned((const uint64_t *) ptr);
}
static inline uint32_t bt_get_le32(const void *ptr)
{
return bswap_32(bt_get_unaligned((const uint32_t *) ptr));
}
static inline uint32_t bt_get_be32(const void *ptr)
{
return bt_get_unaligned((const uint32_t *) ptr);
}
static inline uint16_t bt_get_le16(const void *ptr)
{
return bswap_16(bt_get_unaligned((const uint16_t *) ptr));
}
static inline uint16_t bt_get_be16(const void *ptr)
{
return bt_get_unaligned((const uint16_t *) ptr);
}
static inline void bt_put_le64(uint64_t val, const void *ptr)
{
bt_put_unaligned(bswap_64(val), (uint64_t *) ptr);
}
static inline void bt_put_be64(uint64_t val, const void *ptr)
{
bt_put_unaligned(val, (uint64_t *) ptr);
}
static inline void bt_put_le32(uint32_t val, const void *ptr)
{
bt_put_unaligned(bswap_32(val), (uint32_t *) ptr);
}
static inline void bt_put_be32(uint32_t val, const void *ptr)
{
bt_put_unaligned(val, (uint32_t *) ptr);
}
static inline void bt_put_le16(uint16_t val, const void *ptr)
{
bt_put_unaligned(bswap_16(val), (uint16_t *) ptr);
}
static inline void bt_put_be16(uint16_t val, const void *ptr)
{
bt_put_unaligned(val, (uint16_t *) ptr);
}
#else
#error "Unknown byte order"
#endif
/* BD Address */
typedef struct {
uint8_t b[6];
} __attribute__((packed)) bdaddr_t;
/* BD Address type */
#define BDADDR_BREDR 0x00
#define BDADDR_LE_PUBLIC 0x01
#define BDADDR_LE_RANDOM 0x02
#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
#define BDADDR_ALL (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}})
#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
/* Copy, swap, convert BD Address */
static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
{
return memcmp(ba1, ba2, sizeof(bdaddr_t));
}
static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src)
{
memcpy(dst, src, sizeof(bdaddr_t));
}
void baswap(bdaddr_t *dst, const bdaddr_t *src);
bdaddr_t *strtoba(const char *str);
char *batostr(const bdaddr_t *ba);
int ba2str(const bdaddr_t *ba, char *str);
int ba2strlc(const bdaddr_t *ba, char *str);
int str2ba(const char *str, bdaddr_t *ba);
int ba2oui(const bdaddr_t *ba, char *oui);
int bachk(const char *str);
int baprintf(const char *format, ...);
int bafprintf(FILE *stream, const char *format, ...);
int basprintf(char *str, const char *format, ...);
int basnprintf(char *str, size_t size, const char *format, ...);
void *bt_malloc(size_t size);
void *bt_malloc0(size_t size);
void bt_free(void *ptr);
int bt_error(uint16_t code);
const char *bt_compidtostr(int id);
typedef struct {
uint8_t data[3];
} uint24_t;
typedef struct {
uint8_t data[16];
} uint128_t;
static inline void bswap_128(const void *src, void *dst)
{
const uint8_t *s = (const uint8_t *) src;
uint8_t *d = (uint8_t *) dst;
int i;
for (i = 0; i < 16; i++)
d[15 - i] = s[i];
}
#if __BYTE_ORDER == __BIG_ENDIAN
#define ntoh64(x) (x)
static inline void ntoh128(const uint128_t *src, uint128_t *dst)
{
memcpy(dst, src, sizeof(uint128_t));
}
static inline void btoh128(const uint128_t *src, uint128_t *dst)
{
bswap_128(src, dst);
}
#else
static inline uint64_t ntoh64(uint64_t n)
{
uint64_t h;
uint64_t tmp = ntohl(n & 0x00000000ffffffff);
h = ntohl(n >> 32);
h |= tmp << 32;
return h;
}
static inline void ntoh128(const uint128_t *src, uint128_t *dst)
{
bswap_128(src, dst);
}
static inline void btoh128(const uint128_t *src, uint128_t *dst)
{
memcpy(dst, src, sizeof(uint128_t));
}
#endif
#define hton64(x) ntoh64(x)
#define hton128(x, y) ntoh128(x, y)
#define htob128(x, y) btoh128(x, y)
#ifdef __cplusplus
}
#endif
#endif /* __BLUETOOTH_H */

View File

@ -0,0 +1,149 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
*
*
*/
#ifndef __BNEP_H
#define __BNEP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <bluetooth/bluetooth.h>
#ifndef ETH_ALEN
#define ETH_ALEN 6 /* from <net/ethernet.h> */
#endif
/* BNEP UUIDs */
#define BNEP_BASE_UUID 0x0000000000001000800000805F9B34FB
#define BNEP_UUID16 0x02
#define BNEP_UUID32 0x04
#define BNEP_UUID128 0x16
#define BNEP_SVC_PANU 0x1115
#define BNEP_SVC_NAP 0x1116
#define BNEP_SVC_GN 0x1117
/* BNEP packet types */
#define BNEP_GENERAL 0x00
#define BNEP_CONTROL 0x01
#define BNEP_COMPRESSED 0x02
#define BNEP_COMPRESSED_SRC_ONLY 0x03
#define BNEP_COMPRESSED_DST_ONLY 0x04
/* BNEP control types */
#define BNEP_CMD_NOT_UNDERSTOOD 0x00
#define BNEP_SETUP_CONN_REQ 0x01
#define BNEP_SETUP_CONN_RSP 0x02
#define BNEP_FILTER_NET_TYPE_SET 0x03
#define BNEP_FILTER_NET_TYPE_RSP 0x04
#define BNEP_FILTER_MULT_ADDR_SET 0x05
#define BNEP_FILTER_MULT_ADDR_RSP 0x06
/* BNEP response messages */
#define BNEP_SUCCESS 0x00
#define BNEP_CONN_INVALID_DST 0x01
#define BNEP_CONN_INVALID_SRC 0x02
#define BNEP_CONN_INVALID_SVC 0x03
#define BNEP_CONN_NOT_ALLOWED 0x04
#define BNEP_FILTER_UNSUPPORTED_REQ 0x01
#define BNEP_FILTER_INVALID_RANGE 0x02
#define BNEP_FILTER_INVALID_MCADDR 0x02
#define BNEP_FILTER_LIMIT_REACHED 0x03
#define BNEP_FILTER_DENIED_SECURITY 0x04
/* L2CAP settings */
#define BNEP_MTU 1691
#define BNEP_FLUSH_TO 0xffff
#define BNEP_CONNECT_TO 15
#define BNEP_FILTER_TO 15
#ifndef BNEP_PSM
#define BNEP_PSM 0x0f
#endif
/* BNEP headers */
#define BNEP_TYPE_MASK 0x7f
#define BNEP_EXT_HEADER 0x80
struct bnep_setup_conn_req {
uint8_t type;
uint8_t ctrl;
uint8_t uuid_size;
uint8_t service[0];
} __attribute__((packed));
struct bnep_set_filter_req {
uint8_t type;
uint8_t ctrl;
uint16_t len;
uint8_t list[0];
} __attribute__((packed));
struct bnep_ctrl_cmd_not_understood_cmd {
uint8_t type;
uint8_t ctrl;
uint8_t unkn_ctrl;
} __attribute__((packed));
struct bnep_control_rsp {
uint8_t type;
uint8_t ctrl;
uint16_t resp;
} __attribute__((packed));
struct bnep_ext_hdr {
uint8_t type;
uint8_t len;
uint8_t data[0];
} __attribute__((packed));
/* BNEP ioctl defines */
#define BNEPCONNADD _IOW('B', 200, int)
#define BNEPCONNDEL _IOW('B', 201, int)
#define BNEPGETCONNLIST _IOR('B', 210, int)
#define BNEPGETCONNINFO _IOR('B', 211, int)
#define BNEPGETSUPPFEAT _IOR('B', 212, int)
#define BNEP_SETUP_RESPONSE 0
struct bnep_connadd_req {
int sock; /* Connected socket */
uint32_t flags;
uint16_t role;
char device[16]; /* Name of the Ethernet device */
};
struct bnep_conndel_req {
uint32_t flags;
uint8_t dst[ETH_ALEN];
};
struct bnep_conninfo {
uint32_t flags;
uint16_t role;
uint16_t state;
uint8_t dst[ETH_ALEN];
char device[16];
};
struct bnep_connlist_req {
uint32_t cnum;
struct bnep_conninfo *ci;
};
#ifdef __cplusplus
}
#endif
#endif /* __BNEP_H */

View File

@ -0,0 +1,56 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
*
*
*/
#ifndef __CMTP_H
#define __CMTP_H
#ifdef __cplusplus
extern "C" {
#endif
/* CMTP defaults */
#define CMTP_MINIMUM_MTU 152
#define CMTP_DEFAULT_MTU 672
/* CMTP ioctl defines */
#define CMTPCONNADD _IOW('C', 200, int)
#define CMTPCONNDEL _IOW('C', 201, int)
#define CMTPGETCONNLIST _IOR('C', 210, int)
#define CMTPGETCONNINFO _IOR('C', 211, int)
#define CMTP_LOOPBACK 0
struct cmtp_connadd_req {
int sock; /* Connected socket */
uint32_t flags;
};
struct cmtp_conndel_req {
bdaddr_t bdaddr;
uint32_t flags;
};
struct cmtp_conninfo {
bdaddr_t bdaddr;
uint32_t flags;
uint16_t state;
int num;
};
struct cmtp_connlist_req {
uint32_t cnum;
struct cmtp_conninfo *ci;
};
#ifdef __cplusplus
}
#endif
#endif /* __CMTP_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,229 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
*
*
*/
#ifndef __HCI_LIB_H
#define __HCI_LIB_H
#ifdef __cplusplus
extern "C" {
#endif
struct hci_request {
uint16_t ogf;
uint16_t ocf;
int event;
void *cparam;
int clen;
void *rparam;
int rlen;
};
struct hci_version {
uint16_t manufacturer;
uint8_t hci_ver;
uint16_t hci_rev;
uint8_t lmp_ver;
uint16_t lmp_subver;
};
int hci_open_dev(int dev_id);
int hci_close_dev(int dd);
int hci_send_cmd(int dd, uint16_t ogf, uint16_t ocf, uint8_t plen, void *param);
int hci_send_req(int dd, struct hci_request *req, int timeout);
int hci_create_connection(int dd, const bdaddr_t *bdaddr, uint16_t ptype, uint16_t clkoffset, uint8_t rswitch, uint16_t *handle, int to);
int hci_disconnect(int dd, uint16_t handle, uint8_t reason, int to);
int hci_inquiry(int dev_id, int len, int num_rsp, const uint8_t *lap, inquiry_info **ii, long flags);
int hci_devinfo(int dev_id, struct hci_dev_info *di);
int hci_devba(int dev_id, bdaddr_t *bdaddr);
int hci_devid(const char *str);
int hci_read_local_name(int dd, int len, char *name, int to);
int hci_write_local_name(int dd, const char *name, int to);
int hci_read_remote_name(int dd, const bdaddr_t *bdaddr, int len, char *name, int to);
int hci_read_remote_name_with_clock_offset(int dd, const bdaddr_t *bdaddr, uint8_t pscan_rep_mode, uint16_t clkoffset, int len, char *name, int to);
int hci_read_remote_name_cancel(int dd, const bdaddr_t *bdaddr, int to);
int hci_read_remote_version(int dd, uint16_t handle, struct hci_version *ver, int to);
int hci_read_remote_features(int dd, uint16_t handle, uint8_t *features, int to);
int hci_read_remote_ext_features(int dd, uint16_t handle, uint8_t page, uint8_t *max_page, uint8_t *features, int to);
int hci_read_clock_offset(int dd, uint16_t handle, uint16_t *clkoffset, int to);
int hci_read_local_version(int dd, struct hci_version *ver, int to);
int hci_read_local_commands(int dd, uint8_t *commands, int to);
int hci_read_local_features(int dd, uint8_t *features, int to);
int hci_read_local_ext_features(int dd, uint8_t page, uint8_t *max_page, uint8_t *features, int to);
int hci_read_bd_addr(int dd, bdaddr_t *bdaddr, int to);
int hci_read_class_of_dev(int dd, uint8_t *cls, int to);
int hci_write_class_of_dev(int dd, uint32_t cls, int to);
int hci_read_voice_setting(int dd, uint16_t *vs, int to);
int hci_write_voice_setting(int dd, uint16_t vs, int to);
int hci_read_current_iac_lap(int dd, uint8_t *num_iac, uint8_t *lap, int to);
int hci_write_current_iac_lap(int dd, uint8_t num_iac, uint8_t *lap, int to);
int hci_read_stored_link_key(int dd, bdaddr_t *bdaddr, uint8_t all, int to);
int hci_write_stored_link_key(int dd, bdaddr_t *bdaddr, uint8_t *key, int to);
int hci_delete_stored_link_key(int dd, bdaddr_t *bdaddr, uint8_t all, int to);
int hci_authenticate_link(int dd, uint16_t handle, int to);
int hci_encrypt_link(int dd, uint16_t handle, uint8_t encrypt, int to);
int hci_change_link_key(int dd, uint16_t handle, int to);
int hci_switch_role(int dd, bdaddr_t *bdaddr, uint8_t role, int to);
int hci_park_mode(int dd, uint16_t handle, uint16_t max_interval, uint16_t min_interval, int to);
int hci_exit_park_mode(int dd, uint16_t handle, int to);
int hci_read_inquiry_scan_type(int dd, uint8_t *type, int to);
int hci_write_inquiry_scan_type(int dd, uint8_t type, int to);
int hci_read_inquiry_mode(int dd, uint8_t *mode, int to);
int hci_write_inquiry_mode(int dd, uint8_t mode, int to);
int hci_read_afh_mode(int dd, uint8_t *mode, int to);
int hci_write_afh_mode(int dd, uint8_t mode, int to);
int hci_read_ext_inquiry_response(int dd, uint8_t *fec, uint8_t *data, int to);
int hci_write_ext_inquiry_response(int dd, uint8_t fec, uint8_t *data, int to);
int hci_read_simple_pairing_mode(int dd, uint8_t *mode, int to);
int hci_write_simple_pairing_mode(int dd, uint8_t mode, int to);
int hci_read_local_oob_data(int dd, uint8_t *hash, uint8_t *randomizer, int to);
int hci_read_inq_response_tx_power_level(int dd, int8_t *level, int to);
int hci_read_inquiry_transmit_power_level(int dd, int8_t *level, int to);
int hci_write_inquiry_transmit_power_level(int dd, int8_t level, int to);
int hci_read_transmit_power_level(int dd, uint16_t handle, uint8_t type, int8_t *level, int to);
int hci_read_link_policy(int dd, uint16_t handle, uint16_t *policy, int to);
int hci_write_link_policy(int dd, uint16_t handle, uint16_t policy, int to);
int hci_read_link_supervision_timeout(int dd, uint16_t handle, uint16_t *timeout, int to);
int hci_write_link_supervision_timeout(int dd, uint16_t handle, uint16_t timeout, int to);
int hci_set_afh_classification(int dd, uint8_t *map, int to);
int hci_read_link_quality(int dd, uint16_t handle, uint8_t *link_quality, int to);
int hci_read_rssi(int dd, uint16_t handle, int8_t *rssi, int to);
int hci_read_afh_map(int dd, uint16_t handle, uint8_t *mode, uint8_t *map, int to);
int hci_read_clock(int dd, uint16_t handle, uint8_t which, uint32_t *clock, uint16_t *accuracy, int to);
int hci_le_set_scan_enable(int dev_id, uint8_t enable, uint8_t filter_dup, int to);
int hci_le_set_scan_parameters(int dev_id, uint8_t type, uint16_t interval,
uint16_t window, uint8_t own_type,
uint8_t filter, int to);
int hci_le_set_advertise_enable(int dev_id, uint8_t enable, int to);
int hci_le_create_conn(int dd, uint16_t interval, uint16_t window,
uint8_t initiator_filter, uint8_t peer_bdaddr_type,
bdaddr_t peer_bdaddr, uint8_t own_bdaddr_type,
uint16_t min_interval, uint16_t max_interval,
uint16_t latency, uint16_t supervision_timeout,
uint16_t min_ce_length, uint16_t max_ce_length,
uint16_t *handle, int to);
int hci_le_conn_update(int dd, uint16_t handle, uint16_t min_interval,
uint16_t max_interval, uint16_t latency,
uint16_t supervision_timeout, int to);
int hci_le_add_white_list(int dd, const bdaddr_t *bdaddr, uint8_t type, int to);
int hci_le_rm_white_list(int dd, const bdaddr_t *bdaddr, uint8_t type, int to);
int hci_le_read_white_list_size(int dd, uint8_t *size, int to);
int hci_le_clear_white_list(int dd, int to);
int hci_le_add_resolving_list(int dd, const bdaddr_t *bdaddr, uint8_t type,
uint8_t *peer_irk, uint8_t *local_irk, int to);
int hci_le_rm_resolving_list(int dd, const bdaddr_t *bdaddr, uint8_t type, int to);
int hci_le_clear_resolving_list(int dd, int to);
int hci_le_read_resolving_list_size(int dd, uint8_t *size, int to);
int hci_le_set_address_resolution_enable(int dev_id, uint8_t enable, int to);
int hci_le_read_remote_features(int dd, uint16_t handle, uint8_t *features, int to);
int hci_for_each_dev(int flag, int(*func)(int dd, int dev_id, long arg), long arg);
int hci_get_route(bdaddr_t *bdaddr);
char *hci_bustostr(int bus);
char *hci_typetostr(int type);
char *hci_dtypetostr(int type);
char *hci_dflagstostr(uint32_t flags);
char *hci_ptypetostr(unsigned int ptype);
int hci_strtoptype(char *str, unsigned int *val);
char *hci_scoptypetostr(unsigned int ptype);
int hci_strtoscoptype(char *str, unsigned int *val);
char *hci_lptostr(unsigned int ptype);
int hci_strtolp(char *str, unsigned int *val);
char *hci_lmtostr(unsigned int ptype);
int hci_strtolm(char *str, unsigned int *val);
char *hci_cmdtostr(unsigned int cmd);
char *hci_commandstostr(uint8_t *commands, char *pref, int width);
char *hci_vertostr(unsigned int ver);
int hci_strtover(char *str, unsigned int *ver);
char *lmp_vertostr(unsigned int ver);
int lmp_strtover(char *str, unsigned int *ver);
char *pal_vertostr(unsigned int ver);
int pal_strtover(char *str, unsigned int *ver);
char *lmp_featurestostr(uint8_t *features, char *pref, int width);
static inline void hci_set_bit(int nr, void *addr)
{
*((uint32_t *) addr + (nr >> 5)) |= (1 << (nr & 31));
}
static inline void hci_clear_bit(int nr, void *addr)
{
*((uint32_t *) addr + (nr >> 5)) &= ~(1 << (nr & 31));
}
static inline int hci_test_bit(int nr, void *addr)
{
return *((uint32_t *) addr + (nr >> 5)) & (1 << (nr & 31));
}
/* HCI filter tools */
static inline void hci_filter_clear(struct hci_filter *f)
{
memset(f, 0, sizeof(*f));
}
static inline void hci_filter_set_ptype(int t, struct hci_filter *f)
{
hci_set_bit((t == HCI_VENDOR_PKT) ? 0 : (t & HCI_FLT_TYPE_BITS), &f->type_mask);
}
static inline void hci_filter_clear_ptype(int t, struct hci_filter *f)
{
hci_clear_bit((t == HCI_VENDOR_PKT) ? 0 : (t & HCI_FLT_TYPE_BITS), &f->type_mask);
}
static inline int hci_filter_test_ptype(int t, struct hci_filter *f)
{
return hci_test_bit((t == HCI_VENDOR_PKT) ? 0 : (t & HCI_FLT_TYPE_BITS), &f->type_mask);
}
static inline void hci_filter_all_ptypes(struct hci_filter *f)
{
memset((void *) &f->type_mask, 0xff, sizeof(f->type_mask));
}
static inline void hci_filter_set_event(int e, struct hci_filter *f)
{
hci_set_bit((e & HCI_FLT_EVENT_BITS), &f->event_mask);
}
static inline void hci_filter_clear_event(int e, struct hci_filter *f)
{
hci_clear_bit((e & HCI_FLT_EVENT_BITS), &f->event_mask);
}
static inline int hci_filter_test_event(int e, struct hci_filter *f)
{
return hci_test_bit((e & HCI_FLT_EVENT_BITS), &f->event_mask);
}
static inline void hci_filter_all_events(struct hci_filter *f)
{
memset((void *) f->event_mask, 0xff, sizeof(f->event_mask));
}
static inline void hci_filter_set_opcode(int opcode, struct hci_filter *f)
{
f->opcode = opcode;
}
static inline void hci_filter_clear_opcode(struct hci_filter *f)
{
f->opcode = 0;
}
static inline int hci_filter_test_opcode(int opcode, struct hci_filter *f)
{
return (f->opcode == opcode);
}
#ifdef __cplusplus
}
#endif
#endif /* __HCI_LIB_H */

View File

@ -0,0 +1,72 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2003-2010 Marcel Holtmann <marcel@holtmann.org>
*
*
*/
#ifndef __HIDP_H
#define __HIDP_H
#ifdef __cplusplus
extern "C" {
#endif
/* HIDP defaults */
#define HIDP_MINIMUM_MTU 48
#define HIDP_DEFAULT_MTU 48
/* HIDP ioctl defines */
#define HIDPCONNADD _IOW('H', 200, int)
#define HIDPCONNDEL _IOW('H', 201, int)
#define HIDPGETCONNLIST _IOR('H', 210, int)
#define HIDPGETCONNINFO _IOR('H', 211, int)
#define HIDP_VIRTUAL_CABLE_UNPLUG 0
#define HIDP_BOOT_PROTOCOL_MODE 1
#define HIDP_BLUETOOTH_VENDOR_ID 9
struct hidp_connadd_req {
int ctrl_sock; /* Connected control socket */
int intr_sock; /* Connected interrupt socket */
uint16_t parser; /* Parser version */
uint16_t rd_size; /* Report descriptor size */
uint8_t *rd_data; /* Report descriptor data */
uint8_t country;
uint8_t subclass;
uint16_t vendor;
uint16_t product;
uint16_t version;
uint32_t flags;
uint32_t idle_to;
char name[128]; /* Device name */
};
struct hidp_conndel_req {
bdaddr_t bdaddr;
uint32_t flags;
};
struct hidp_conninfo {
bdaddr_t bdaddr;
uint32_t flags;
uint16_t state;
uint16_t vendor;
uint16_t product;
uint16_t version;
char name[128];
};
struct hidp_connlist_req {
uint32_t cnum;
struct hidp_conninfo *ci;
};
#ifdef __cplusplus
}
#endif
#endif /* __HIDP_H */

View File

@ -0,0 +1,266 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2000-2001 Qualcomm Incorporated
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
* Copyright (c) 2012 Code Aurora Forum. All rights reserved.
*
*
*/
#ifndef __L2CAP_H
#define __L2CAP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/socket.h>
/* L2CAP defaults */
#define L2CAP_DEFAULT_MTU 672
#define L2CAP_DEFAULT_FLUSH_TO 0xFFFF
/* L2CAP socket address */
struct sockaddr_l2 {
sa_family_t l2_family;
unsigned short l2_psm;
bdaddr_t l2_bdaddr;
unsigned short l2_cid;
uint8_t l2_bdaddr_type;
};
/* L2CAP socket options */
#define L2CAP_OPTIONS 0x01
struct l2cap_options {
uint16_t omtu;
uint16_t imtu;
uint16_t flush_to;
uint8_t mode;
uint8_t fcs;
uint8_t max_tx;
uint16_t txwin_size;
};
#define L2CAP_CONNINFO 0x02
struct l2cap_conninfo {
uint16_t hci_handle;
uint8_t dev_class[3];
};
#define L2CAP_LM 0x03
#define L2CAP_LM_MASTER 0x0001
#define L2CAP_LM_AUTH 0x0002
#define L2CAP_LM_ENCRYPT 0x0004
#define L2CAP_LM_TRUSTED 0x0008
#define L2CAP_LM_RELIABLE 0x0010
#define L2CAP_LM_SECURE 0x0020
/* L2CAP command codes */
#define L2CAP_COMMAND_REJ 0x01
#define L2CAP_CONN_REQ 0x02
#define L2CAP_CONN_RSP 0x03
#define L2CAP_CONF_REQ 0x04
#define L2CAP_CONF_RSP 0x05
#define L2CAP_DISCONN_REQ 0x06
#define L2CAP_DISCONN_RSP 0x07
#define L2CAP_ECHO_REQ 0x08
#define L2CAP_ECHO_RSP 0x09
#define L2CAP_INFO_REQ 0x0a
#define L2CAP_INFO_RSP 0x0b
#define L2CAP_CREATE_REQ 0x0c
#define L2CAP_CREATE_RSP 0x0d
#define L2CAP_MOVE_REQ 0x0e
#define L2CAP_MOVE_RSP 0x0f
#define L2CAP_MOVE_CFM 0x10
#define L2CAP_MOVE_CFM_RSP 0x11
/* L2CAP extended feature mask */
#define L2CAP_FEAT_FLOWCTL 0x00000001
#define L2CAP_FEAT_RETRANS 0x00000002
#define L2CAP_FEAT_BIDIR_QOS 0x00000004
#define L2CAP_FEAT_ERTM 0x00000008
#define L2CAP_FEAT_STREAMING 0x00000010
#define L2CAP_FEAT_FCS 0x00000020
#define L2CAP_FEAT_EXT_FLOW 0x00000040
#define L2CAP_FEAT_FIXED_CHAN 0x00000080
#define L2CAP_FEAT_EXT_WINDOW 0x00000100
#define L2CAP_FEAT_UCD 0x00000200
/* L2CAP fixed channels */
#define L2CAP_FC_L2CAP 0x02
#define L2CAP_FC_CONNLESS 0x04
#define L2CAP_FC_A2MP 0x08
/* L2CAP structures */
typedef struct {
uint16_t len;
uint16_t cid;
} __attribute__ ((packed)) l2cap_hdr;
#define L2CAP_HDR_SIZE 4
typedef struct {
uint8_t code;
uint8_t ident;
uint16_t len;
} __attribute__ ((packed)) l2cap_cmd_hdr;
#define L2CAP_CMD_HDR_SIZE 4
typedef struct {
uint16_t reason;
} __attribute__ ((packed)) l2cap_cmd_rej;
#define L2CAP_CMD_REJ_SIZE 2
typedef struct {
uint16_t psm;
uint16_t scid;
} __attribute__ ((packed)) l2cap_conn_req;
#define L2CAP_CONN_REQ_SIZE 4
typedef struct {
uint16_t dcid;
uint16_t scid;
uint16_t result;
uint16_t status;
} __attribute__ ((packed)) l2cap_conn_rsp;
#define L2CAP_CONN_RSP_SIZE 8
/* connect result */
#define L2CAP_CR_SUCCESS 0x0000
#define L2CAP_CR_PEND 0x0001
#define L2CAP_CR_BAD_PSM 0x0002
#define L2CAP_CR_SEC_BLOCK 0x0003
#define L2CAP_CR_NO_MEM 0x0004
/* connect status */
#define L2CAP_CS_NO_INFO 0x0000
#define L2CAP_CS_AUTHEN_PEND 0x0001
#define L2CAP_CS_AUTHOR_PEND 0x0002
typedef struct {
uint16_t dcid;
uint16_t flags;
uint8_t data[0];
} __attribute__ ((packed)) l2cap_conf_req;
#define L2CAP_CONF_REQ_SIZE 4
typedef struct {
uint16_t scid;
uint16_t flags;
uint16_t result;
uint8_t data[0];
} __attribute__ ((packed)) l2cap_conf_rsp;
#define L2CAP_CONF_RSP_SIZE 6
#define L2CAP_CONF_SUCCESS 0x0000
#define L2CAP_CONF_UNACCEPT 0x0001
#define L2CAP_CONF_REJECT 0x0002
#define L2CAP_CONF_UNKNOWN 0x0003
#define L2CAP_CONF_PENDING 0x0004
#define L2CAP_CONF_EFS_REJECT 0x0005
typedef struct {
uint8_t type;
uint8_t len;
uint8_t val[0];
} __attribute__ ((packed)) l2cap_conf_opt;
#define L2CAP_CONF_OPT_SIZE 2
#define L2CAP_CONF_MTU 0x01
#define L2CAP_CONF_FLUSH_TO 0x02
#define L2CAP_CONF_QOS 0x03
#define L2CAP_CONF_RFC 0x04
#define L2CAP_CONF_FCS 0x05
#define L2CAP_CONF_EFS 0x06
#define L2CAP_CONF_EWS 0x07
#define L2CAP_CONF_MAX_SIZE 22
#define L2CAP_MODE_BASIC 0x00
#define L2CAP_MODE_RETRANS 0x01
#define L2CAP_MODE_FLOWCTL 0x02
#define L2CAP_MODE_ERTM 0x03
#define L2CAP_MODE_STREAMING 0x04
#define L2CAP_SERVTYPE_NOTRAFFIC 0x00
#define L2CAP_SERVTYPE_BESTEFFORT 0x01
#define L2CAP_SERVTYPE_GUARANTEED 0x02
typedef struct {
uint16_t dcid;
uint16_t scid;
} __attribute__ ((packed)) l2cap_disconn_req;
#define L2CAP_DISCONN_REQ_SIZE 4
typedef struct {
uint16_t dcid;
uint16_t scid;
} __attribute__ ((packed)) l2cap_disconn_rsp;
#define L2CAP_DISCONN_RSP_SIZE 4
typedef struct {
uint16_t type;
} __attribute__ ((packed)) l2cap_info_req;
#define L2CAP_INFO_REQ_SIZE 2
typedef struct {
uint16_t type;
uint16_t result;
uint8_t data[0];
} __attribute__ ((packed)) l2cap_info_rsp;
#define L2CAP_INFO_RSP_SIZE 4
/* info type */
#define L2CAP_IT_CL_MTU 0x0001
#define L2CAP_IT_FEAT_MASK 0x0002
/* info result */
#define L2CAP_IR_SUCCESS 0x0000
#define L2CAP_IR_NOTSUPP 0x0001
typedef struct {
uint16_t psm;
uint16_t scid;
uint8_t id;
} __attribute__ ((packed)) l2cap_create_req;
#define L2CAP_CREATE_REQ_SIZE 5
typedef struct {
uint16_t dcid;
uint16_t scid;
uint16_t result;
uint16_t status;
} __attribute__ ((packed)) l2cap_create_rsp;
#define L2CAP_CREATE_RSP_SIZE 8
typedef struct {
uint16_t icid;
uint8_t id;
} __attribute__ ((packed)) l2cap_move_req;
#define L2CAP_MOVE_REQ_SIZE 3
typedef struct {
uint16_t icid;
uint16_t result;
} __attribute__ ((packed)) l2cap_move_rsp;
#define L2CAP_MOVE_RSP_SIZE 4
typedef struct {
uint16_t icid;
uint16_t result;
} __attribute__ ((packed)) l2cap_move_cfm;
#define L2CAP_MOVE_CFM_SIZE 4
typedef struct {
uint16_t icid;
} __attribute__ ((packed)) l2cap_move_cfm_rsp;
#define L2CAP_MOVE_CFM_RSP_SIZE 2
#ifdef __cplusplus
}
#endif
#endif /* __L2CAP_H */

View File

@ -0,0 +1,86 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
*
*
*/
#ifndef __RFCOMM_H
#define __RFCOMM_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/socket.h>
/* RFCOMM defaults */
#define RFCOMM_DEFAULT_MTU 127
#define RFCOMM_PSM 3
/* RFCOMM socket address */
struct sockaddr_rc {
sa_family_t rc_family;
bdaddr_t rc_bdaddr;
uint8_t rc_channel;
};
/* RFCOMM socket options */
#define RFCOMM_CONNINFO 0x02
struct rfcomm_conninfo {
uint16_t hci_handle;
uint8_t dev_class[3];
};
#define RFCOMM_LM 0x03
#define RFCOMM_LM_MASTER 0x0001
#define RFCOMM_LM_AUTH 0x0002
#define RFCOMM_LM_ENCRYPT 0x0004
#define RFCOMM_LM_TRUSTED 0x0008
#define RFCOMM_LM_RELIABLE 0x0010
#define RFCOMM_LM_SECURE 0x0020
/* RFCOMM TTY support */
#define RFCOMM_MAX_DEV 256
#define RFCOMMCREATEDEV _IOW('R', 200, int)
#define RFCOMMRELEASEDEV _IOW('R', 201, int)
#define RFCOMMGETDEVLIST _IOR('R', 210, int)
#define RFCOMMGETDEVINFO _IOR('R', 211, int)
struct rfcomm_dev_req {
int16_t dev_id;
uint32_t flags;
bdaddr_t src;
bdaddr_t dst;
uint8_t channel;
};
#define RFCOMM_REUSE_DLC 0
#define RFCOMM_RELEASE_ONHUP 1
#define RFCOMM_HANGUP_NOW 2
#define RFCOMM_TTY_ATTACHED 3
struct rfcomm_dev_info {
int16_t id;
uint32_t flags;
uint16_t state;
bdaddr_t src;
bdaddr_t dst;
uint8_t channel;
};
struct rfcomm_dev_list_req {
uint16_t dev_num;
struct rfcomm_dev_info dev_info[0];
};
#ifdef __cplusplus
}
#endif
#endif /* __RFCOMM_H */

View File

@ -0,0 +1,49 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
*
*
*/
#ifndef __SCO_H
#define __SCO_H
#ifdef __cplusplus
extern "C" {
#endif
/* SCO defaults */
#define SCO_DEFAULT_MTU 500
#define SCO_DEFAULT_FLUSH_TO 0xFFFF
#define SCO_CONN_TIMEOUT (HZ * 40)
#define SCO_DISCONN_TIMEOUT (HZ * 2)
#define SCO_CONN_IDLE_TIMEOUT (HZ * 60)
/* SCO socket address */
struct sockaddr_sco {
sa_family_t sco_family;
bdaddr_t sco_bdaddr;
};
/* set/get sockopt defines */
#define SCO_OPTIONS 0x01
struct sco_options {
uint16_t mtu;
};
#define SCO_CONNINFO 0x02
struct sco_conninfo {
uint16_t hci_handle;
uint8_t dev_class[3];
};
#ifdef __cplusplus
}
#endif
#endif /* __SCO_H */

View File

@ -0,0 +1,529 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2001-2002 Nokia Corporation
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
* Copyright (C) 2002-2003 Stephen Crane <steve.crane@rococosoft.com>
*
*
*/
#ifndef __SDP_H
#define __SDP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <bluetooth/bluetooth.h>
#define SDP_UNIX_PATH "/var/run/sdp"
#define SDP_RESPONSE_TIMEOUT 20
#define SDP_REQ_BUFFER_SIZE 2048
#define SDP_RSP_BUFFER_SIZE 65535
#define SDP_PDU_CHUNK_SIZE 1024
/*
* All definitions are based on Bluetooth Assigned Numbers
* of the Bluetooth Specification
*/
#define SDP_PSM 0x0001
/*
* Protocol UUIDs
*/
#define SDP_UUID 0x0001
#define UDP_UUID 0x0002
#define RFCOMM_UUID 0x0003
#define TCP_UUID 0x0004
#define TCS_BIN_UUID 0x0005
#define TCS_AT_UUID 0x0006
#define ATT_UUID 0x0007
#define OBEX_UUID 0x0008
#define IP_UUID 0x0009
#define FTP_UUID 0x000a
#define HTTP_UUID 0x000c
#define WSP_UUID 0x000e
#define BNEP_UUID 0x000f
#define UPNP_UUID 0x0010
#define HIDP_UUID 0x0011
#define HCRP_CTRL_UUID 0x0012
#define HCRP_DATA_UUID 0x0014
#define HCRP_NOTE_UUID 0x0016
#define AVCTP_UUID 0x0017
#define AVDTP_UUID 0x0019
#define CMTP_UUID 0x001b
#define UDI_UUID 0x001d
#define MCAP_CTRL_UUID 0x001e
#define MCAP_DATA_UUID 0x001f
#define L2CAP_UUID 0x0100
/*
* Service class identifiers of standard services and service groups
*/
#define SDP_SERVER_SVCLASS_ID 0x1000
#define BROWSE_GRP_DESC_SVCLASS_ID 0x1001
#define PUBLIC_BROWSE_GROUP 0x1002
#define SERIAL_PORT_SVCLASS_ID 0x1101
#define LAN_ACCESS_SVCLASS_ID 0x1102
#define DIALUP_NET_SVCLASS_ID 0x1103
#define IRMC_SYNC_SVCLASS_ID 0x1104
#define OBEX_OBJPUSH_SVCLASS_ID 0x1105
#define OBEX_FILETRANS_SVCLASS_ID 0x1106
#define IRMC_SYNC_CMD_SVCLASS_ID 0x1107
#define HEADSET_SVCLASS_ID 0x1108
#define CORDLESS_TELEPHONY_SVCLASS_ID 0x1109
#define AUDIO_SOURCE_SVCLASS_ID 0x110a
#define AUDIO_SINK_SVCLASS_ID 0x110b
#define AV_REMOTE_TARGET_SVCLASS_ID 0x110c
#define ADVANCED_AUDIO_SVCLASS_ID 0x110d
#define AV_REMOTE_SVCLASS_ID 0x110e
#define AV_REMOTE_CONTROLLER_SVCLASS_ID 0x110f
#define INTERCOM_SVCLASS_ID 0x1110
#define FAX_SVCLASS_ID 0x1111
#define HEADSET_AGW_SVCLASS_ID 0x1112
#define WAP_SVCLASS_ID 0x1113
#define WAP_CLIENT_SVCLASS_ID 0x1114
#define PANU_SVCLASS_ID 0x1115
#define NAP_SVCLASS_ID 0x1116
#define GN_SVCLASS_ID 0x1117
#define DIRECT_PRINTING_SVCLASS_ID 0x1118
#define REFERENCE_PRINTING_SVCLASS_ID 0x1119
#define IMAGING_SVCLASS_ID 0x111a
#define IMAGING_RESPONDER_SVCLASS_ID 0x111b
#define IMAGING_ARCHIVE_SVCLASS_ID 0x111c
#define IMAGING_REFOBJS_SVCLASS_ID 0x111d
#define HANDSFREE_SVCLASS_ID 0x111e
#define HANDSFREE_AGW_SVCLASS_ID 0x111f
#define DIRECT_PRT_REFOBJS_SVCLASS_ID 0x1120
#define REFLECTED_UI_SVCLASS_ID 0x1121
#define BASIC_PRINTING_SVCLASS_ID 0x1122
#define PRINTING_STATUS_SVCLASS_ID 0x1123
#define HID_SVCLASS_ID 0x1124
#define HCR_SVCLASS_ID 0x1125
#define HCR_PRINT_SVCLASS_ID 0x1126
#define HCR_SCAN_SVCLASS_ID 0x1127
#define CIP_SVCLASS_ID 0x1128
#define VIDEO_CONF_GW_SVCLASS_ID 0x1129
#define UDI_MT_SVCLASS_ID 0x112a
#define UDI_TA_SVCLASS_ID 0x112b
#define AV_SVCLASS_ID 0x112c
#define SAP_SVCLASS_ID 0x112d
#define PBAP_PCE_SVCLASS_ID 0x112e
#define PBAP_PSE_SVCLASS_ID 0x112f
#define PBAP_SVCLASS_ID 0x1130
#define MAP_MSE_SVCLASS_ID 0x1132
#define MAP_MCE_SVCLASS_ID 0x1133
#define MAP_SVCLASS_ID 0x1134
#define GNSS_SVCLASS_ID 0x1135
#define GNSS_SERVER_SVCLASS_ID 0x1136
#define MPS_SC_SVCLASS_ID 0x113A
#define MPS_SVCLASS_ID 0x113B
#define PNP_INFO_SVCLASS_ID 0x1200
#define GENERIC_NETWORKING_SVCLASS_ID 0x1201
#define GENERIC_FILETRANS_SVCLASS_ID 0x1202
#define GENERIC_AUDIO_SVCLASS_ID 0x1203
#define GENERIC_TELEPHONY_SVCLASS_ID 0x1204
#define UPNP_SVCLASS_ID 0x1205
#define UPNP_IP_SVCLASS_ID 0x1206
#define UPNP_PAN_SVCLASS_ID 0x1300
#define UPNP_LAP_SVCLASS_ID 0x1301
#define UPNP_L2CAP_SVCLASS_ID 0x1302
#define VIDEO_SOURCE_SVCLASS_ID 0x1303
#define VIDEO_SINK_SVCLASS_ID 0x1304
#define VIDEO_DISTRIBUTION_SVCLASS_ID 0x1305
#define HDP_SVCLASS_ID 0x1400
#define HDP_SOURCE_SVCLASS_ID 0x1401
#define HDP_SINK_SVCLASS_ID 0x1402
#define GENERIC_ACCESS_SVCLASS_ID 0x1800
#define GENERIC_ATTRIB_SVCLASS_ID 0x1801
#define APPLE_AGENT_SVCLASS_ID 0x2112
/*
* Standard profile descriptor identifiers; note these
* may be identical to some of the service classes defined above
*/
#define SDP_SERVER_PROFILE_ID SDP_SERVER_SVCLASS_ID
#define BROWSE_GRP_DESC_PROFILE_ID BROWSE_GRP_DESC_SVCLASS_ID
#define SERIAL_PORT_PROFILE_ID SERIAL_PORT_SVCLASS_ID
#define LAN_ACCESS_PROFILE_ID LAN_ACCESS_SVCLASS_ID
#define DIALUP_NET_PROFILE_ID DIALUP_NET_SVCLASS_ID
#define IRMC_SYNC_PROFILE_ID IRMC_SYNC_SVCLASS_ID
#define OBEX_OBJPUSH_PROFILE_ID OBEX_OBJPUSH_SVCLASS_ID
#define OBEX_FILETRANS_PROFILE_ID OBEX_FILETRANS_SVCLASS_ID
#define IRMC_SYNC_CMD_PROFILE_ID IRMC_SYNC_CMD_SVCLASS_ID
#define HEADSET_PROFILE_ID HEADSET_SVCLASS_ID
#define CORDLESS_TELEPHONY_PROFILE_ID CORDLESS_TELEPHONY_SVCLASS_ID
#define AUDIO_SOURCE_PROFILE_ID AUDIO_SOURCE_SVCLASS_ID
#define AUDIO_SINK_PROFILE_ID AUDIO_SINK_SVCLASS_ID
#define AV_REMOTE_TARGET_PROFILE_ID AV_REMOTE_TARGET_SVCLASS_ID
#define ADVANCED_AUDIO_PROFILE_ID ADVANCED_AUDIO_SVCLASS_ID
#define AV_REMOTE_PROFILE_ID AV_REMOTE_SVCLASS_ID
#define INTERCOM_PROFILE_ID INTERCOM_SVCLASS_ID
#define FAX_PROFILE_ID FAX_SVCLASS_ID
#define HEADSET_AGW_PROFILE_ID HEADSET_AGW_SVCLASS_ID
#define WAP_PROFILE_ID WAP_SVCLASS_ID
#define WAP_CLIENT_PROFILE_ID WAP_CLIENT_SVCLASS_ID
#define PANU_PROFILE_ID PANU_SVCLASS_ID
#define NAP_PROFILE_ID NAP_SVCLASS_ID
#define GN_PROFILE_ID GN_SVCLASS_ID
#define DIRECT_PRINTING_PROFILE_ID DIRECT_PRINTING_SVCLASS_ID
#define REFERENCE_PRINTING_PROFILE_ID REFERENCE_PRINTING_SVCLASS_ID
#define IMAGING_PROFILE_ID IMAGING_SVCLASS_ID
#define IMAGING_RESPONDER_PROFILE_ID IMAGING_RESPONDER_SVCLASS_ID
#define IMAGING_ARCHIVE_PROFILE_ID IMAGING_ARCHIVE_SVCLASS_ID
#define IMAGING_REFOBJS_PROFILE_ID IMAGING_REFOBJS_SVCLASS_ID
#define HANDSFREE_PROFILE_ID HANDSFREE_SVCLASS_ID
#define HANDSFREE_AGW_PROFILE_ID HANDSFREE_AGW_SVCLASS_ID
#define DIRECT_PRT_REFOBJS_PROFILE_ID DIRECT_PRT_REFOBJS_SVCLASS_ID
#define REFLECTED_UI_PROFILE_ID REFLECTED_UI_SVCLASS_ID
#define BASIC_PRINTING_PROFILE_ID BASIC_PRINTING_SVCLASS_ID
#define PRINTING_STATUS_PROFILE_ID PRINTING_STATUS_SVCLASS_ID
#define HID_PROFILE_ID HID_SVCLASS_ID
#define HCR_PROFILE_ID HCR_SCAN_SVCLASS_ID
#define HCR_PRINT_PROFILE_ID HCR_PRINT_SVCLASS_ID
#define HCR_SCAN_PROFILE_ID HCR_SCAN_SVCLASS_ID
#define CIP_PROFILE_ID CIP_SVCLASS_ID
#define VIDEO_CONF_GW_PROFILE_ID VIDEO_CONF_GW_SVCLASS_ID
#define UDI_MT_PROFILE_ID UDI_MT_SVCLASS_ID
#define UDI_TA_PROFILE_ID UDI_TA_SVCLASS_ID
#define AV_PROFILE_ID AV_SVCLASS_ID
#define SAP_PROFILE_ID SAP_SVCLASS_ID
#define PBAP_PCE_PROFILE_ID PBAP_PCE_SVCLASS_ID
#define PBAP_PSE_PROFILE_ID PBAP_PSE_SVCLASS_ID
#define PBAP_PROFILE_ID PBAP_SVCLASS_ID
#define MAP_PROFILE_ID MAP_SVCLASS_ID
#define PNP_INFO_PROFILE_ID PNP_INFO_SVCLASS_ID
#define GENERIC_NETWORKING_PROFILE_ID GENERIC_NETWORKING_SVCLASS_ID
#define GENERIC_FILETRANS_PROFILE_ID GENERIC_FILETRANS_SVCLASS_ID
#define GENERIC_AUDIO_PROFILE_ID GENERIC_AUDIO_SVCLASS_ID
#define GENERIC_TELEPHONY_PROFILE_ID GENERIC_TELEPHONY_SVCLASS_ID
#define UPNP_PROFILE_ID UPNP_SVCLASS_ID
#define UPNP_IP_PROFILE_ID UPNP_IP_SVCLASS_ID
#define UPNP_PAN_PROFILE_ID UPNP_PAN_SVCLASS_ID
#define UPNP_LAP_PROFILE_ID UPNP_LAP_SVCLASS_ID
#define UPNP_L2CAP_PROFILE_ID UPNP_L2CAP_SVCLASS_ID
#define VIDEO_SOURCE_PROFILE_ID VIDEO_SOURCE_SVCLASS_ID
#define VIDEO_SINK_PROFILE_ID VIDEO_SINK_SVCLASS_ID
#define VIDEO_DISTRIBUTION_PROFILE_ID VIDEO_DISTRIBUTION_SVCLASS_ID
#define HDP_PROFILE_ID HDP_SVCLASS_ID
#define HDP_SOURCE_PROFILE_ID HDP_SOURCE_SVCLASS_ID
#define HDP_SINK_PROFILE_ID HDP_SINK_SVCLASS_ID
#define GENERIC_ACCESS_PROFILE_ID GENERIC_ACCESS_SVCLASS_ID
#define GENERIC_ATTRIB_PROFILE_ID GENERIC_ATTRIB_SVCLASS_ID
#define APPLE_AGENT_PROFILE_ID APPLE_AGENT_SVCLASS_ID
#define MPS_PROFILE_ID MPS_SC_SVCLASS_ID
/*
* Compatibility macros for the old MDP acronym
*/
#define MDP_SVCLASS_ID HDP_SVCLASS_ID
#define MDP_SOURCE_SVCLASS_ID HDP_SOURCE_SVCLASS_ID
#define MDP_SINK_SVCLASS_ID HDP_SINK_SVCLASS_ID
#define MDP_PROFILE_ID HDP_PROFILE_ID
#define MDP_SOURCE_PROFILE_ID HDP_SOURCE_PROFILE_ID
#define MDP_SINK_PROFILE_ID HDP_SINK_PROFILE_ID
/*
* Attribute identifier codes
*/
#define SDP_SERVER_RECORD_HANDLE 0x0000
/*
* Possible values for attribute-id are listed below.
* See SDP Spec, section "Service Attribute Definitions" for more details.
*/
#define SDP_ATTR_RECORD_HANDLE 0x0000
#define SDP_ATTR_SVCLASS_ID_LIST 0x0001
#define SDP_ATTR_RECORD_STATE 0x0002
#define SDP_ATTR_SERVICE_ID 0x0003
#define SDP_ATTR_PROTO_DESC_LIST 0x0004
#define SDP_ATTR_BROWSE_GRP_LIST 0x0005
#define SDP_ATTR_LANG_BASE_ATTR_ID_LIST 0x0006
#define SDP_ATTR_SVCINFO_TTL 0x0007
#define SDP_ATTR_SERVICE_AVAILABILITY 0x0008
#define SDP_ATTR_PFILE_DESC_LIST 0x0009
#define SDP_ATTR_DOC_URL 0x000a
#define SDP_ATTR_CLNT_EXEC_URL 0x000b
#define SDP_ATTR_ICON_URL 0x000c
#define SDP_ATTR_ADD_PROTO_DESC_LIST 0x000d
#define SDP_ATTR_GROUP_ID 0x0200
#define SDP_ATTR_IP_SUBNET 0x0200
#define SDP_ATTR_VERSION_NUM_LIST 0x0200
#define SDP_ATTR_SUPPORTED_FEATURES_LIST 0x0200
#define SDP_ATTR_GOEP_L2CAP_PSM 0x0200
#define SDP_ATTR_SVCDB_STATE 0x0201
#define SDP_ATTR_MPSD_SCENARIOS 0x0200
#define SDP_ATTR_MPMD_SCENARIOS 0x0201
#define SDP_ATTR_MPS_DEPENDENCIES 0x0202
#define SDP_ATTR_SERVICE_VERSION 0x0300
#define SDP_ATTR_EXTERNAL_NETWORK 0x0301
#define SDP_ATTR_SUPPORTED_DATA_STORES_LIST 0x0301
#define SDP_ATTR_DATA_EXCHANGE_SPEC 0x0301
#define SDP_ATTR_NETWORK 0x0301
#define SDP_ATTR_FAX_CLASS1_SUPPORT 0x0302
#define SDP_ATTR_REMOTE_AUDIO_VOLUME_CONTROL 0x0302
#define SDP_ATTR_MCAP_SUPPORTED_PROCEDURES 0x0302
#define SDP_ATTR_FAX_CLASS20_SUPPORT 0x0303
#define SDP_ATTR_SUPPORTED_FORMATS_LIST 0x0303
#define SDP_ATTR_FAX_CLASS2_SUPPORT 0x0304
#define SDP_ATTR_AUDIO_FEEDBACK_SUPPORT 0x0305
#define SDP_ATTR_NETWORK_ADDRESS 0x0306
#define SDP_ATTR_WAP_GATEWAY 0x0307
#define SDP_ATTR_HOMEPAGE_URL 0x0308
#define SDP_ATTR_WAP_STACK_TYPE 0x0309
#define SDP_ATTR_SECURITY_DESC 0x030a
#define SDP_ATTR_NET_ACCESS_TYPE 0x030b
#define SDP_ATTR_MAX_NET_ACCESSRATE 0x030c
#define SDP_ATTR_IP4_SUBNET 0x030d
#define SDP_ATTR_IP6_SUBNET 0x030e
#define SDP_ATTR_SUPPORTED_CAPABILITIES 0x0310
#define SDP_ATTR_SUPPORTED_FEATURES 0x0311
#define SDP_ATTR_SUPPORTED_FUNCTIONS 0x0312
#define SDP_ATTR_TOTAL_IMAGING_DATA_CAPACITY 0x0313
#define SDP_ATTR_SUPPORTED_REPOSITORIES 0x0314
#define SDP_ATTR_MAS_INSTANCE_ID 0x0315
#define SDP_ATTR_SUPPORTED_MESSAGE_TYPES 0x0316
#define SDP_ATTR_PBAP_SUPPORTED_FEATURES 0x0317
#define SDP_ATTR_MAP_SUPPORTED_FEATURES 0x0317
#define SDP_ATTR_SPECIFICATION_ID 0x0200
#define SDP_ATTR_VENDOR_ID 0x0201
#define SDP_ATTR_PRODUCT_ID 0x0202
#define SDP_ATTR_VERSION 0x0203
#define SDP_ATTR_PRIMARY_RECORD 0x0204
#define SDP_ATTR_VENDOR_ID_SOURCE 0x0205
#define SDP_ATTR_HID_DEVICE_RELEASE_NUMBER 0x0200
#define SDP_ATTR_HID_PARSER_VERSION 0x0201
#define SDP_ATTR_HID_DEVICE_SUBCLASS 0x0202
#define SDP_ATTR_HID_COUNTRY_CODE 0x0203
#define SDP_ATTR_HID_VIRTUAL_CABLE 0x0204
#define SDP_ATTR_HID_RECONNECT_INITIATE 0x0205
#define SDP_ATTR_HID_DESCRIPTOR_LIST 0x0206
#define SDP_ATTR_HID_LANG_ID_BASE_LIST 0x0207
#define SDP_ATTR_HID_SDP_DISABLE 0x0208
#define SDP_ATTR_HID_BATTERY_POWER 0x0209
#define SDP_ATTR_HID_REMOTE_WAKEUP 0x020a
#define SDP_ATTR_HID_PROFILE_VERSION 0x020b
#define SDP_ATTR_HID_SUPERVISION_TIMEOUT 0x020c
#define SDP_ATTR_HID_NORMALLY_CONNECTABLE 0x020d
#define SDP_ATTR_HID_BOOT_DEVICE 0x020e
/*
* These identifiers are based on the SDP spec stating that
* "base attribute id of the primary (universal) language must be 0x0100"
*
* Other languages should have their own offset; e.g.:
* #define XXXLangBase yyyy
* #define AttrServiceName_XXX 0x0000+XXXLangBase
*/
#define SDP_PRIMARY_LANG_BASE 0x0100
#define SDP_ATTR_SVCNAME_PRIMARY 0x0000 + SDP_PRIMARY_LANG_BASE
#define SDP_ATTR_SVCDESC_PRIMARY 0x0001 + SDP_PRIMARY_LANG_BASE
#define SDP_ATTR_PROVNAME_PRIMARY 0x0002 + SDP_PRIMARY_LANG_BASE
/*
* The Data representation in SDP PDUs (pps 339, 340 of BT SDP Spec)
* These are the exact data type+size descriptor values
* that go into the PDU buffer.
*
* The datatype (leading 5bits) + size descriptor (last 3 bits)
* is 8 bits. The size descriptor is critical to extract the
* right number of bytes for the data value from the PDU.
*
* For most basic types, the datatype+size descriptor is
* straightforward. However for constructed types and strings,
* the size of the data is in the next "n" bytes following the
* 8 bits (datatype+size) descriptor. Exactly what the "n" is
* specified in the 3 bits of the data size descriptor.
*
* TextString and URLString can be of size 2^{8, 16, 32} bytes
* DataSequence and DataSequenceAlternates can be of size 2^{8, 16, 32}
* The size are computed post-facto in the API and are not known apriori
*/
#define SDP_DATA_NIL 0x00
#define SDP_UINT8 0x08
#define SDP_UINT16 0x09
#define SDP_UINT32 0x0A
#define SDP_UINT64 0x0B
#define SDP_UINT128 0x0C
#define SDP_INT8 0x10
#define SDP_INT16 0x11
#define SDP_INT32 0x12
#define SDP_INT64 0x13
#define SDP_INT128 0x14
#define SDP_UUID_UNSPEC 0x18
#define SDP_UUID16 0x19
#define SDP_UUID32 0x1A
#define SDP_UUID128 0x1C
#define SDP_TEXT_STR_UNSPEC 0x20
#define SDP_TEXT_STR8 0x25
#define SDP_TEXT_STR16 0x26
#define SDP_TEXT_STR32 0x27
#define SDP_BOOL 0x28
#define SDP_SEQ_UNSPEC 0x30
#define SDP_SEQ8 0x35
#define SDP_SEQ16 0x36
#define SDP_SEQ32 0x37
#define SDP_ALT_UNSPEC 0x38
#define SDP_ALT8 0x3D
#define SDP_ALT16 0x3E
#define SDP_ALT32 0x3F
#define SDP_URL_STR_UNSPEC 0x40
#define SDP_URL_STR8 0x45
#define SDP_URL_STR16 0x46
#define SDP_URL_STR32 0x47
/*
* The PDU identifiers of SDP packets between client and server
*/
#define SDP_ERROR_RSP 0x01
#define SDP_SVC_SEARCH_REQ 0x02
#define SDP_SVC_SEARCH_RSP 0x03
#define SDP_SVC_ATTR_REQ 0x04
#define SDP_SVC_ATTR_RSP 0x05
#define SDP_SVC_SEARCH_ATTR_REQ 0x06
#define SDP_SVC_SEARCH_ATTR_RSP 0x07
/*
* Some additions to support service registration.
* These are outside the scope of the Bluetooth specification
*/
#define SDP_SVC_REGISTER_REQ 0x75
#define SDP_SVC_REGISTER_RSP 0x76
#define SDP_SVC_UPDATE_REQ 0x77
#define SDP_SVC_UPDATE_RSP 0x78
#define SDP_SVC_REMOVE_REQ 0x79
#define SDP_SVC_REMOVE_RSP 0x80
/*
* SDP Error codes
*/
#define SDP_INVALID_VERSION 0x0001
#define SDP_INVALID_RECORD_HANDLE 0x0002
#define SDP_INVALID_SYNTAX 0x0003
#define SDP_INVALID_PDU_SIZE 0x0004
#define SDP_INVALID_CSTATE 0x0005
/*
* SDP PDU
*/
typedef struct {
uint8_t pdu_id;
uint16_t tid;
uint16_t plen;
} __attribute__ ((packed)) sdp_pdu_hdr_t;
/*
* Common definitions for attributes in the SDP.
* Should the type of any of these change, you need only make a change here.
*/
typedef struct {
uint8_t type;
union {
uint16_t uuid16;
uint32_t uuid32;
uint128_t uuid128;
} value;
} uuid_t;
#define SDP_IS_UUID(x) ((x) == SDP_UUID16 || (x) == SDP_UUID32 || \
(x) == SDP_UUID128)
#define SDP_IS_ALT(x) ((x) == SDP_ALT8 || (x) == SDP_ALT16 || (x) == SDP_ALT32)
#define SDP_IS_SEQ(x) ((x) == SDP_SEQ8 || (x) == SDP_SEQ16 || (x) == SDP_SEQ32)
#define SDP_IS_TEXT_STR(x) ((x) == SDP_TEXT_STR8 || (x) == SDP_TEXT_STR16 || \
(x) == SDP_TEXT_STR32)
typedef struct _sdp_list sdp_list_t;
struct _sdp_list {
sdp_list_t *next;
void *data;
};
/*
* User-visible strings can be in many languages
* in addition to the universal language.
*
* Language meta-data includes language code in ISO639
* followed by the encoding format. The third field in this
* structure is the attribute offset for the language.
* User-visible strings in the specified language can be
* obtained at this offset.
*/
typedef struct {
uint16_t code_ISO639;
uint16_t encoding;
uint16_t base_offset;
} sdp_lang_attr_t;
/*
* Profile descriptor is the Bluetooth profile metadata. If a
* service conforms to a well-known profile, then its profile
* identifier (UUID) is an attribute of the service. In addition,
* if the profile has a version number it is specified here.
*/
typedef struct {
uuid_t uuid;
uint16_t version;
} sdp_profile_desc_t;
typedef struct {
uint8_t major;
uint8_t minor;
} sdp_version_t;
typedef struct {
uint8_t *data;
uint32_t data_size;
uint32_t buf_size;
} sdp_buf_t;
typedef struct {
uint32_t handle;
/* Search pattern: a sequence of all UUIDs seen in this record */
sdp_list_t *pattern;
sdp_list_t *attrlist;
/* Main service class for Extended Inquiry Response */
uuid_t svclass;
} sdp_record_t;
typedef struct sdp_data_struct sdp_data_t;
struct sdp_data_struct {
uint8_t dtd;
uint16_t attrId;
union {
int8_t int8;
int16_t int16;
int32_t int32;
int64_t int64;
uint128_t int128;
uint8_t uint8;
uint16_t uint16;
uint32_t uint32;
uint64_t uint64;
uint128_t uint128;
uuid_t uuid;
char *str;
sdp_data_t *dataseq;
} val;
sdp_data_t *next;
int unitSize;
};
#ifdef __cplusplus
}
#endif
#endif /* __SDP_H */

View File

@ -0,0 +1,621 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2001-2002 Nokia Corporation
* Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
* Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
* Copyright (C) 2002-2003 Stephen Crane <steve.crane@rococosoft.com>
*
*
*/
#ifndef __SDP_LIB_H
#define __SDP_LIB_H
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* SDP lists
*/
typedef void(*sdp_list_func_t)(void *, void *);
typedef void(*sdp_free_func_t)(void *);
typedef int (*sdp_comp_func_t)(const void *, const void *);
sdp_list_t *sdp_list_append(sdp_list_t *list, void *d);
sdp_list_t *sdp_list_remove(sdp_list_t *list, void *d);
sdp_list_t *sdp_list_insert_sorted(sdp_list_t *list, void *data, sdp_comp_func_t f);
void sdp_list_free(sdp_list_t *list, sdp_free_func_t f);
static inline int sdp_list_len(const sdp_list_t *list)
{
int n = 0;
for (; list; list = list->next)
n++;
return n;
}
static inline sdp_list_t *sdp_list_find(sdp_list_t *list, void *u, sdp_comp_func_t f)
{
for (; list; list = list->next)
if (f(list->data, u) == 0)
return list;
return NULL;
}
static inline void sdp_list_foreach(sdp_list_t *list, sdp_list_func_t f, void *u)
{
for (; list; list = list->next)
f(list->data, u);
}
/*
* Values of the flags parameter to sdp_record_register
*/
#define SDP_RECORD_PERSIST 0x01
#define SDP_DEVICE_RECORD 0x02
/*
* Values of the flags parameter to sdp_connect
*/
#define SDP_RETRY_IF_BUSY 0x01
#define SDP_WAIT_ON_CLOSE 0x02
#define SDP_NON_BLOCKING 0x04
#define SDP_LARGE_MTU 0x08
/*
* a session with an SDP server
*/
typedef struct {
int sock;
int state;
int local;
int flags;
uint16_t tid; /* Current transaction ID */
void *priv;
} sdp_session_t;
typedef enum {
/*
* Attributes are specified as individual elements
*/
SDP_ATTR_REQ_INDIVIDUAL = 1,
/*
* Attributes are specified as a range
*/
SDP_ATTR_REQ_RANGE
} sdp_attrreq_type_t;
/*
* When the pdu_id(type) is a sdp error response, check the status value
* to figure out the error reason. For status values 0x0001-0x0006 check
* Bluetooth SPEC. If the status is 0xffff, call sdp_get_error function
* to get the real reason:
* - wrong transaction ID(EPROTO)
* - wrong PDU id or(EPROTO)
* - I/O error
*/
typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata);
/*
* create an L2CAP connection to a Bluetooth device
*
* INPUT:
*
* bdaddr_t *src:
* Address of the local device to use to make the connection
* (or BDADDR_ANY)
*
* bdaddr_t *dst:
* Address of the SDP server device
*/
sdp_session_t *sdp_connect(const bdaddr_t *src, const bdaddr_t *dst, uint32_t flags);
int sdp_close(sdp_session_t *session);
int sdp_get_socket(const sdp_session_t *session);
/*
* SDP transaction: functions for asynchronous search.
*/
sdp_session_t *sdp_create(int sk, uint32_t flags);
int sdp_get_error(sdp_session_t *session);
int sdp_process(sdp_session_t *session);
int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata);
int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search, uint16_t max_rec_num);
int sdp_service_attr_async(sdp_session_t *session, uint32_t handle, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
int sdp_service_search_attr_async(sdp_session_t *session, const sdp_list_t *search, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
uint16_t sdp_gen_tid(sdp_session_t *session);
/*
* find all devices in the piconet
*/
int sdp_general_inquiry(inquiry_info *ii, int dev_num, int duration, uint8_t *found);
/* flexible extraction of basic attributes - Jean II */
int sdp_get_int_attr(const sdp_record_t *rec, uint16_t attr, int *value);
int sdp_get_string_attr(const sdp_record_t *rec, uint16_t attr, char *value, int valuelen);
/*
* Basic sdp data functions
*/
sdp_data_t *sdp_data_alloc(uint8_t dtd, const void *value);
sdp_data_t *sdp_data_alloc_with_length(uint8_t dtd, const void *value, uint32_t length);
void sdp_data_free(sdp_data_t *data);
sdp_data_t *sdp_data_get(const sdp_record_t *rec, uint16_t attr_id);
sdp_data_t *sdp_seq_alloc(void **dtds, void **values, int len);
sdp_data_t *sdp_seq_alloc_with_length(void **dtds, void **values, int *length, int len);
sdp_data_t *sdp_seq_append(sdp_data_t *seq, sdp_data_t *data);
int sdp_attr_add(sdp_record_t *rec, uint16_t attr, sdp_data_t *data);
void sdp_attr_remove(sdp_record_t *rec, uint16_t attr);
void sdp_attr_replace(sdp_record_t *rec, uint16_t attr, sdp_data_t *data);
int sdp_set_uuidseq_attr(sdp_record_t *rec, uint16_t attr, sdp_list_t *seq);
int sdp_get_uuidseq_attr(const sdp_record_t *rec, uint16_t attr, sdp_list_t **seqp);
/*
* NOTE that none of the functions below will update the SDP server,
* unless the {register, update}sdp_record_t() function is invoked.
* All functions which return an integer value, return 0 on success
* or -1 on failure.
*/
/*
* Create an attribute and add it to the service record's attribute list.
* This consists of the data type descriptor of the attribute,
* the value of the attribute and the attribute identifier.
*/
int sdp_attr_add_new(sdp_record_t *rec, uint16_t attr, uint8_t dtd, const void *p);
/*
* Set the information attributes of the service record.
* The set of attributes comprises service name, description
* and provider name
*/
void sdp_set_info_attr(sdp_record_t *rec, const char *name, const char *prov, const char *desc);
/*
* Set the ServiceClassID attribute to the sequence specified by seq.
* Note that the identifiers need to be in sorted order from the most
* specific to the most generic service class that this service
* conforms to.
*/
static inline int sdp_set_service_classes(sdp_record_t *rec, sdp_list_t *seq)
{
return sdp_set_uuidseq_attr(rec, SDP_ATTR_SVCLASS_ID_LIST, seq);
}
/*
* Get the service classes to which the service conforms.
*
* When set, the list contains elements of ServiceClassIdentifer(uint16_t)
* ordered from most specific to most generic
*/
static inline int sdp_get_service_classes(const sdp_record_t *rec, sdp_list_t **seqp)
{
return sdp_get_uuidseq_attr(rec, SDP_ATTR_SVCLASS_ID_LIST, seqp);
}
/*
* Set the BrowseGroupList attribute to the list specified by seq.
*
* A service can belong to one or more service groups
* and the list comprises such group identifiers (UUIDs)
*/
static inline int sdp_set_browse_groups(sdp_record_t *rec, sdp_list_t *seq)
{
return sdp_set_uuidseq_attr(rec, SDP_ATTR_BROWSE_GRP_LIST, seq);
}
/*
* Set the access protocols of the record to those specified in proto
*/
int sdp_set_access_protos(sdp_record_t *rec, const sdp_list_t *proto);
/*
* Set the additional access protocols of the record to those specified in proto
*/
int sdp_set_add_access_protos(sdp_record_t *rec, const sdp_list_t *proto);
/*
* Get protocol port (i.e. PSM for L2CAP, Channel for RFCOMM)
*/
int sdp_get_proto_port(const sdp_list_t *list, int proto);
/*
* Get protocol descriptor.
*/
sdp_data_t *sdp_get_proto_desc(sdp_list_t *list, int proto);
/*
* Set the LanguageBase attributes to the values specified in list
* (a linked list of sdp_lang_attr_t objects, one for each language in
* which user-visible attributes are present).
*/
int sdp_set_lang_attr(sdp_record_t *rec, const sdp_list_t *list);
/*
* Set the ServiceInfoTimeToLive attribute of the service.
* This is the number of seconds that this record is guaranteed
* not to change after being obtained by a client.
*/
static inline int sdp_set_service_ttl(sdp_record_t *rec, uint32_t ttl)
{
return sdp_attr_add_new(rec, SDP_ATTR_SVCINFO_TTL, SDP_UINT32, &ttl);
}
/*
* Set the ServiceRecordState attribute of a service. This is
* guaranteed to change if there is any kind of modification to
* the record.
*/
static inline int sdp_set_record_state(sdp_record_t *rec, uint32_t state)
{
return sdp_attr_add_new(rec, SDP_ATTR_RECORD_STATE, SDP_UINT32, &state);
}
/*
* Set the ServiceID attribute of a service.
*/
void sdp_set_service_id(sdp_record_t *rec, uuid_t uuid);
/*
* Set the GroupID attribute of a service
*/
void sdp_set_group_id(sdp_record_t *rec, uuid_t grouuuid);
/*
* Set the ServiceAvailability attribute of a service.
*
* Note that this represents the relative availability
* of the service: 0x00 means completely unavailable;
* 0xFF means maximum availability.
*/
static inline int sdp_set_service_avail(sdp_record_t *rec, uint8_t avail)
{
return sdp_attr_add_new(rec, SDP_ATTR_SERVICE_AVAILABILITY, SDP_UINT8, &avail);
}
/*
* Set the profile descriptor list attribute of a record.
*
* Each element in the list is an object of type
* sdp_profile_desc_t which is a definition of the
* Bluetooth profile that this service conforms to.
*/
int sdp_set_profile_descs(sdp_record_t *rec, const sdp_list_t *desc);
/*
* Set URL attributes of a record.
*
* ClientExecutableURL: a URL to a client's platform specific (WinCE,
* PalmOS) executable code that can be used to access this service.
*
* DocumentationURL: a URL pointing to service documentation
*
* IconURL: a URL to an icon that can be used to represent this service.
*
* Note: pass NULL for any URLs that you don't want to set or remove
*/
void sdp_set_url_attr(sdp_record_t *rec, const char *clientExecURL, const char *docURL, const char *iconURL);
/*
* a service search request.
*
* INPUT :
*
* sdp_list_t *search
* list containing elements of the search
* pattern. Each entry in the list is a UUID
* of the service to be searched
*
* uint16_t max_rec_num
* An integer specifying the maximum number of
* entries that the client can handle in the response.
*
* OUTPUT :
*
* int return value
* 0
* The request completed successfully. This does not
* mean the requested services were found
* -1
* The request completed unsuccessfully
*
* sdp_list_t *rsp_list
* This variable is set on a successful return if there are
* non-zero service handles. It is a singly linked list of
* service record handles (uint16_t)
*/
int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search, uint16_t max_rec_num, sdp_list_t **rsp_list);
/*
* a service attribute request.
*
* INPUT :
*
* uint32_t handle
* The handle of the service for which the attribute(s) are
* requested
*
* sdp_attrreq_type_t reqtype
* Attribute identifiers are 16 bit unsigned integers specified
* in one of 2 ways described below :
* SDP_ATTR_REQ_INDIVIDUAL - 16bit individual identifiers
* They are the actual attribute identifiers in ascending order
*
* SDP_ATTR_REQ_RANGE - 32bit identifier range
* The high-order 16bits is the start of range
* the low-order 16bits are the end of range
* 0x0000 to 0xFFFF gets all attributes
*
* sdp_list_t *attrid_list
* Singly linked list containing attribute identifiers desired.
* Every element is either a uint16_t(attrSpec = SDP_ATTR_REQ_INDIVIDUAL)
* or a uint32_t(attrSpec=SDP_ATTR_REQ_RANGE)
*
* OUTPUT :
* int return value
* 0
* The request completed successfully. This does not
* mean the requested services were found
* -1
* The request completed unsuccessfully due to a timeout
*/
sdp_record_t *sdp_service_attr_req(sdp_session_t *session, uint32_t handle, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
/*
* This is a service search request combined with the service
* attribute request. First a service class match is done and
* for matching service, requested attributes are extracted
*
* INPUT :
*
* sdp_list_t *search
* Singly linked list containing elements of the search
* pattern. Each entry in the list is a UUID(DataTypeSDP_UUID16)
* of the service to be searched
*
* AttributeSpecification attrSpec
* Attribute identifiers are 16 bit unsigned integers specified
* in one of 2 ways described below :
* SDP_ATTR_REQ_INDIVIDUAL - 16bit individual identifiers
* They are the actual attribute identifiers in ascending order
*
* SDP_ATTR_REQ_RANGE - 32bit identifier range
* The high-order 16bits is the start of range
* the low-order 16bits are the end of range
* 0x0000 to 0xFFFF gets all attributes
*
* sdp_list_t *attrid_list
* Singly linked list containing attribute identifiers desired.
* Every element is either a uint16_t(attrSpec = SDP_ATTR_REQ_INDIVIDUAL)
* or a uint32_t(attrSpec=SDP_ATTR_REQ_RANGE)
*
* OUTPUT :
* int return value
* 0
* The request completed successfully. This does not
* mean the requested services were found
* -1
* The request completed unsuccessfully due to a timeout
*
* sdp_list_t *rsp_list
* This variable is set on a successful return to point to
* service(s) found. Each element of this list is of type
* sdp_record_t *.
*/
int sdp_service_search_attr_req(sdp_session_t *session, const sdp_list_t *search, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list, sdp_list_t **rsp_list);
/*
* Allocate/free a service record and its attributes
*/
sdp_record_t *sdp_record_alloc(void);
void sdp_record_free(sdp_record_t *rec);
/*
* Register a service record.
*
* Note: It is the responsbility of the Service Provider to create the
* record first and set its attributes using setXXX() methods.
*
* The service provider must then call sdp_record_register() to make
* the service record visible to SDP clients. This function returns 0
* on success or -1 on failure (and sets errno).
*/
int sdp_device_record_register_binary(sdp_session_t *session, bdaddr_t *device, uint8_t *data, uint32_t size, uint8_t flags, uint32_t *handle);
int sdp_device_record_register(sdp_session_t *session, bdaddr_t *device, sdp_record_t *rec, uint8_t flags);
int sdp_record_register(sdp_session_t *session, sdp_record_t *rec, uint8_t flags);
/*
* Unregister a service record.
*/
int sdp_device_record_unregister_binary(sdp_session_t *session, bdaddr_t *device, uint32_t handle);
int sdp_device_record_unregister(sdp_session_t *session, bdaddr_t *device, sdp_record_t *rec);
int sdp_record_unregister(sdp_session_t *session, sdp_record_t *rec);
/*
* Update an existing service record. (Calling this function
* before a previous call to sdp_record_register() will result
* in an error.)
*/
int sdp_device_record_update_binary(sdp_session_t *session, bdaddr_t *device, uint32_t handle, uint8_t *data, uint32_t size);
int sdp_device_record_update(sdp_session_t *session, bdaddr_t *device, const sdp_record_t *rec);
int sdp_record_update(sdp_session_t *sess, const sdp_record_t *rec);
void sdp_record_print(const sdp_record_t *rec);
/*
* UUID functions
*/
uuid_t *sdp_uuid16_create(uuid_t *uuid, uint16_t data);
uuid_t *sdp_uuid32_create(uuid_t *uuid, uint32_t data);
uuid_t *sdp_uuid128_create(uuid_t *uuid, const void *data);
int sdp_uuid16_cmp(const void *p1, const void *p2);
int sdp_uuid128_cmp(const void *p1, const void *p2);
int sdp_uuid_cmp(const void *p1, const void *p2);
uuid_t *sdp_uuid_to_uuid128(const uuid_t *uuid);
void sdp_uuid16_to_uuid128(uuid_t *uuid128, const uuid_t *uuid16);
void sdp_uuid32_to_uuid128(uuid_t *uuid128, const uuid_t *uuid32);
int sdp_uuid128_to_uuid(uuid_t *uuid);
int sdp_uuid_to_proto(uuid_t *uuid);
int sdp_uuid_extract(const uint8_t *buffer, int bufsize, uuid_t *uuid, int *scanned);
void sdp_uuid_print(const uuid_t *uuid);
#define MAX_LEN_UUID_STR 37
#define MAX_LEN_PROTOCOL_UUID_STR 8
#define MAX_LEN_SERVICECLASS_UUID_STR 28
#define MAX_LEN_PROFILEDESCRIPTOR_UUID_STR 28
int sdp_uuid2strn(const uuid_t *uuid, char *str, size_t n);
int sdp_proto_uuid2strn(const uuid_t *uuid, char *str, size_t n);
int sdp_svclass_uuid2strn(const uuid_t *uuid, char *str, size_t n);
int sdp_profile_uuid2strn(const uuid_t *uuid, char *str, size_t n);
/*
* In all the sdp_get_XXX(handle, XXX *xxx) functions below,
* the XXX * is set to point to the value, should it exist
* and 0 is returned. If the value does not exist, -1 is
* returned and errno set to ENODATA.
*
* In all the methods below, the memory management rules are
* simple. Don't free anything! The pointer returned, in the
* case of constructed types, is a pointer to the contents
* of the sdp_record_t.
*/
/*
* Get the access protocols from the service record
*/
int sdp_get_access_protos(const sdp_record_t *rec, sdp_list_t **protos);
/*
* Get the additional access protocols from the service record
*/
int sdp_get_add_access_protos(const sdp_record_t *rec, sdp_list_t **protos);
/*
* Extract the list of browse groups to which the service belongs.
* When set, seqp contains elements of GroupID (uint16_t)
*/
static inline int sdp_get_browse_groups(const sdp_record_t *rec, sdp_list_t **seqp)
{
return sdp_get_uuidseq_attr(rec, SDP_ATTR_BROWSE_GRP_LIST, seqp);
}
/*
* Extract language attribute meta-data of the service record.
* For each language in the service record, LangSeq has a struct of type
* sdp_lang_attr_t.
*/
int sdp_get_lang_attr(const sdp_record_t *rec, sdp_list_t **langSeq);
/*
* Extract the Bluetooth profile descriptor sequence from a record.
* Each element in the list is of type sdp_profile_desc_t
* which contains the UUID of the profile and its version number
* (encoded as major and minor in the high-order 8bits
* and low-order 8bits respectively of the uint16_t)
*/
int sdp_get_profile_descs(const sdp_record_t *rec, sdp_list_t **profDesc);
/*
* Extract SDP server version numbers
*
* Note: that this is an attribute of the SDP server only and
* contains a list of uint16_t each of which represent the
* major and minor SDP version numbers supported by this server
*/
int sdp_get_server_ver(const sdp_record_t *rec, sdp_list_t **pVnumList);
int sdp_get_service_id(const sdp_record_t *rec, uuid_t *uuid);
int sdp_get_group_id(const sdp_record_t *rec, uuid_t *uuid);
int sdp_get_record_state(const sdp_record_t *rec, uint32_t *svcRecState);
int sdp_get_service_avail(const sdp_record_t *rec, uint8_t *svcAvail);
int sdp_get_service_ttl(const sdp_record_t *rec, uint32_t *svcTTLInfo);
int sdp_get_database_state(const sdp_record_t *rec, uint32_t *svcDBState);
static inline int sdp_get_service_name(const sdp_record_t *rec, char *str, int len)
{
return sdp_get_string_attr(rec, SDP_ATTR_SVCNAME_PRIMARY, str, len);
}
static inline int sdp_get_service_desc(const sdp_record_t *rec, char *str, int len)
{
return sdp_get_string_attr(rec, SDP_ATTR_SVCDESC_PRIMARY, str, len);
}
static inline int sdp_get_provider_name(const sdp_record_t *rec, char *str, int len)
{
return sdp_get_string_attr(rec, SDP_ATTR_PROVNAME_PRIMARY, str, len);
}
static inline int sdp_get_doc_url(const sdp_record_t *rec, char *str, int len)
{
return sdp_get_string_attr(rec, SDP_ATTR_DOC_URL, str, len);
}
static inline int sdp_get_clnt_exec_url(const sdp_record_t *rec, char *str, int len)
{
return sdp_get_string_attr(rec, SDP_ATTR_CLNT_EXEC_URL, str, len);
}
static inline int sdp_get_icon_url(const sdp_record_t *rec, char *str, int len)
{
return sdp_get_string_attr(rec, SDP_ATTR_ICON_URL, str, len);
}
/*
* Set the supported features
* sf should be a list of list with each feature data
* Returns 0 on success -1 on fail
*/
int sdp_set_supp_feat(sdp_record_t *rec, const sdp_list_t *sf);
/*
* Get the supported features
* seqp is set to a list of list with each feature data
* Returns 0 on success, if an error occurred -1 is returned and errno is set
*/
int sdp_get_supp_feat(const sdp_record_t *rec, sdp_list_t **seqp);
sdp_record_t *sdp_extract_pdu(const uint8_t *pdata, int bufsize, int *scanned);
sdp_record_t *sdp_copy_record(sdp_record_t *rec);
void sdp_data_print(sdp_data_t *data);
void sdp_print_service_attr(sdp_list_t *alist);
int sdp_attrid_comp_func(const void *key1, const void *key2);
void sdp_set_seq_len(uint8_t *ptr, uint32_t length);
void sdp_set_attrid(sdp_buf_t *pdu, uint16_t id);
void sdp_append_to_pdu(sdp_buf_t *dst, sdp_data_t *d);
void sdp_append_to_buf(sdp_buf_t *dst, uint8_t *data, uint32_t len);
int sdp_gen_pdu(sdp_buf_t *pdu, sdp_data_t *data);
int sdp_gen_record_pdu(const sdp_record_t *rec, sdp_buf_t *pdu);
int sdp_extract_seqtype(const uint8_t *buf, int bufsize, uint8_t *dtdp, int *size);
sdp_data_t *sdp_extract_attr(const uint8_t *pdata, int bufsize, int *extractedLength, sdp_record_t *rec);
void sdp_pattern_add_uuid(sdp_record_t *rec, uuid_t *uuid);
void sdp_pattern_add_uuidseq(sdp_record_t *rec, sdp_list_t *seq);
int sdp_send_req_w4_rsp(sdp_session_t *session, uint8_t *req, uint8_t *rsp, uint32_t reqsize, uint32_t *rspsize);
void sdp_add_lang_attr(sdp_record_t *rec);
#ifdef __cplusplus
}
#endif
#endif /* __SDP_LIB_H */

View File

@ -0,0 +1,67 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-address.h Server address parser.
*
* Copyright (C) 2003 CodeFactory AB
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_ADDRESS_H
#define DBUS_ADDRESS_H
#include <dbus/dbus-types.h>
#include <dbus/dbus-errors.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusAddress
* @{
*/
/** Opaque type representing one of the semicolon-separated items in an address */
typedef struct DBusAddressEntry DBusAddressEntry;
DBUS_EXPORT
dbus_bool_t dbus_parse_address (const char *address,
DBusAddressEntry ***entry,
int *array_len,
DBusError *error);
DBUS_EXPORT
const char *dbus_address_entry_get_value (DBusAddressEntry *entry,
const char *key);
DBUS_EXPORT
const char *dbus_address_entry_get_method (DBusAddressEntry *entry);
DBUS_EXPORT
void dbus_address_entries_free (DBusAddressEntry **entries);
DBUS_EXPORT
char* dbus_address_escape_value (const char *value);
DBUS_EXPORT
char* dbus_address_unescape_value (const char *value,
DBusError *error);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_ADDRESS_H */

View File

@ -0,0 +1,61 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-arch-deps.h Header with architecture/compiler specific information, installed to libdir
*
* Copyright (C) 2003 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.0
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_ARCH_DEPS_H
#define DBUS_ARCH_DEPS_H
#include <dbus/dbus-macros.h>
DBUS_BEGIN_DECLS
/* D-Bus no longer supports platforms with no 64-bit integer type. */
#define DBUS_HAVE_INT64 1
_DBUS_GNUC_EXTENSION typedef long long dbus_int64_t;
_DBUS_GNUC_EXTENSION typedef unsigned long long dbus_uint64_t;
#define DBUS_INT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION (val##LL))
#define DBUS_UINT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION (val##ULL))
typedef int dbus_int32_t;
typedef unsigned int dbus_uint32_t;
typedef short dbus_int16_t;
typedef unsigned short dbus_uint16_t;
/* This is not really arch-dependent, but it's not worth
* creating an additional generated header just for this
*/
#define DBUS_MAJOR_VERSION 1
#define DBUS_MINOR_VERSION 9
#define DBUS_MICRO_VERSION 4
#define DBUS_VERSION_STRING "1.9.4"
#define DBUS_VERSION ((1 << 16) | (9 << 8) | (4))
DBUS_END_DECLS
#endif /* DBUS_ARCH_DEPS_H */

View File

@ -0,0 +1,95 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-bus.h Convenience functions for communicating with the bus.
*
* Copyright (C) 2003 CodeFactory AB
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_BUS_H
#define DBUS_BUS_H
#include <dbus/dbus-connection.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusBus
* @{
*/
DBUS_EXPORT
DBusConnection *dbus_bus_get (DBusBusType type,
DBusError *error);
DBUS_EXPORT
DBusConnection *dbus_bus_get_private (DBusBusType type,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_bus_register (DBusConnection *connection,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_bus_set_unique_name (DBusConnection *connection,
const char *unique_name);
DBUS_EXPORT
const char* dbus_bus_get_unique_name (DBusConnection *connection);
DBUS_EXPORT
unsigned long dbus_bus_get_unix_user (DBusConnection *connection,
const char *name,
DBusError *error);
DBUS_EXPORT
char* dbus_bus_get_id (DBusConnection *connection,
DBusError *error);
DBUS_EXPORT
int dbus_bus_request_name (DBusConnection *connection,
const char *name,
unsigned int flags,
DBusError *error);
DBUS_EXPORT
int dbus_bus_release_name (DBusConnection *connection,
const char *name,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_bus_name_has_owner (DBusConnection *connection,
const char *name,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_bus_start_service_by_name (DBusConnection *connection,
const char *name,
dbus_uint32_t flags,
dbus_uint32_t *reply,
DBusError *error);
DBUS_EXPORT
void dbus_bus_add_match (DBusConnection *connection,
const char *rule,
DBusError *error);
DBUS_EXPORT
void dbus_bus_remove_match (DBusConnection *connection,
const char *rule,
DBusError *error);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_BUS_H */

View File

@ -0,0 +1,496 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-connection.h DBusConnection object
*
* Copyright (C) 2002, 2003 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_CONNECTION_H
#define DBUS_CONNECTION_H
#include <dbus/dbus-errors.h>
#include <dbus/dbus-memory.h>
#include <dbus/dbus-message.h>
#include <dbus/dbus-shared.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusConnection
* @{
*/
/* documented in dbus-watch.c */
typedef struct DBusWatch DBusWatch;
/* documented in dbus-timeout.c */
typedef struct DBusTimeout DBusTimeout;
/** Opaque type representing preallocated resources so a message can be sent without further memory allocation. */
typedef struct DBusPreallocatedSend DBusPreallocatedSend;
/** Opaque type representing a method call that has not yet received a reply. */
typedef struct DBusPendingCall DBusPendingCall;
/** Opaque type representing a connection to a remote application and associated incoming/outgoing message queues. */
typedef struct DBusConnection DBusConnection;
/** Set of functions that must be implemented to handle messages sent to a particular object path. */
typedef struct DBusObjectPathVTable DBusObjectPathVTable;
/**
* Indicates the status of a #DBusWatch.
*/
typedef enum
{
DBUS_WATCH_READABLE = 1 << 0, /**< As in POLLIN */
DBUS_WATCH_WRITABLE = 1 << 1, /**< As in POLLOUT */
DBUS_WATCH_ERROR = 1 << 2, /**< As in POLLERR (can't watch for
* this, but can be present in
* current state passed to
* dbus_watch_handle()).
*/
DBUS_WATCH_HANGUP = 1 << 3 /**< As in POLLHUP (can't watch for
* it, but can be present in current
* state passed to
* dbus_watch_handle()).
*/
/* Internal to libdbus, there is also _DBUS_WATCH_NVAL in dbus-watch.h */
} DBusWatchFlags;
/**
* Indicates the status of incoming data on a #DBusConnection. This determines whether
* dbus_connection_dispatch() needs to be called.
*/
typedef enum
{
DBUS_DISPATCH_DATA_REMAINS, /**< There is more data to potentially convert to messages. */
DBUS_DISPATCH_COMPLETE, /**< All currently available data has been processed. */
DBUS_DISPATCH_NEED_MEMORY /**< More memory is needed to continue. */
} DBusDispatchStatus;
/** Called when libdbus needs a new watch to be monitored by the main
* loop. Returns #FALSE if it lacks enough memory to add the
* watch. Set by dbus_connection_set_watch_functions() or
* dbus_server_set_watch_functions().
*/
typedef dbus_bool_t (* DBusAddWatchFunction) (DBusWatch *watch,
void *data);
/** Called when dbus_watch_get_enabled() may return a different value
* than it did before. Set by dbus_connection_set_watch_functions()
* or dbus_server_set_watch_functions().
*/
typedef void (* DBusWatchToggledFunction) (DBusWatch *watch,
void *data);
/** Called when libdbus no longer needs a watch to be monitored by the
* main loop. Set by dbus_connection_set_watch_functions() or
* dbus_server_set_watch_functions().
*/
typedef void (* DBusRemoveWatchFunction) (DBusWatch *watch,
void *data);
/** Called when libdbus needs a new timeout to be monitored by the main
* loop. Returns #FALSE if it lacks enough memory to add the
* watch. Set by dbus_connection_set_timeout_functions() or
* dbus_server_set_timeout_functions().
*/
typedef dbus_bool_t (* DBusAddTimeoutFunction) (DBusTimeout *timeout,
void *data);
/** Called when dbus_timeout_get_enabled() may return a different
* value than it did before.
* Set by dbus_connection_set_timeout_functions() or
* dbus_server_set_timeout_functions().
*/
typedef void (* DBusTimeoutToggledFunction) (DBusTimeout *timeout,
void *data);
/** Called when libdbus no longer needs a timeout to be monitored by the
* main loop. Set by dbus_connection_set_timeout_functions() or
* dbus_server_set_timeout_functions().
*/
typedef void (* DBusRemoveTimeoutFunction) (DBusTimeout *timeout,
void *data);
/** Called when the return value of dbus_connection_get_dispatch_status()
* may have changed. Set with dbus_connection_set_dispatch_status_function().
*/
typedef void (* DBusDispatchStatusFunction) (DBusConnection *connection,
DBusDispatchStatus new_status,
void *data);
/**
* Called when the main loop's thread should be notified that there's now work
* to do. Set with dbus_connection_set_wakeup_main_function().
*/
typedef void (* DBusWakeupMainFunction) (void *data);
/**
* Called during authentication to check whether the given UNIX user
* ID is allowed to connect, if the client tried to auth as a UNIX
* user ID. Normally on Windows this would never happen. Set with
* dbus_connection_set_unix_user_function().
*/
typedef dbus_bool_t (* DBusAllowUnixUserFunction) (DBusConnection *connection,
unsigned long uid,
void *data);
/**
* Called during authentication to check whether the given Windows user
* ID is allowed to connect, if the client tried to auth as a Windows
* user ID. Normally on UNIX this would never happen. Set with
* dbus_connection_set_windows_user_function().
*/
typedef dbus_bool_t (* DBusAllowWindowsUserFunction) (DBusConnection *connection,
const char *user_sid,
void *data);
/**
* Called when a pending call now has a reply available. Set with
* dbus_pending_call_set_notify().
*/
typedef void (* DBusPendingCallNotifyFunction) (DBusPendingCall *pending,
void *user_data);
/**
* Called when a message needs to be handled. The result indicates whether or
* not more handlers should be run. Set with dbus_connection_add_filter().
*/
typedef DBusHandlerResult (* DBusHandleMessageFunction) (DBusConnection *connection,
DBusMessage *message,
void *user_data);
DBUS_EXPORT
DBusConnection* dbus_connection_open (const char *address,
DBusError *error);
DBUS_EXPORT
DBusConnection* dbus_connection_open_private (const char *address,
DBusError *error);
DBUS_EXPORT
DBusConnection* dbus_connection_ref (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_unref (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_close (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_is_connected (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_is_authenticated (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_is_anonymous (DBusConnection *connection);
DBUS_EXPORT
char* dbus_connection_get_server_id (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_can_send_type (DBusConnection *connection,
int type);
DBUS_EXPORT
void dbus_connection_set_exit_on_disconnect (DBusConnection *connection,
dbus_bool_t exit_on_disconnect);
DBUS_EXPORT
void dbus_connection_flush (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_read_write_dispatch (DBusConnection *connection,
int timeout_milliseconds);
DBUS_EXPORT
dbus_bool_t dbus_connection_read_write (DBusConnection *connection,
int timeout_milliseconds);
DBUS_EXPORT
DBusMessage* dbus_connection_borrow_message (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_return_message (DBusConnection *connection,
DBusMessage *message);
DBUS_EXPORT
void dbus_connection_steal_borrowed_message (DBusConnection *connection,
DBusMessage *message);
DBUS_EXPORT
DBusMessage* dbus_connection_pop_message (DBusConnection *connection);
DBUS_EXPORT
DBusDispatchStatus dbus_connection_get_dispatch_status (DBusConnection *connection);
DBUS_EXPORT
DBusDispatchStatus dbus_connection_dispatch (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_has_messages_to_send (DBusConnection *connection);
DBUS_EXPORT
dbus_bool_t dbus_connection_send (DBusConnection *connection,
DBusMessage *message,
dbus_uint32_t *client_serial);
DBUS_EXPORT
dbus_bool_t dbus_connection_send_with_reply (DBusConnection *connection,
DBusMessage *message,
DBusPendingCall **pending_return,
int timeout_milliseconds);
DBUS_EXPORT
DBusMessage * dbus_connection_send_with_reply_and_block (DBusConnection *connection,
DBusMessage *message,
int timeout_milliseconds,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_connection_set_watch_functions (DBusConnection *connection,
DBusAddWatchFunction add_function,
DBusRemoveWatchFunction remove_function,
DBusWatchToggledFunction toggled_function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_connection_set_timeout_functions (DBusConnection *connection,
DBusAddTimeoutFunction add_function,
DBusRemoveTimeoutFunction remove_function,
DBusTimeoutToggledFunction toggled_function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
void dbus_connection_set_wakeup_main_function (DBusConnection *connection,
DBusWakeupMainFunction wakeup_main_function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
void dbus_connection_set_dispatch_status_function (DBusConnection *connection,
DBusDispatchStatusFunction function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_unix_user (DBusConnection *connection,
unsigned long *uid);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_unix_process_id (DBusConnection *connection,
unsigned long *pid);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_adt_audit_session_data (DBusConnection *connection,
void **data,
dbus_int32_t *data_size);
DBUS_EXPORT
void dbus_connection_set_unix_user_function (DBusConnection *connection,
DBusAllowUnixUserFunction function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_windows_user (DBusConnection *connection,
char **windows_sid_p);
DBUS_EXPORT
void dbus_connection_set_windows_user_function (DBusConnection *connection,
DBusAllowWindowsUserFunction function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
void dbus_connection_set_allow_anonymous (DBusConnection *connection,
dbus_bool_t value);
DBUS_EXPORT
void dbus_connection_set_route_peer_messages (DBusConnection *connection,
dbus_bool_t value);
/* Filters */
DBUS_EXPORT
dbus_bool_t dbus_connection_add_filter (DBusConnection *connection,
DBusHandleMessageFunction function,
void *user_data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
void dbus_connection_remove_filter (DBusConnection *connection,
DBusHandleMessageFunction function,
void *user_data);
/* Other */
DBUS_EXPORT
dbus_bool_t dbus_connection_allocate_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
void dbus_connection_free_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
dbus_bool_t dbus_connection_set_data (DBusConnection *connection,
dbus_int32_t slot,
void *data,
DBusFreeFunction free_data_func);
DBUS_EXPORT
void* dbus_connection_get_data (DBusConnection *connection,
dbus_int32_t slot);
DBUS_EXPORT
void dbus_connection_set_change_sigpipe (dbus_bool_t will_modify_sigpipe);
DBUS_EXPORT
void dbus_connection_set_max_message_size (DBusConnection *connection,
long size);
DBUS_EXPORT
long dbus_connection_get_max_message_size (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_set_max_received_size (DBusConnection *connection,
long size);
DBUS_EXPORT
long dbus_connection_get_max_received_size (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_set_max_message_unix_fds (DBusConnection *connection,
long n);
DBUS_EXPORT
long dbus_connection_get_max_message_unix_fds (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_set_max_received_unix_fds(DBusConnection *connection,
long n);
DBUS_EXPORT
long dbus_connection_get_max_received_unix_fds(DBusConnection *connection);
DBUS_EXPORT
long dbus_connection_get_outgoing_size (DBusConnection *connection);
DBUS_EXPORT
long dbus_connection_get_outgoing_unix_fds (DBusConnection *connection);
DBUS_EXPORT
DBusPreallocatedSend* dbus_connection_preallocate_send (DBusConnection *connection);
DBUS_EXPORT
void dbus_connection_free_preallocated_send (DBusConnection *connection,
DBusPreallocatedSend *preallocated);
DBUS_EXPORT
void dbus_connection_send_preallocated (DBusConnection *connection,
DBusPreallocatedSend *preallocated,
DBusMessage *message,
dbus_uint32_t *client_serial);
/* Object tree functionality */
/**
* Called when a #DBusObjectPathVTable is unregistered (or its connection is freed).
* Found in #DBusObjectPathVTable.
*/
typedef void (* DBusObjectPathUnregisterFunction) (DBusConnection *connection,
void *user_data);
/**
* Called when a message is sent to a registered object path. Found in
* #DBusObjectPathVTable which is registered with dbus_connection_register_object_path()
* or dbus_connection_register_fallback().
*/
typedef DBusHandlerResult (* DBusObjectPathMessageFunction) (DBusConnection *connection,
DBusMessage *message,
void *user_data);
/**
* Virtual table that must be implemented to handle a portion of the
* object path hierarchy. Attach the vtable to a particular path using
* dbus_connection_register_object_path() or
* dbus_connection_register_fallback().
*/
struct DBusObjectPathVTable
{
DBusObjectPathUnregisterFunction unregister_function; /**< Function to unregister this handler */
DBusObjectPathMessageFunction message_function; /**< Function to handle messages */
void (* dbus_internal_pad1) (void *); /**< Reserved for future expansion */
void (* dbus_internal_pad2) (void *); /**< Reserved for future expansion */
void (* dbus_internal_pad3) (void *); /**< Reserved for future expansion */
void (* dbus_internal_pad4) (void *); /**< Reserved for future expansion */
};
DBUS_EXPORT
dbus_bool_t dbus_connection_try_register_object_path (DBusConnection *connection,
const char *path,
const DBusObjectPathVTable *vtable,
void *user_data,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_connection_register_object_path (DBusConnection *connection,
const char *path,
const DBusObjectPathVTable *vtable,
void *user_data);
DBUS_EXPORT
dbus_bool_t dbus_connection_try_register_fallback (DBusConnection *connection,
const char *path,
const DBusObjectPathVTable *vtable,
void *user_data,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_connection_register_fallback (DBusConnection *connection,
const char *path,
const DBusObjectPathVTable *vtable,
void *user_data);
DBUS_EXPORT
dbus_bool_t dbus_connection_unregister_object_path (DBusConnection *connection,
const char *path);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_object_path_data (DBusConnection *connection,
const char *path,
void **data_p);
DBUS_EXPORT
dbus_bool_t dbus_connection_list_registered (DBusConnection *connection,
const char *parent_path,
char ***child_entries);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_unix_fd (DBusConnection *connection,
int *fd);
DBUS_EXPORT
dbus_bool_t dbus_connection_get_socket (DBusConnection *connection,
int *fd);
/** @} */
/**
* @addtogroup DBusWatch
* @{
*/
#ifndef DBUS_DISABLE_DEPRECATED
DBUS_EXPORT
DBUS_DEPRECATED int dbus_watch_get_fd (DBusWatch *watch);
#endif
DBUS_EXPORT
int dbus_watch_get_unix_fd (DBusWatch *watch);
DBUS_EXPORT
int dbus_watch_get_socket (DBusWatch *watch);
DBUS_EXPORT
unsigned int dbus_watch_get_flags (DBusWatch *watch);
DBUS_EXPORT
void* dbus_watch_get_data (DBusWatch *watch);
DBUS_EXPORT
void dbus_watch_set_data (DBusWatch *watch,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_watch_handle (DBusWatch *watch,
unsigned int flags);
DBUS_EXPORT
dbus_bool_t dbus_watch_get_enabled (DBusWatch *watch);
/** @} */
/**
* @addtogroup DBusTimeout
* @{
*/
DBUS_EXPORT
int dbus_timeout_get_interval (DBusTimeout *timeout);
DBUS_EXPORT
void* dbus_timeout_get_data (DBusTimeout *timeout);
DBUS_EXPORT
void dbus_timeout_set_data (DBusTimeout *timeout,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_timeout_handle (DBusTimeout *timeout);
DBUS_EXPORT
dbus_bool_t dbus_timeout_get_enabled (DBusTimeout *timeout);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_CONNECTION_H */

View File

@ -0,0 +1,90 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-errors.h Error reporting
*
* Copyright (C) 2002 Red Hat Inc.
* Copyright (C) 2003 CodeFactory AB
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_ERROR_H
#define DBUS_ERROR_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-protocol.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusErrors
* @{
*/
/** Mostly-opaque type representing an error that occurred */
typedef struct DBusError DBusError;
/**
* Object representing an exception.
*/
struct DBusError
{
const char *name; /**< public error name field */
const char *message; /**< public error message field */
unsigned int dummy1 : 1; /**< placeholder */
unsigned int dummy2 : 1; /**< placeholder */
unsigned int dummy3 : 1; /**< placeholder */
unsigned int dummy4 : 1; /**< placeholder */
unsigned int dummy5 : 1; /**< placeholder */
void *padding1; /**< placeholder */
};
#define DBUS_ERROR_INIT { NULL, NULL, TRUE, 0, 0, 0, 0, NULL }
DBUS_EXPORT
void dbus_error_init (DBusError *error);
DBUS_EXPORT
void dbus_error_free (DBusError *error);
DBUS_EXPORT
void dbus_set_error (DBusError *error,
const char *name,
const char *message,
...);
DBUS_EXPORT
void dbus_set_error_const (DBusError *error,
const char *name,
const char *message);
DBUS_EXPORT
void dbus_move_error (DBusError *src,
DBusError *dest);
DBUS_EXPORT
dbus_bool_t dbus_error_has_name (const DBusError *error,
const char *name);
DBUS_EXPORT
dbus_bool_t dbus_error_is_set (const DBusError *error);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_ERROR_H */

View File

@ -0,0 +1,199 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-macros.h generic macros
*
* Copyright (C) 2002 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_MACROS_H
#define DBUS_MACROS_H
#ifdef __cplusplus
# define DBUS_BEGIN_DECLS extern "C" {
# define DBUS_END_DECLS }
#else
# define DBUS_BEGIN_DECLS
# define DBUS_END_DECLS
#endif
#ifndef TRUE
# define TRUE 1
#endif
#ifndef FALSE
# define FALSE 0
#endif
#ifndef NULL
# ifdef __cplusplus
# define NULL (0L)
# else /* !__cplusplus */
# define NULL ((void*) 0)
# endif /* !__cplusplus */
#endif
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
# define DBUS_DEPRECATED __attribute__ ((__deprecated__))
#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
# define DBUS_DEPRECATED __declspec(deprecated)
#else
# define DBUS_DEPRECATED
#endif
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
# define _DBUS_GNUC_EXTENSION __extension__
#else
# define _DBUS_GNUC_EXTENSION
#endif
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#define _DBUS_GNUC_PRINTF( format_idx, arg_idx ) \
__attribute__((__format__ (__printf__, format_idx, arg_idx)))
#define _DBUS_GNUC_NORETURN \
__attribute__((__noreturn__))
#define _DBUS_GNUC_UNUSED \
__attribute__((__unused__))
#else /* !__GNUC__ */
#define _DBUS_GNUC_PRINTF( format_idx, arg_idx )
#define _DBUS_GNUC_NORETURN
#define _DBUS_GNUC_UNUSED
#endif /* !__GNUC__ */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
#define DBUS_MALLOC __attribute__((__malloc__))
#else
#define DBUS_MALLOC
#endif
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
#define DBUS_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
#define DBUS_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y)))
#else
#define DBUS_ALLOC_SIZE(x)
#define DBUS_ALLOC_SIZE2(x,y)
#endif
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#define _DBUS_GNUC_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
#define _DBUS_GNUC_WARN_UNUSED_RESULT
#endif
/** @def _DBUS_GNUC_PRINTF
* used to tell gcc about printf format strings
*/
/** @def _DBUS_GNUC_NORETURN
* used to tell gcc about functions that never return, such as _dbus_abort()
*/
/** @def _DBUS_GNUC_WARN_UNUSED_RESULT
* used to tell gcc about functions whose result must be used
*/
/* Normally docs are in .c files, but there isn't a .c file for this. */
/**
* @defgroup DBusMacros Utility macros
* @ingroup DBus
* @brief #TRUE, #FALSE, #NULL, and so on
*
* Utility macros.
*
* @{
*/
/**
* @def DBUS_BEGIN_DECLS
*
* Macro used prior to declaring functions in the D-Bus header
* files. Expands to "extern "C"" when using a C++ compiler,
* and expands to nothing when using a C compiler.
*
* Please don't use this in your own code, consider it
* D-Bus internal.
*/
/**
* @def DBUS_END_DECLS
*
* Macro used after declaring functions in the D-Bus header
* files. Expands to "}" when using a C++ compiler,
* and expands to nothing when using a C compiler.
*
* Please don't use this in your own code, consider it
* D-Bus internal.
*/
/**
* @def TRUE
*
* Expands to "1"
*/
/**
* @def FALSE
*
* Expands to "0"
*/
/**
* @def NULL
*
* A null pointer, defined appropriately for C or C++.
*/
/**
* @def DBUS_DEPRECATED
*
* Tells the compiler to warn about a function or type if it's used.
* Code marked in this way should also be enclosed in
* @code
* #ifndef DBUS_DISABLE_DEPRECATED
* deprecated stuff here
* #endif
* @endcode
*
* Please don't use this in your own code, consider it
* D-Bus internal.
*/
/**
* @def _DBUS_GNUC_EXTENSION
*
* Tells gcc not to warn about extensions to the C standard in the
* following expression, even if compiling with -pedantic. Do not use
* this macro in your own code; please consider it to be internal to libdbus.
*/
/*
* @def DBUS_EXPORT
*
* Declare the following symbol as public. This is currently a noop on
* platforms other than Windows.
*/
#if defined(_WIN32)
# if defined(DBUS_STATIC_BUILD)
# define DBUS_EXPORT
# elif defined(dbus_1_EXPORTS)
# define DBUS_EXPORT __declspec(dllexport)
# else
# define DBUS_EXPORT __declspec(dllimport)
# endif
#else
#define DBUS_EXPORT
#endif
/** @} */
#endif /* DBUS_MACROS_H */

View File

@ -0,0 +1,73 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-memory.h D-Bus memory handling
*
* Copyright (C) 2002 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_MEMORY_H
#define DBUS_MEMORY_H
#include <dbus/dbus-macros.h>
#include <stddef.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusMemory
* @{
*/
DBUS_EXPORT
DBUS_MALLOC
DBUS_ALLOC_SIZE(1)
void* dbus_malloc (size_t bytes);
DBUS_EXPORT
DBUS_MALLOC
DBUS_ALLOC_SIZE(1)
void* dbus_malloc0 (size_t bytes);
DBUS_EXPORT
DBUS_MALLOC
DBUS_ALLOC_SIZE(2)
void* dbus_realloc (void *memory,
size_t bytes);
DBUS_EXPORT
void dbus_free (void *memory);
#define dbus_new(type, count) ((type*)dbus_malloc (sizeof (type) * (count)))
#define dbus_new0(type, count) ((type*)dbus_malloc0 (sizeof (type) * (count)))
DBUS_EXPORT
void dbus_free_string_array (char **str_array);
typedef void (* DBusFreeFunction) (void *memory);
DBUS_EXPORT
void dbus_shutdown (void);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_MEMORY_H */

View File

@ -0,0 +1,317 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-message.h DBusMessage object
*
* Copyright (C) 2002, 2003, 2005 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_MESSAGE_H
#define DBUS_MESSAGE_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-arch-deps.h>
#include <dbus/dbus-memory.h>
#include <dbus/dbus-errors.h>
#include <stdarg.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusMessage
* @{
*/
typedef struct DBusMessage DBusMessage;
/** Opaque type representing a message iterator. Can be copied by value, and contains no allocated memory so never needs to be freed and can be allocated on the stack. */
typedef struct DBusMessageIter DBusMessageIter;
/**
* DBusMessageIter struct; contains no public fields.
*/
struct DBusMessageIter
{
void *dummy1; /**< Don't use this */
void *dummy2; /**< Don't use this */
dbus_uint32_t dummy3; /**< Don't use this */
int dummy4; /**< Don't use this */
int dummy5; /**< Don't use this */
int dummy6; /**< Don't use this */
int dummy7; /**< Don't use this */
int dummy8; /**< Don't use this */
int dummy9; /**< Don't use this */
int dummy10; /**< Don't use this */
int dummy11; /**< Don't use this */
int pad1; /**< Don't use this */
int pad2; /**< Don't use this */
void *pad3; /**< Don't use this */
};
DBUS_EXPORT
DBusMessage* dbus_message_new (int message_type);
DBUS_EXPORT
DBusMessage* dbus_message_new_method_call (const char *bus_name,
const char *path,
const char *iface,
const char *method);
DBUS_EXPORT
DBusMessage* dbus_message_new_method_return (DBusMessage *method_call);
DBUS_EXPORT
DBusMessage* dbus_message_new_signal (const char *path,
const char *iface,
const char *name);
DBUS_EXPORT
DBusMessage* dbus_message_new_error (DBusMessage *reply_to,
const char *error_name,
const char *error_message);
DBUS_EXPORT
DBusMessage* dbus_message_new_error_printf (DBusMessage *reply_to,
const char *error_name,
const char *error_format,
...);
DBUS_EXPORT
DBusMessage* dbus_message_copy (const DBusMessage *message);
DBUS_EXPORT
DBusMessage* dbus_message_ref (DBusMessage *message);
DBUS_EXPORT
void dbus_message_unref (DBusMessage *message);
DBUS_EXPORT
int dbus_message_get_type (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_set_path (DBusMessage *message,
const char *object_path);
DBUS_EXPORT
const char* dbus_message_get_path (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_has_path (DBusMessage *message,
const char *object_path);
DBUS_EXPORT
dbus_bool_t dbus_message_set_interface (DBusMessage *message,
const char *iface);
DBUS_EXPORT
const char* dbus_message_get_interface (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_has_interface (DBusMessage *message,
const char *iface);
DBUS_EXPORT
dbus_bool_t dbus_message_set_member (DBusMessage *message,
const char *member);
DBUS_EXPORT
const char* dbus_message_get_member (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_has_member (DBusMessage *message,
const char *member);
DBUS_EXPORT
dbus_bool_t dbus_message_set_error_name (DBusMessage *message,
const char *name);
DBUS_EXPORT
const char* dbus_message_get_error_name (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_set_destination (DBusMessage *message,
const char *destination);
DBUS_EXPORT
const char* dbus_message_get_destination (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_set_sender (DBusMessage *message,
const char *sender);
DBUS_EXPORT
const char* dbus_message_get_sender (DBusMessage *message);
DBUS_EXPORT
const char* dbus_message_get_signature (DBusMessage *message);
DBUS_EXPORT
void dbus_message_set_no_reply (DBusMessage *message,
dbus_bool_t no_reply);
DBUS_EXPORT
dbus_bool_t dbus_message_get_no_reply (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_is_method_call (DBusMessage *message,
const char *iface,
const char *method);
DBUS_EXPORT
dbus_bool_t dbus_message_is_signal (DBusMessage *message,
const char *iface,
const char *signal_name);
DBUS_EXPORT
dbus_bool_t dbus_message_is_error (DBusMessage *message,
const char *error_name);
DBUS_EXPORT
dbus_bool_t dbus_message_has_destination (DBusMessage *message,
const char *bus_name);
DBUS_EXPORT
dbus_bool_t dbus_message_has_sender (DBusMessage *message,
const char *unique_bus_name);
DBUS_EXPORT
dbus_bool_t dbus_message_has_signature (DBusMessage *message,
const char *signature);
DBUS_EXPORT
dbus_uint32_t dbus_message_get_serial (DBusMessage *message);
DBUS_EXPORT
void dbus_message_set_serial (DBusMessage *message,
dbus_uint32_t serial);
DBUS_EXPORT
dbus_bool_t dbus_message_set_reply_serial (DBusMessage *message,
dbus_uint32_t reply_serial);
DBUS_EXPORT
dbus_uint32_t dbus_message_get_reply_serial (DBusMessage *message);
DBUS_EXPORT
void dbus_message_set_auto_start (DBusMessage *message,
dbus_bool_t auto_start);
DBUS_EXPORT
dbus_bool_t dbus_message_get_auto_start (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_get_path_decomposed (DBusMessage *message,
char ***path);
DBUS_EXPORT
dbus_bool_t dbus_message_append_args (DBusMessage *message,
int first_arg_type,
...);
DBUS_EXPORT
dbus_bool_t dbus_message_append_args_valist (DBusMessage *message,
int first_arg_type,
va_list var_args);
DBUS_EXPORT
dbus_bool_t dbus_message_get_args (DBusMessage *message,
DBusError *error,
int first_arg_type,
...);
DBUS_EXPORT
dbus_bool_t dbus_message_get_args_valist (DBusMessage *message,
DBusError *error,
int first_arg_type,
va_list var_args);
DBUS_EXPORT
dbus_bool_t dbus_message_contains_unix_fds (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_init (DBusMessage *message,
DBusMessageIter *iter);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_has_next (DBusMessageIter *iter);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_next (DBusMessageIter *iter);
DBUS_EXPORT
char* dbus_message_iter_get_signature (DBusMessageIter *iter);
DBUS_EXPORT
int dbus_message_iter_get_arg_type (DBusMessageIter *iter);
DBUS_EXPORT
int dbus_message_iter_get_element_type (DBusMessageIter *iter);
DBUS_EXPORT
void dbus_message_iter_recurse (DBusMessageIter *iter,
DBusMessageIter *sub);
DBUS_EXPORT
void dbus_message_iter_get_basic (DBusMessageIter *iter,
void *value);
#ifndef DBUS_DISABLE_DEPRECATED
/* This function returns the wire protocol size of the array in bytes,
* you do not want to know that probably
*/
DBUS_EXPORT
DBUS_DEPRECATED int dbus_message_iter_get_array_len (DBusMessageIter *iter);
#endif
DBUS_EXPORT
void dbus_message_iter_get_fixed_array (DBusMessageIter *iter,
void *value,
int *n_elements);
DBUS_EXPORT
void dbus_message_iter_init_append (DBusMessage *message,
DBusMessageIter *iter);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_append_basic (DBusMessageIter *iter,
int type,
const void *value);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_append_fixed_array (DBusMessageIter *iter,
int element_type,
const void *value,
int n_elements);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_open_container (DBusMessageIter *iter,
int type,
const char *contained_signature,
DBusMessageIter *sub);
DBUS_EXPORT
dbus_bool_t dbus_message_iter_close_container (DBusMessageIter *iter,
DBusMessageIter *sub);
DBUS_EXPORT
void dbus_message_iter_abandon_container (DBusMessageIter *iter,
DBusMessageIter *sub);
DBUS_EXPORT
void dbus_message_lock (DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_set_error_from_message (DBusError *error,
DBusMessage *message);
DBUS_EXPORT
dbus_bool_t dbus_message_allocate_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
void dbus_message_free_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
dbus_bool_t dbus_message_set_data (DBusMessage *message,
dbus_int32_t slot,
void *data,
DBusFreeFunction free_data_func);
DBUS_EXPORT
void* dbus_message_get_data (DBusMessage *message,
dbus_int32_t slot);
DBUS_EXPORT
int dbus_message_type_from_string (const char *type_str);
DBUS_EXPORT
const char* dbus_message_type_to_string (int type);
DBUS_EXPORT
dbus_bool_t dbus_message_marshal (DBusMessage *msg,
char **marshalled_data_p,
int *len_p);
DBUS_EXPORT
DBusMessage* dbus_message_demarshal (const char *str,
int len,
DBusError *error);
DBUS_EXPORT
int dbus_message_demarshal_bytes_needed (const char *str,
int len);
DBUS_EXPORT
void dbus_message_set_allow_interactive_authorization (DBusMessage *message,
dbus_bool_t allow);
DBUS_EXPORT
dbus_bool_t dbus_message_get_allow_interactive_authorization (
DBusMessage *message);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_MESSAGE_H */

View File

@ -0,0 +1,56 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-misc.h A few assorted public functions that don't fit elsewhere
*
* Copyright (C) 2006 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_MISC_H
#define DBUS_MISC_H
#include <dbus/dbus-types.h>
#include <dbus/dbus-errors.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusMisc
* @{
*/
DBUS_EXPORT
char* dbus_get_local_machine_id (void);
DBUS_EXPORT
void dbus_get_version (int *major_version_p,
int *minor_version_p,
int *micro_version_p);
DBUS_EXPORT
dbus_bool_t dbus_setenv (const char *variable,
const char *value);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_MISC_H */

View File

@ -0,0 +1,79 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-pending-call.h Object representing a call in progress.
*
* Copyright (C) 2002, 2003 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_PENDING_CALL_H
#define DBUS_PENDING_CALL_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-connection.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusPendingCall
* @{
*/
#define DBUS_TIMEOUT_INFINITE ((int) 0x7fffffff)
#define DBUS_TIMEOUT_USE_DEFAULT (-1)
DBUS_EXPORT
DBusPendingCall* dbus_pending_call_ref (DBusPendingCall *pending);
DBUS_EXPORT
void dbus_pending_call_unref (DBusPendingCall *pending);
DBUS_EXPORT
dbus_bool_t dbus_pending_call_set_notify (DBusPendingCall *pending,
DBusPendingCallNotifyFunction function,
void *user_data,
DBusFreeFunction free_user_data);
DBUS_EXPORT
void dbus_pending_call_cancel (DBusPendingCall *pending);
DBUS_EXPORT
dbus_bool_t dbus_pending_call_get_completed (DBusPendingCall *pending);
DBUS_EXPORT
DBusMessage* dbus_pending_call_steal_reply (DBusPendingCall *pending);
DBUS_EXPORT
void dbus_pending_call_block (DBusPendingCall *pending);
DBUS_EXPORT
dbus_bool_t dbus_pending_call_allocate_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
void dbus_pending_call_free_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
dbus_bool_t dbus_pending_call_set_data (DBusPendingCall *pending,
dbus_int32_t slot,
void *data,
DBusFreeFunction free_data_func);
DBUS_EXPORT
void* dbus_pending_call_get_data (DBusPendingCall *pending,
dbus_int32_t slot);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_PENDING_CALL_H */

View File

@ -0,0 +1,479 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-protocol.h D-Bus protocol constants
*
* Copyright (C) 2002, 2003 CodeFactory AB
* Copyright (C) 2004, 2005 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef DBUS_PROTOCOL_H
#define DBUS_PROTOCOL_H
/* Don't include anything in here from anywhere else. It's
* intended for use by any random library.
*/
#ifdef __cplusplus
extern "C" {
#if 0
} /* avoids confusing emacs indentation */
#endif
#endif
/* Normally docs are in .c files, but there isn't a .c file for this. */
/**
* @defgroup DBusProtocol Protocol constants
* @ingroup DBus
*
* @brief Defines constants which are part of the D-Bus protocol
*
* This header is intended for use by any library, not only libdbus.
*
* @{
*/
/* Message byte order */
#define DBUS_LITTLE_ENDIAN ('l') /**< Code marking LSB-first byte order in the wire protocol. */
#define DBUS_BIG_ENDIAN ('B') /**< Code marking MSB-first byte order in the wire protocol. */
/** Protocol version. */
#define DBUS_MAJOR_PROTOCOL_VERSION 1
/** Type code that is never equal to a legitimate type code */
#define DBUS_TYPE_INVALID ((int) '\0')
/** #DBUS_TYPE_INVALID as a string literal instead of a int literal */
#define DBUS_TYPE_INVALID_AS_STRING "\0"
/* Primitive types */
/** Type code marking an 8-bit unsigned integer */
#define DBUS_TYPE_BYTE ((int) 'y')
/** #DBUS_TYPE_BYTE as a string literal instead of a int literal */
#define DBUS_TYPE_BYTE_AS_STRING "y"
/** Type code marking a boolean */
#define DBUS_TYPE_BOOLEAN ((int) 'b')
/** #DBUS_TYPE_BOOLEAN as a string literal instead of a int literal */
#define DBUS_TYPE_BOOLEAN_AS_STRING "b"
/** Type code marking a 16-bit signed integer */
#define DBUS_TYPE_INT16 ((int) 'n')
/** #DBUS_TYPE_INT16 as a string literal instead of a int literal */
#define DBUS_TYPE_INT16_AS_STRING "n"
/** Type code marking a 16-bit unsigned integer */
#define DBUS_TYPE_UINT16 ((int) 'q')
/** #DBUS_TYPE_UINT16 as a string literal instead of a int literal */
#define DBUS_TYPE_UINT16_AS_STRING "q"
/** Type code marking a 32-bit signed integer */
#define DBUS_TYPE_INT32 ((int) 'i')
/** #DBUS_TYPE_INT32 as a string literal instead of a int literal */
#define DBUS_TYPE_INT32_AS_STRING "i"
/** Type code marking a 32-bit unsigned integer */
#define DBUS_TYPE_UINT32 ((int) 'u')
/** #DBUS_TYPE_UINT32 as a string literal instead of a int literal */
#define DBUS_TYPE_UINT32_AS_STRING "u"
/** Type code marking a 64-bit signed integer */
#define DBUS_TYPE_INT64 ((int) 'x')
/** #DBUS_TYPE_INT64 as a string literal instead of a int literal */
#define DBUS_TYPE_INT64_AS_STRING "x"
/** Type code marking a 64-bit unsigned integer */
#define DBUS_TYPE_UINT64 ((int) 't')
/** #DBUS_TYPE_UINT64 as a string literal instead of a int literal */
#define DBUS_TYPE_UINT64_AS_STRING "t"
/** Type code marking an 8-byte double in IEEE 754 format */
#define DBUS_TYPE_DOUBLE ((int) 'd')
/** #DBUS_TYPE_DOUBLE as a string literal instead of a int literal */
#define DBUS_TYPE_DOUBLE_AS_STRING "d"
/** Type code marking a UTF-8 encoded, nul-terminated Unicode string */
#define DBUS_TYPE_STRING ((int) 's')
/** #DBUS_TYPE_STRING as a string literal instead of a int literal */
#define DBUS_TYPE_STRING_AS_STRING "s"
/** Type code marking a D-Bus object path */
#define DBUS_TYPE_OBJECT_PATH ((int) 'o')
/** #DBUS_TYPE_OBJECT_PATH as a string literal instead of a int literal */
#define DBUS_TYPE_OBJECT_PATH_AS_STRING "o"
/** Type code marking a D-Bus type signature */
#define DBUS_TYPE_SIGNATURE ((int) 'g')
/** #DBUS_TYPE_SIGNATURE as a string literal instead of a int literal */
#define DBUS_TYPE_SIGNATURE_AS_STRING "g"
/** Type code marking a unix file descriptor */
#define DBUS_TYPE_UNIX_FD ((int) 'h')
/** #DBUS_TYPE_UNIX_FD as a string literal instead of a int literal */
#define DBUS_TYPE_UNIX_FD_AS_STRING "h"
/* Compound types */
/** Type code marking a D-Bus array type */
#define DBUS_TYPE_ARRAY ((int) 'a')
/** #DBUS_TYPE_ARRAY as a string literal instead of a int literal */
#define DBUS_TYPE_ARRAY_AS_STRING "a"
/** Type code marking a D-Bus variant type */
#define DBUS_TYPE_VARIANT ((int) 'v')
/** #DBUS_TYPE_VARIANT as a string literal instead of a int literal */
#define DBUS_TYPE_VARIANT_AS_STRING "v"
/** STRUCT and DICT_ENTRY are sort of special since their codes can't
* appear in a type string, instead
* DBUS_STRUCT_BEGIN_CHAR/DBUS_DICT_ENTRY_BEGIN_CHAR have to appear
*/
/** Type code used to represent a struct; however, this type code does not appear
* in type signatures, instead #DBUS_STRUCT_BEGIN_CHAR and #DBUS_STRUCT_END_CHAR will
* appear in a signature.
*/
#define DBUS_TYPE_STRUCT ((int) 'r')
/** #DBUS_TYPE_STRUCT as a string literal instead of a int literal */
#define DBUS_TYPE_STRUCT_AS_STRING "r"
/** Type code used to represent a dict entry; however, this type code does not appear
* in type signatures, instead #DBUS_DICT_ENTRY_BEGIN_CHAR and #DBUS_DICT_ENTRY_END_CHAR will
* appear in a signature.
*/
#define DBUS_TYPE_DICT_ENTRY ((int) 'e')
/** #DBUS_TYPE_DICT_ENTRY as a string literal instead of a int literal */
#define DBUS_TYPE_DICT_ENTRY_AS_STRING "e"
/** Does not include #DBUS_TYPE_INVALID, #DBUS_STRUCT_BEGIN_CHAR, #DBUS_STRUCT_END_CHAR,
* #DBUS_DICT_ENTRY_BEGIN_CHAR, or #DBUS_DICT_ENTRY_END_CHAR - i.e. it is the number of
* valid types, not the number of distinct characters that may appear in a type signature.
*/
#define DBUS_NUMBER_OF_TYPES (16)
/* characters other than typecodes that appear in type signatures */
/** Code marking the start of a struct type in a type signature */
#define DBUS_STRUCT_BEGIN_CHAR ((int) '(')
/** #DBUS_STRUCT_BEGIN_CHAR as a string literal instead of a int literal */
#define DBUS_STRUCT_BEGIN_CHAR_AS_STRING "("
/** Code marking the end of a struct type in a type signature */
#define DBUS_STRUCT_END_CHAR ((int) ')')
/** #DBUS_STRUCT_END_CHAR a string literal instead of a int literal */
#define DBUS_STRUCT_END_CHAR_AS_STRING ")"
/** Code marking the start of a dict entry type in a type signature */
#define DBUS_DICT_ENTRY_BEGIN_CHAR ((int) '{')
/** #DBUS_DICT_ENTRY_BEGIN_CHAR as a string literal instead of a int literal */
#define DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING "{"
/** Code marking the end of a dict entry type in a type signature */
#define DBUS_DICT_ENTRY_END_CHAR ((int) '}')
/** #DBUS_DICT_ENTRY_END_CHAR as a string literal instead of a int literal */
#define DBUS_DICT_ENTRY_END_CHAR_AS_STRING "}"
/** Max length in bytes of a bus name, interface, or member (not object
* path, paths are unlimited). This is limited because lots of stuff
* is O(n) in this number, plus it would be obnoxious to type in a
* paragraph-long method name so most likely something like that would
* be an exploit.
*/
#define DBUS_MAXIMUM_NAME_LENGTH 255
/** This one is 255 so it fits in a byte */
#define DBUS_MAXIMUM_SIGNATURE_LENGTH 255
/** Max length of a match rule string; to keep people from hosing the
* daemon with some huge rule
*/
#define DBUS_MAXIMUM_MATCH_RULE_LENGTH 1024
/** Max arg number you can match on in a match rule, e.g.
* arg0='hello' is OK, arg3489720987='hello' is not
*/
#define DBUS_MAXIMUM_MATCH_RULE_ARG_NUMBER 63
/** Max length of a marshaled array in bytes (64M, 2^26) We use signed
* int for lengths so must be INT_MAX or less. We need something a
* bit smaller than INT_MAX because the array is inside a message with
* header info, etc. so an INT_MAX array wouldn't allow the message
* overhead. The 64M number is an attempt at a larger number than
* we'd reasonably ever use, but small enough that your bus would chew
* through it fairly quickly without locking up forever. If you have
* data that's likely to be larger than this, you should probably be
* sending it in multiple incremental messages anyhow.
*/
#define DBUS_MAXIMUM_ARRAY_LENGTH (67108864)
/** Number of bits you need in an unsigned to store the max array size */
#define DBUS_MAXIMUM_ARRAY_LENGTH_BITS 26
/** The maximum total message size including header and body; similar
* rationale to max array size.
*/
#define DBUS_MAXIMUM_MESSAGE_LENGTH (DBUS_MAXIMUM_ARRAY_LENGTH * 2)
/** Number of bits you need in an unsigned to store the max message size */
#define DBUS_MAXIMUM_MESSAGE_LENGTH_BITS 27
/** The maximum total number of unix fds in a message. Similar
* rationale as DBUS_MAXIMUM_MESSAGE_LENGTH. However we divide by four
* given that one fd is an int and hence at least 32 bits.
*/
#define DBUS_MAXIMUM_MESSAGE_UNIX_FDS (DBUS_MAXIMUM_MESSAGE_LENGTH/4)
/** Number of bits you need in an unsigned to store the max message unix fds */
#define DBUS_MAXIMUM_MESSAGE_UNIX_FDS_BITS (DBUS_MAXIMUM_MESSAGE_LENGTH_BITS-2)
/** Depth of recursion in the type tree. This is automatically limited
* to DBUS_MAXIMUM_SIGNATURE_LENGTH since you could only have an array
* of array of array of ... that fit in the max signature. But that's
* probably a bit too large.
*/
#define DBUS_MAXIMUM_TYPE_RECURSION_DEPTH 32
/* Types of message */
/** This value is never a valid message type, see dbus_message_get_type() */
#define DBUS_MESSAGE_TYPE_INVALID 0
/** Message type of a method call message, see dbus_message_get_type() */
#define DBUS_MESSAGE_TYPE_METHOD_CALL 1
/** Message type of a method return message, see dbus_message_get_type() */
#define DBUS_MESSAGE_TYPE_METHOD_RETURN 2
/** Message type of an error reply message, see dbus_message_get_type() */
#define DBUS_MESSAGE_TYPE_ERROR 3
/** Message type of a signal message, see dbus_message_get_type() */
#define DBUS_MESSAGE_TYPE_SIGNAL 4
#define DBUS_NUM_MESSAGE_TYPES 5
/* Header flags */
/** If set, this flag means that the sender of a message does not care about getting
* a reply, so the recipient need not send one. See dbus_message_set_no_reply().
*/
#define DBUS_HEADER_FLAG_NO_REPLY_EXPECTED 0x1
/**
* If set, this flag means that even if the message bus knows how to start an owner for
* the destination bus name (see dbus_message_set_destination()), it should not
* do so. If this flag is not set, the bus may launch a program to process the
* message.
*/
#define DBUS_HEADER_FLAG_NO_AUTO_START 0x2
/**
* If set on a method call, this flag means that the caller is prepared to
* wait for interactive authorization.
*/
#define DBUS_HEADER_FLAG_ALLOW_INTERACTIVE_AUTHORIZATION 0x4
/* Header fields */
/** Not equal to any valid header field code */
#define DBUS_HEADER_FIELD_INVALID 0
/** Header field code for the path - the path is the object emitting a signal or the object receiving a method call.
* See dbus_message_set_path().
*/
#define DBUS_HEADER_FIELD_PATH 1
/** Header field code for the interface containing a member (method or signal).
* See dbus_message_set_interface().
*/
#define DBUS_HEADER_FIELD_INTERFACE 2
/** Header field code for a member (method or signal). See dbus_message_set_member(). */
#define DBUS_HEADER_FIELD_MEMBER 3
/** Header field code for an error name (found in #DBUS_MESSAGE_TYPE_ERROR messages).
* See dbus_message_set_error_name().
*/
#define DBUS_HEADER_FIELD_ERROR_NAME 4
/** Header field code for a reply serial, used to match a #DBUS_MESSAGE_TYPE_METHOD_RETURN message with the
* message that it's a reply to. See dbus_message_set_reply_serial().
*/
#define DBUS_HEADER_FIELD_REPLY_SERIAL 5
/**
* Header field code for the destination bus name of a message. See dbus_message_set_destination().
*/
#define DBUS_HEADER_FIELD_DESTINATION 6
/**
* Header field code for the sender of a message; usually initialized by the message bus.
* See dbus_message_set_sender().
*/
#define DBUS_HEADER_FIELD_SENDER 7
/**
* Header field code for the type signature of a message.
*/
#define DBUS_HEADER_FIELD_SIGNATURE 8
/**
* Header field code for the number of unix file descriptors associated
* with this message.
*/
#define DBUS_HEADER_FIELD_UNIX_FDS 9
/**
* Value of the highest-numbered header field code, can be used to determine
* the size of an array indexed by header field code. Remember though
* that unknown codes must be ignored, so check for that before
* indexing the array.
*/
#define DBUS_HEADER_FIELD_LAST DBUS_HEADER_FIELD_UNIX_FDS
/** Header format is defined as a signature:
* byte byte order
* byte message type ID
* byte flags
* byte protocol version
* uint32 body length
* uint32 serial
* array of struct (byte,variant) (field name, value)
*
* The length of the header can be computed as the
* fixed size of the initial data, plus the length of
* the array at the end, plus padding to an 8-boundary.
*/
#define DBUS_HEADER_SIGNATURE \
DBUS_TYPE_BYTE_AS_STRING \
DBUS_TYPE_BYTE_AS_STRING \
DBUS_TYPE_BYTE_AS_STRING \
DBUS_TYPE_BYTE_AS_STRING \
DBUS_TYPE_UINT32_AS_STRING \
DBUS_TYPE_UINT32_AS_STRING \
DBUS_TYPE_ARRAY_AS_STRING \
DBUS_STRUCT_BEGIN_CHAR_AS_STRING \
DBUS_TYPE_BYTE_AS_STRING \
DBUS_TYPE_VARIANT_AS_STRING \
DBUS_STRUCT_END_CHAR_AS_STRING
/**
* The smallest header size that can occur. (It won't be valid due to
* missing required header fields.) This is 4 bytes, two uint32, an
* array length. This isn't any kind of resource limit, just the
* necessary/logical outcome of the header signature.
*/
#define DBUS_MINIMUM_HEADER_SIZE 16
/* Errors */
/* WARNING these get autoconverted to an enum in dbus-glib.h. Thus,
* if you change the order it breaks the ABI. Keep them in order.
* Also, don't change the formatting since that will break the sed
* script.
*/
/** A generic error; "something went wrong" - see the error message for more. */
#define DBUS_ERROR_FAILED "org.freedesktop.DBus.Error.Failed"
/** There was not enough memory to complete an operation. */
#define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
/** The bus doesn't know how to launch a service to supply the bus name you wanted. */
#define DBUS_ERROR_SERVICE_UNKNOWN "org.freedesktop.DBus.Error.ServiceUnknown"
/** The bus name you referenced doesn't exist (i.e. no application owns it). */
#define DBUS_ERROR_NAME_HAS_NO_OWNER "org.freedesktop.DBus.Error.NameHasNoOwner"
/** No reply to a message expecting one, usually means a timeout occurred. */
#define DBUS_ERROR_NO_REPLY "org.freedesktop.DBus.Error.NoReply"
/** Something went wrong reading or writing to a socket, for example. */
#define DBUS_ERROR_IO_ERROR "org.freedesktop.DBus.Error.IOError"
/** A D-Bus bus address was malformed. */
#define DBUS_ERROR_BAD_ADDRESS "org.freedesktop.DBus.Error.BadAddress"
/** Requested operation isn't supported (like ENOSYS on UNIX). */
#define DBUS_ERROR_NOT_SUPPORTED "org.freedesktop.DBus.Error.NotSupported"
/** Some limited resource is exhausted. */
#define DBUS_ERROR_LIMITS_EXCEEDED "org.freedesktop.DBus.Error.LimitsExceeded"
/** Security restrictions don't allow doing what you're trying to do. */
#define DBUS_ERROR_ACCESS_DENIED "org.freedesktop.DBus.Error.AccessDenied"
/** Authentication didn't work. */
#define DBUS_ERROR_AUTH_FAILED "org.freedesktop.DBus.Error.AuthFailed"
/** Unable to connect to server (probably caused by ECONNREFUSED on a socket). */
#define DBUS_ERROR_NO_SERVER "org.freedesktop.DBus.Error.NoServer"
/** Certain timeout errors, possibly ETIMEDOUT on a socket.
* Note that #DBUS_ERROR_NO_REPLY is used for message reply timeouts.
* @warning this is confusingly-named given that #DBUS_ERROR_TIMED_OUT also exists. We can't fix
* it for compatibility reasons so just be careful.
*/
#define DBUS_ERROR_TIMEOUT "org.freedesktop.DBus.Error.Timeout"
/** No network access (probably ENETUNREACH on a socket). */
#define DBUS_ERROR_NO_NETWORK "org.freedesktop.DBus.Error.NoNetwork"
/** Can't bind a socket since its address is in use (i.e. EADDRINUSE). */
#define DBUS_ERROR_ADDRESS_IN_USE "org.freedesktop.DBus.Error.AddressInUse"
/** The connection is disconnected and you're trying to use it. */
#define DBUS_ERROR_DISCONNECTED "org.freedesktop.DBus.Error.Disconnected"
/** Invalid arguments passed to a method call. */
#define DBUS_ERROR_INVALID_ARGS "org.freedesktop.DBus.Error.InvalidArgs"
/** Missing file. */
#define DBUS_ERROR_FILE_NOT_FOUND "org.freedesktop.DBus.Error.FileNotFound"
/** Existing file and the operation you're using does not silently overwrite. */
#define DBUS_ERROR_FILE_EXISTS "org.freedesktop.DBus.Error.FileExists"
/** Method name you invoked isn't known by the object you invoked it on. */
#define DBUS_ERROR_UNKNOWN_METHOD "org.freedesktop.DBus.Error.UnknownMethod"
/** Object you invoked a method on isn't known. */
#define DBUS_ERROR_UNKNOWN_OBJECT "org.freedesktop.DBus.Error.UnknownObject"
/** Interface you invoked a method on isn't known by the object. */
#define DBUS_ERROR_UNKNOWN_INTERFACE "org.freedesktop.DBus.Error.UnknownInterface"
/** Property you tried to access isn't known by the object. */
#define DBUS_ERROR_UNKNOWN_PROPERTY "org.freedesktop.DBus.Error.UnknownProperty"
/** Property you tried to set is read-only. */
#define DBUS_ERROR_PROPERTY_READ_ONLY "org.freedesktop.DBus.Error.PropertyReadOnly"
/** Certain timeout errors, e.g. while starting a service.
* @warning this is confusingly-named given that #DBUS_ERROR_TIMEOUT also exists. We can't fix
* it for compatibility reasons so just be careful.
*/
#define DBUS_ERROR_TIMED_OUT "org.freedesktop.DBus.Error.TimedOut"
/** Tried to remove or modify a match rule that didn't exist. */
#define DBUS_ERROR_MATCH_RULE_NOT_FOUND "org.freedesktop.DBus.Error.MatchRuleNotFound"
/** The match rule isn't syntactically valid. */
#define DBUS_ERROR_MATCH_RULE_INVALID "org.freedesktop.DBus.Error.MatchRuleInvalid"
/** While starting a new process, the exec() call failed. */
#define DBUS_ERROR_SPAWN_EXEC_FAILED "org.freedesktop.DBus.Error.Spawn.ExecFailed"
/** While starting a new process, the fork() call failed. */
#define DBUS_ERROR_SPAWN_FORK_FAILED "org.freedesktop.DBus.Error.Spawn.ForkFailed"
/** While starting a new process, the child exited with a status code. */
#define DBUS_ERROR_SPAWN_CHILD_EXITED "org.freedesktop.DBus.Error.Spawn.ChildExited"
/** While starting a new process, the child exited on a signal. */
#define DBUS_ERROR_SPAWN_CHILD_SIGNALED "org.freedesktop.DBus.Error.Spawn.ChildSignaled"
/** While starting a new process, something went wrong. */
#define DBUS_ERROR_SPAWN_FAILED "org.freedesktop.DBus.Error.Spawn.Failed"
/** We failed to setup the environment correctly. */
#define DBUS_ERROR_SPAWN_SETUP_FAILED "org.freedesktop.DBus.Error.Spawn.FailedToSetup"
/** We failed to setup the config parser correctly. */
#define DBUS_ERROR_SPAWN_CONFIG_INVALID "org.freedesktop.DBus.Error.Spawn.ConfigInvalid"
/** Bus name was not valid. */
#define DBUS_ERROR_SPAWN_SERVICE_INVALID "org.freedesktop.DBus.Error.Spawn.ServiceNotValid"
/** Service file not found in system-services directory. */
#define DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND "org.freedesktop.DBus.Error.Spawn.ServiceNotFound"
/** Permissions are incorrect on the setuid helper. */
#define DBUS_ERROR_SPAWN_PERMISSIONS_INVALID "org.freedesktop.DBus.Error.Spawn.PermissionsInvalid"
/** Service file invalid (Name, User or Exec missing). */
#define DBUS_ERROR_SPAWN_FILE_INVALID "org.freedesktop.DBus.Error.Spawn.FileInvalid"
/** Tried to get a UNIX process ID and it wasn't available. */
#define DBUS_ERROR_SPAWN_NO_MEMORY "org.freedesktop.DBus.Error.Spawn.NoMemory"
/** Tried to get a UNIX process ID and it wasn't available. */
#define DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN "org.freedesktop.DBus.Error.UnixProcessIdUnknown"
/** A type signature is not valid. */
#define DBUS_ERROR_INVALID_SIGNATURE "org.freedesktop.DBus.Error.InvalidSignature"
/** A file contains invalid syntax or is otherwise broken. */
#define DBUS_ERROR_INVALID_FILE_CONTENT "org.freedesktop.DBus.Error.InvalidFileContent"
/** Asked for SELinux security context and it wasn't available. */
#define DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown"
/** Asked for ADT audit data and it wasn't available. */
#define DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN "org.freedesktop.DBus.Error.AdtAuditDataUnknown"
/** There's already an object with the requested object path. */
#define DBUS_ERROR_OBJECT_PATH_IN_USE "org.freedesktop.DBus.Error.ObjectPathInUse"
/** The message meta data does not match the payload. e.g. expected
number of file descriptors were not sent over the socket this message was received on. */
#define DBUS_ERROR_INCONSISTENT_MESSAGE "org.freedesktop.DBus.Error.InconsistentMessage"
/** The message is not allowed without performing interactive authorization,
* but could have succeeded if an interactive authorization step was
* allowed. */
#define DBUS_ERROR_INTERACTIVE_AUTHORIZATION_REQUIRED "org.freedesktop.DBus.Error.InteractiveAuthorizationRequired"
/* XML introspection format */
/** XML namespace of the introspection format version 1.0 */
#define DBUS_INTROSPECT_1_0_XML_NAMESPACE "http://www.freedesktop.org/standards/dbus"
/** XML public identifier of the introspection format version 1.0 */
#define DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
/** XML system identifier of the introspection format version 1.0 */
#define DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"
/** XML document type declaration of the introspection format version 1.0 */
#define DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE "<!DOCTYPE node PUBLIC \"" DBUS_INTROSPECT_1_0_XML_PUBLIC_IDENTIFIER "\"\n\"" DBUS_INTROSPECT_1_0_XML_SYSTEM_IDENTIFIER "\">\n"
/** @} */
#ifdef __cplusplus
#if 0
{ /* avoids confusing emacs indentation */
#endif
}
#endif
#endif /* DBUS_PROTOCOL_H */

View File

@ -0,0 +1,106 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-server.h DBusServer object
*
* Copyright (C) 2002, 2003 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_SERVER_H
#define DBUS_SERVER_H
#include <dbus/dbus-errors.h>
#include <dbus/dbus-message.h>
#include <dbus/dbus-connection.h>
#include <dbus/dbus-protocol.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusServer
* @{
*/
typedef struct DBusServer DBusServer;
/** Called when a new connection to the server is available. Must reference and save the new
* connection, or close the new connection. Set with dbus_server_set_new_connection_function().
*/
typedef void (* DBusNewConnectionFunction) (DBusServer *server,
DBusConnection *new_connection,
void *data);
DBUS_EXPORT
DBusServer* dbus_server_listen (const char *address,
DBusError *error);
DBUS_EXPORT
DBusServer* dbus_server_ref (DBusServer *server);
DBUS_EXPORT
void dbus_server_unref (DBusServer *server);
DBUS_EXPORT
void dbus_server_disconnect (DBusServer *server);
DBUS_EXPORT
dbus_bool_t dbus_server_get_is_connected (DBusServer *server);
DBUS_EXPORT
char* dbus_server_get_address (DBusServer *server);
DBUS_EXPORT
char* dbus_server_get_id (DBusServer *server);
DBUS_EXPORT
void dbus_server_set_new_connection_function (DBusServer *server,
DBusNewConnectionFunction function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_server_set_watch_functions (DBusServer *server,
DBusAddWatchFunction add_function,
DBusRemoveWatchFunction remove_function,
DBusWatchToggledFunction toggled_function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_server_set_timeout_functions (DBusServer *server,
DBusAddTimeoutFunction add_function,
DBusRemoveTimeoutFunction remove_function,
DBusTimeoutToggledFunction toggled_function,
void *data,
DBusFreeFunction free_data_function);
DBUS_EXPORT
dbus_bool_t dbus_server_set_auth_mechanisms (DBusServer *server,
const char **mechanisms);
DBUS_EXPORT
dbus_bool_t dbus_server_allocate_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
void dbus_server_free_data_slot (dbus_int32_t *slot_p);
DBUS_EXPORT
dbus_bool_t dbus_server_set_data (DBusServer *server,
int slot,
void *data,
DBusFreeFunction free_data_func);
DBUS_EXPORT
void* dbus_server_get_data (DBusServer *server,
int slot);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_SERVER_H */

View File

@ -0,0 +1,131 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-shared.h Stuff used by both dbus/dbus.h low-level and C/C++ binding APIs
*
* Copyright (C) 2004 Red Hat, Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef DBUS_SHARED_H
#define DBUS_SHARED_H
/* Don't include anything in here from anywhere else. It's
* intended for use by any random library.
*/
#ifdef __cplusplus
extern "C" {
#if 0
} /* avoids confusing emacs indentation */
#endif
#endif
/* Normally docs are in .c files, but there isn't a .c file for this. */
/**
* @defgroup DBusShared Shared constants
* @ingroup DBus
*
* @brief Shared header included by both libdbus and C/C++ bindings such as the GLib bindings.
*
* Usually a C/C++ binding such as the GLib or Qt binding won't want to include dbus.h in its
* public headers. However, a few constants and macros may be useful to include; those are
* found here and in dbus-protocol.h
*
* @{
*/
/**
* Well-known bus types. See dbus_bus_get().
*/
typedef enum
{
DBUS_BUS_SESSION, /**< The login session bus */
DBUS_BUS_SYSTEM, /**< The systemwide bus */
DBUS_BUS_STARTER /**< The bus that started us, if any */
} DBusBusType;
/**
* Results that a message handler can return.
*/
typedef enum
{
DBUS_HANDLER_RESULT_HANDLED, /**< Message has had its effect - no need to run more handlers. */
DBUS_HANDLER_RESULT_NOT_YET_HANDLED, /**< Message has not had any effect - see if other handlers want it. */
DBUS_HANDLER_RESULT_NEED_MEMORY /**< Need more memory in order to return #DBUS_HANDLER_RESULT_HANDLED or #DBUS_HANDLER_RESULT_NOT_YET_HANDLED. Please try again later with more memory. */
} DBusHandlerResult;
/* Bus names */
/** The bus name used to talk to the bus itself. */
#define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
/* Paths */
/** The object path used to talk to the bus itself. */
#define DBUS_PATH_DBUS "/org/freedesktop/DBus"
/** The object path used in local/in-process-generated messages. */
#define DBUS_PATH_LOCAL "/org/freedesktop/DBus/Local"
/* Interfaces, these #define don't do much other than
* catch typos at compile time
*/
/** The interface exported by the object with #DBUS_SERVICE_DBUS and #DBUS_PATH_DBUS */
#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
/** The interface supported by introspectable objects */
#define DBUS_INTERFACE_INTROSPECTABLE "org.freedesktop.DBus.Introspectable"
/** The interface supported by objects with properties */
#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties"
/** The interface supported by most dbus peers */
#define DBUS_INTERFACE_PEER "org.freedesktop.DBus.Peer"
/** This is a special interface whose methods can only be invoked
* by the local implementation (messages from remote apps aren't
* allowed to specify this interface).
*/
#define DBUS_INTERFACE_LOCAL "org.freedesktop.DBus.Local"
/* Owner flags */
#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT 0x1 /**< Allow another service to become the primary owner if requested */
#define DBUS_NAME_FLAG_REPLACE_EXISTING 0x2 /**< Request to replace the current primary owner */
#define DBUS_NAME_FLAG_DO_NOT_QUEUE 0x4 /**< If we can not become the primary owner do not place us in the queue */
/* Replies to request for a name */
#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 /**< Service has become the primary owner of the requested name */
#define DBUS_REQUEST_NAME_REPLY_IN_QUEUE 2 /**< Service could not become the primary owner and has been placed in the queue */
#define DBUS_REQUEST_NAME_REPLY_EXISTS 3 /**< Service is already in the queue */
#define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4 /**< Service is already the primary owner */
/* Replies to releasing a name */
#define DBUS_RELEASE_NAME_REPLY_RELEASED 1 /**< Service was released from the given name */
#define DBUS_RELEASE_NAME_REPLY_NON_EXISTENT 2 /**< The given name does not exist on the bus */
#define DBUS_RELEASE_NAME_REPLY_NOT_OWNER 3 /**< Service is not an owner of the given name */
/* Replies to service starts */
#define DBUS_START_REPLY_SUCCESS 1 /**< Service was auto started */
#define DBUS_START_REPLY_ALREADY_RUNNING 2 /**< Service was already running */
/** @} */
#ifdef __cplusplus
#if 0
{ /* avoids confusing emacs indentation */
#endif
}
#endif
#endif /* DBUS_SHARED_H */

View File

@ -0,0 +1,95 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-signatures.h utility functions for D-Bus types
*
* Copyright (C) 2005 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_SIGNATURES_H
#define DBUS_SIGNATURES_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-errors.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusSignature
* @{
*/
/**
* DBusSignatureIter struct; contains no public fields
*/
typedef struct
{
void *dummy1; /**< Don't use this */
void *dummy2; /**< Don't use this */
dbus_uint32_t dummy8; /**< Don't use this */
int dummy12; /**< Don't use this */
int dummy17; /**< Don't use this */
} DBusSignatureIter;
DBUS_EXPORT
void dbus_signature_iter_init (DBusSignatureIter *iter,
const char *signature);
DBUS_EXPORT
int dbus_signature_iter_get_current_type (const DBusSignatureIter *iter);
DBUS_EXPORT
char * dbus_signature_iter_get_signature (const DBusSignatureIter *iter);
DBUS_EXPORT
int dbus_signature_iter_get_element_type (const DBusSignatureIter *iter);
DBUS_EXPORT
dbus_bool_t dbus_signature_iter_next (DBusSignatureIter *iter);
DBUS_EXPORT
void dbus_signature_iter_recurse (const DBusSignatureIter *iter,
DBusSignatureIter *subiter);
DBUS_EXPORT
dbus_bool_t dbus_signature_validate (const char *signature,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_signature_validate_single (const char *signature,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_type_is_valid (int typecode);
DBUS_EXPORT
dbus_bool_t dbus_type_is_basic (int typecode);
DBUS_EXPORT
dbus_bool_t dbus_type_is_container (int typecode);
DBUS_EXPORT
dbus_bool_t dbus_type_is_fixed (int typecode);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_SIGNATURE_H */

View File

@ -0,0 +1,58 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-syntax.h - utility functions for strings with special syntax
*
* Author: Simon McVittie <simon.mcvittie@collabora.co.uk>
* Copyright © 2011 Nokia Corporation
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_SYNTAX_H
#define DBUS_SYNTAX_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
#include <dbus/dbus-errors.h>
DBUS_BEGIN_DECLS
DBUS_EXPORT
dbus_bool_t dbus_validate_path (const char *path,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_validate_interface (const char *name,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_validate_member (const char *name,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_validate_error_name (const char *name,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_validate_bus_name (const char *name,
DBusError *error);
DBUS_EXPORT
dbus_bool_t dbus_validate_utf8 (const char *alleged_utf8,
DBusError *error);
DBUS_END_DECLS
#endif /* multiple-inclusion guard */

View File

@ -0,0 +1,189 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-threads.h D-Bus threads handling
*
* Copyright (C) 2002 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_THREADS_H
#define DBUS_THREADS_H
#include <dbus/dbus-macros.h>
#include <dbus/dbus-types.h>
DBUS_BEGIN_DECLS
/**
* @addtogroup DBusThreads
* @{
*/
/** An opaque mutex type provided by the #DBusThreadFunctions implementation installed by dbus_threads_init(). */
typedef struct DBusMutex DBusMutex;
/** An opaque condition variable type provided by the #DBusThreadFunctions implementation installed by dbus_threads_init(). */
typedef struct DBusCondVar DBusCondVar;
/** Deprecated, provide DBusRecursiveMutexNewFunction instead. */
typedef DBusMutex* (* DBusMutexNewFunction) (void);
/** Deprecated, provide DBusRecursiveMutexFreeFunction instead. */
typedef void (* DBusMutexFreeFunction) (DBusMutex *mutex);
/** Deprecated, provide DBusRecursiveMutexLockFunction instead. Return value is lock success, but gets ignored in practice. */
typedef dbus_bool_t (* DBusMutexLockFunction) (DBusMutex *mutex);
/** Deprecated, provide DBusRecursiveMutexUnlockFunction instead. Return value is unlock success, but gets ignored in practice. */
typedef dbus_bool_t (* DBusMutexUnlockFunction) (DBusMutex *mutex);
/** Creates a new recursively-lockable mutex, or returns #NULL if not
* enough memory. Can only fail due to lack of memory. Found in
* #DBusThreadFunctions. Do not just use PTHREAD_MUTEX_RECURSIVE for
* this, because it does not save/restore the recursion count when
* waiting on a condition. libdbus requires the Java-style behavior
* where the mutex is fully unlocked to wait on a condition.
*/
typedef DBusMutex* (* DBusRecursiveMutexNewFunction) (void);
/** Frees a recursively-lockable mutex. Found in #DBusThreadFunctions.
*/
typedef void (* DBusRecursiveMutexFreeFunction) (DBusMutex *mutex);
/** Locks a recursively-lockable mutex. Found in #DBusThreadFunctions.
* Can only fail due to lack of memory.
*/
typedef void (* DBusRecursiveMutexLockFunction) (DBusMutex *mutex);
/** Unlocks a recursively-lockable mutex. Found in #DBusThreadFunctions.
* Can only fail due to lack of memory.
*/
typedef void (* DBusRecursiveMutexUnlockFunction) (DBusMutex *mutex);
/** Creates a new condition variable. Found in #DBusThreadFunctions.
* Can only fail (returning #NULL) due to lack of memory.
*/
typedef DBusCondVar* (* DBusCondVarNewFunction) (void);
/** Frees a condition variable. Found in #DBusThreadFunctions.
*/
typedef void (* DBusCondVarFreeFunction) (DBusCondVar *cond);
/** Waits on a condition variable. Found in
* #DBusThreadFunctions. Must work with either a recursive or
* nonrecursive mutex, whichever the thread implementation
* provides. Note that PTHREAD_MUTEX_RECURSIVE does not work with
* condition variables (does not save/restore the recursion count) so
* don't try using simply pthread_cond_wait() and a
* PTHREAD_MUTEX_RECURSIVE to implement this, it won't work right.
*
* Has no error conditions. Must succeed if it returns.
*/
typedef void (* DBusCondVarWaitFunction) (DBusCondVar *cond,
DBusMutex *mutex);
/** Waits on a condition variable with a timeout. Found in
* #DBusThreadFunctions. Returns #TRUE if the wait did not
* time out, and #FALSE if it did.
*
* Has no error conditions. Must succeed if it returns.
*/
typedef dbus_bool_t (* DBusCondVarWaitTimeoutFunction) (DBusCondVar *cond,
DBusMutex *mutex,
int timeout_milliseconds);
/** Wakes one waiting thread on a condition variable. Found in #DBusThreadFunctions.
*
* Has no error conditions. Must succeed if it returns.
*/
typedef void (* DBusCondVarWakeOneFunction) (DBusCondVar *cond);
/** Wakes all waiting threads on a condition variable. Found in #DBusThreadFunctions.
*
* Has no error conditions. Must succeed if it returns.
*/
typedef void (* DBusCondVarWakeAllFunction) (DBusCondVar *cond);
/**
* Flags indicating which functions are present in #DBusThreadFunctions. Used to allow
* the library to detect older callers of dbus_threads_init() if new possible functions
* are added to #DBusThreadFunctions.
*/
typedef enum
{
DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK = 1 << 0,
DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK = 1 << 1,
DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK = 1 << 2,
DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK = 1 << 3,
DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK = 1 << 4,
DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK = 1 << 5,
DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK = 1 << 6,
DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK = 1 << 7,
DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK = 1 << 8,
DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK = 1 << 9,
DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_NEW_MASK = 1 << 10,
DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_FREE_MASK = 1 << 11,
DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_LOCK_MASK = 1 << 12,
DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_UNLOCK_MASK = 1 << 13,
DBUS_THREAD_FUNCTIONS_ALL_MASK = (1 << 14) - 1
} DBusThreadFunctionsMask;
/**
* Functions that must be implemented to make the D-Bus library
* thread-aware.
*
* If you supply both recursive and non-recursive mutexes,
* libdbus will use the non-recursive version for condition variables,
* and the recursive version in other contexts.
*
* The condition variable functions have to work with nonrecursive
* mutexes if you provide those, or with recursive mutexes if you
* don't.
*/
typedef struct
{
unsigned int mask; /**< Mask indicating which functions are present. */
DBusMutexNewFunction mutex_new; /**< Function to create a mutex; optional and deprecated. */
DBusMutexFreeFunction mutex_free; /**< Function to free a mutex; optional and deprecated. */
DBusMutexLockFunction mutex_lock; /**< Function to lock a mutex; optional and deprecated. */
DBusMutexUnlockFunction mutex_unlock; /**< Function to unlock a mutex; optional and deprecated. */
DBusCondVarNewFunction condvar_new; /**< Function to create a condition variable */
DBusCondVarFreeFunction condvar_free; /**< Function to free a condition variable */
DBusCondVarWaitFunction condvar_wait; /**< Function to wait on a condition */
DBusCondVarWaitTimeoutFunction condvar_wait_timeout; /**< Function to wait on a condition with a timeout */
DBusCondVarWakeOneFunction condvar_wake_one; /**< Function to wake one thread waiting on the condition */
DBusCondVarWakeAllFunction condvar_wake_all; /**< Function to wake all threads waiting on the condition */
DBusRecursiveMutexNewFunction recursive_mutex_new; /**< Function to create a recursive mutex */
DBusRecursiveMutexFreeFunction recursive_mutex_free; /**< Function to free a recursive mutex */
DBusRecursiveMutexLockFunction recursive_mutex_lock; /**< Function to lock a recursive mutex */
DBusRecursiveMutexUnlockFunction recursive_mutex_unlock; /**< Function to unlock a recursive mutex */
void (* padding1) (void); /**< Reserved for future expansion */
void (* padding2) (void); /**< Reserved for future expansion */
void (* padding3) (void); /**< Reserved for future expansion */
void (* padding4) (void); /**< Reserved for future expansion */
} DBusThreadFunctions;
DBUS_EXPORT
dbus_bool_t dbus_threads_init (const DBusThreadFunctions *functions);
DBUS_EXPORT
dbus_bool_t dbus_threads_init_default (void);
/** @} */
DBUS_END_DECLS
#endif /* DBUS_THREADS_H */

View File

@ -0,0 +1,156 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-types.h types such as dbus_bool_t
*
* Copyright (C) 2002 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif
#ifndef DBUS_TYPES_H
#define DBUS_TYPES_H
#include <stddef.h>
#include <dbus/dbus-arch-deps.h>
typedef dbus_uint32_t dbus_unichar_t;
/* boolean size must be fixed at 4 bytes due to wire protocol! */
typedef dbus_uint32_t dbus_bool_t;
/* Normally docs are in .c files, but there isn't a .c file for this. */
/**
* @defgroup DBusTypes Basic types
* @ingroup DBus
* @brief dbus_bool_t, dbus_int32_t, etc.
*
* Typedefs for common primitive types.
*
* @{
*/
/**
* @typedef dbus_bool_t
*
* A boolean, valid values are #TRUE and #FALSE.
*/
/**
* @typedef dbus_uint32_t
*
* A 32-bit unsigned integer on all platforms.
*/
/**
* @typedef dbus_int32_t
*
* A 32-bit signed integer on all platforms.
*/
/**
* @typedef dbus_uint16_t
*
* A 16-bit unsigned integer on all platforms.
*/
/**
* @typedef dbus_int16_t
*
* A 16-bit signed integer on all platforms.
*/
/**
* @typedef dbus_uint64_t
*
* A 64-bit unsigned integer.
*/
/**
* @typedef dbus_int64_t
*
* A 64-bit signed integer.
*/
/**
* @def DBUS_HAVE_INT64
*
* Always defined.
*
* In older libdbus versions, this would be undefined if there was no
* 64-bit integer type on that platform. libdbus no longer supports
* such platforms.
*/
/**
* @def DBUS_INT64_CONSTANT
*
* Declare a 64-bit signed integer constant. The macro
* adds the necessary "LL" or whatever after the integer,
* giving a literal such as "325145246765LL"
*/
/**
* @def DBUS_UINT64_CONSTANT
*
* Declare a 64-bit unsigned integer constant. The macro
* adds the necessary "ULL" or whatever after the integer,
* giving a literal such as "325145246765ULL"
*/
/**
* An 8-byte struct you could use to access int64 without having
* int64 support. Use #dbus_int64_t or #dbus_uint64_t instead.
*/
typedef struct
{
dbus_uint32_t first32; /**< first 32 bits in the 8 bytes (beware endian issues) */
dbus_uint32_t second32; /**< second 32 bits in the 8 bytes (beware endian issues) */
} DBus8ByteStruct;
/**
* A simple value union that lets you access bytes as if they
* were various types; useful when dealing with basic types via
* void pointers and varargs.
*
* This union also contains a pointer member (which can be used
* to retrieve a string from dbus_message_iter_get_basic(), for
* instance), so on future platforms it could conceivably be larger
* than 8 bytes.
*/
typedef union
{
unsigned char bytes[8]; /**< as 8 individual bytes */
dbus_int16_t i16; /**< as int16 */
dbus_uint16_t u16; /**< as int16 */
dbus_int32_t i32; /**< as int32 */
dbus_uint32_t u32; /**< as int32 */
dbus_bool_t bool_val; /**< as boolean */
dbus_int64_t i64; /**< as int64 */
dbus_uint64_t u64; /**< as int64 */
DBus8ByteStruct eight; /**< as 8-byte struct */
double dbl; /**< as double */
unsigned char byt; /**< as byte */
char *str; /**< as char* (string, object path or signature) */
int fd; /**< as Unix file descriptor */
} DBusBasicValue;
/** @} */
#endif /* DBUS_TYPES_H */

View File

@ -0,0 +1,104 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus.h Convenience header including all other headers
*
* Copyright (C) 2002, 2003 Red Hat Inc.
*
* Licensed under the Academic Free License version 2.1
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef DBUS_H
#define DBUS_H
#define DBUS_INSIDE_DBUS_H 1
#include <dbus/dbus-arch-deps.h>
#include <dbus/dbus-address.h>
#include <dbus/dbus-bus.h>
#include <dbus/dbus-connection.h>
#include <dbus/dbus-errors.h>
#include <dbus/dbus-macros.h>
#include <dbus/dbus-message.h>
#include <dbus/dbus-misc.h>
#include <dbus/dbus-pending-call.h>
#include <dbus/dbus-protocol.h>
#include <dbus/dbus-server.h>
#include <dbus/dbus-shared.h>
#include <dbus/dbus-signature.h>
#include <dbus/dbus-syntax.h>
#include <dbus/dbus-threads.h>
#include <dbus/dbus-types.h>
#undef DBUS_INSIDE_DBUS_H
/**
* @defgroup DBus D-Bus low-level public API
* @brief The low-level public API of the D-Bus library
*
* libdbus provides a low-level C API intended primarily for use by
* bindings to specific object systems and languages. D-Bus is most
* convenient when used with the GLib bindings, Python bindings, Qt
* bindings, Mono bindings, and so forth. This low-level API has a
* lot of complexity useful only for bindings.
*
* @{
*/
/** @} */
/**
* @mainpage
*
* This manual documents the <em>low-level</em> D-Bus C API. <b>If you use
* this low-level API directly, you're signing up for some pain.</b>
*
* Caveats aside, you might get started learning the low-level API by reading
* about @ref DBusConnection and @ref DBusMessage.
*
* There are several other places to look for D-Bus information, such
* as the tutorial and the specification; those can be found at <a
* href="http://www.freedesktop.org/wiki/Software/dbus">the D-Bus
* website</a>. If you're interested in a sysadmin or package
* maintainer's perspective on the dbus-daemon itself and its
* configuration, be sure to check out the man pages as well.
*
* The low-level API documented in this manual deliberately lacks
* most convenience functions - those are left up to higher-level libraries
* based on frameworks such as GLib, Qt, Python, Mono, Java,
* etc. These higher-level libraries (often called "D-Bus bindings")
* have features such as object systems and main loops that allow a
* <em>much</em> more convenient API.
*
* The low-level API also contains plenty of clutter to support
* integration with arbitrary object systems, languages, main loops,
* and so forth. These features add a lot of noise to the API that you
* probably don't care about unless you're coding a binding.
*
* This manual also contains docs for @ref DBusInternals "D-Bus internals",
* so you can use it to get oriented to the D-Bus source code if you're
* interested in patching the code. You should also read the
* file HACKING which comes with the source code if you plan to contribute to
* D-Bus.
*
* As you read the code, you can identify internal D-Bus functions
* because they start with an underscore ('_') character. Also, any
* identifier or macro that lacks a DBus, dbus_, or DBUS_ namepace
* prefix is internal, with a couple of exceptions such as #NULL,
* #TRUE, and #FALSE.
*/
#endif /* DBUS_H */

Some files were not shown because too many files have changed in this diff Show More