+ Added many new wince api interface units by Vasil Maximov.

git-svn-id: trunk@11192 -
This commit is contained in:
yury 2008-06-04 14:58:20 +00:00
parent b21b10aafb
commit fc55afcac9
12 changed files with 12108 additions and 8 deletions

8
.gitattributes vendored
View File

@ -4489,6 +4489,10 @@ packages/uuid/tests/testuid.pp svneol=native#text/plain
packages/winceunits/Makefile svneol=native#text/plain
packages/winceunits/Makefile.fpc svneol=native#text/plain
packages/winceunits/src/aygshell.pp svneol=native#text/plain
packages/winceunits/src/bt_api.pp svneol=native#text/plain
packages/winceunits/src/bt_sdp.pp svneol=native#text/plain
packages/winceunits/src/bthapi.pp svneol=native#text/plain
packages/winceunits/src/bthutil.pp svneol=native#text/plain
packages/winceunits/src/buildwinceunits.pp svneol=native#text/plain
packages/winceunits/src/cesync.pp svneol=native#text/plain
packages/winceunits/src/commctrl.pp svneol=native#text/plain
@ -4501,17 +4505,21 @@ packages/winceunits/src/iphlpapi.pp svneol=native#text/plain
packages/winceunits/src/msgqueue.pp svneol=native#text/plain
packages/winceunits/src/notify.pp svneol=native#text/plain
packages/winceunits/src/oleauto.pp svneol=native#text/plain
packages/winceunits/src/pimstore.pp svneol=native#text/plain
packages/winceunits/src/pm.pp svneol=native#text/plain
packages/winceunits/src/power.pp svneol=native#text/plain
packages/winceunits/src/rapi.pp svneol=native#text/plain
packages/winceunits/src/ril.pp svneol=native#text/plain
packages/winceunits/src/service.pp svneol=native#text/plain
packages/winceunits/src/shellapi.pp svneol=native#text/plain
packages/winceunits/src/simmgr.pp svneol=native#text/plain
packages/winceunits/src/sipapi.pp svneol=native#text/plain
packages/winceunits/src/sms.pp svneol=native#text/plain
packages/winceunits/src/tapi.pp svneol=native#text/plain
packages/winceunits/src/todaycmn.pp svneol=native#text/plain
packages/winceunits/src/windbase.pp svneol=native#text/plain
packages/winceunits/src/winioctl.pp svneol=native#text/plain
packages/winceunits/src/ws2bth.pp svneol=native#text/plain
packages/winunits-base/Makefile svneol=native#text/plain
packages/winunits-base/Makefile.fpc svneol=native#text/plain
packages/winunits-base/fpmake.pp svneol=native#text/plain

View File

@ -1,5 +1,5 @@
#
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/06/03]
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/06/04]
#
default: all
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@ -264,16 +264,16 @@ ifeq ($(FULL_TARGET),i386-win32)
override TARGET_UNITS+=rapi cesync
endif
ifeq ($(FULL_TARGET),i386-wince)
override TARGET_UNITS+=buildwinceunits comobj
override TARGET_UNITS+=comobj buildwinceunits
endif
ifeq ($(FULL_TARGET),arm-wince)
override TARGET_UNITS+=buildwinceunits comobj
override TARGET_UNITS+=comobj buildwinceunits
endif
ifeq ($(FULL_TARGET),i386-wince)
override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl activex ole2 comconst
override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth activex ole2 comconst
endif
ifeq ($(FULL_TARGET),arm-wince)
override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl activex ole2 comconst
override TARGET_IMPLICITUNITS+=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth activex ole2 comconst
endif
ifeq ($(FULL_TARGET),i386-linux)
override TARGET_RSTS+=comconst

View File

@ -7,10 +7,10 @@ name=winceunits
version=2.2.0
[target]
units_wince=buildwinceunits comobj
units_wince=comobj buildwinceunits
implicitunits_wince=aygshell commctrl commdlg iphlpapi notify oleauto power shellapi simmgr tapi \
gpsapi todaycmn windbase cesync gx winioctl msgqueue pm service htmlctrl \
sipapi cpl \
sipapi cpl bt_api bt_sdp bthapi bthutil pimstore ril sms ws2bth \
activex ole2 comconst
units_win32=rapi cesync

View File

@ -0,0 +1,595 @@
{
This file is part of the Free Pascal run time library.
Copyright (c) 2008 Free Pascal development team.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
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.
********************************************************************** }
//------------------------------------------------------------------------------
//
// Bluetooth client API declarations
//
//
// Module Name:
//
// bt_api.h
//
// Abstract:
//
// This file defines client-level APIs to Bluetooth stack
//
//
//------------------------------------------------------------------------------
//
// Bluetooth client API
//
//
// Microsoft Windows Mobile 6.0 for PocketPC SDK.
//
unit bt_api;
{$CALLING cdecl}
interface
uses Windows, WinSock2, WinIOCtl, ws2bth;
//
// COD classes
//
const
BTH_COD_MAJOR_SERVICE_CLASS_INFORMATION = $800000;
BTH_COD_MAJOR_SERVICE_CLASS_TELEPHONY = $400000;
BTH_COD_MAJOR_SERVICE_CLASS_AUDIO = $200000;
BTH_COD_MAJOR_SERVICE_CLASS_OBEX = $100000;
BTH_COD_MAJOR_SERVICE_CLASS_CAPTURE = $080000;
BTH_COD_MAJOR_SERVICE_CLASS_RENDERING = $040000;
BTH_COD_MAJOR_SERVICE_CLASS_NETWORK = $020000;
BTH_COD_MAJOR_SERVICE_CLASS_LIMITED_DISC = $002000;
BTH_COD_MAJOR_DEVICE_CLASS_MISC = $000000;
BTH_COD_MAJOR_DEVICE_CLASS_COMPUTER = $000100;
BTH_COD_MAJOR_DEVICE_CLASS_PHONE = $000200;
BTH_COD_MAJOR_DEVICE_CLASS_LAP = $000300;
BTH_COD_MAJOR_DEVICE_CLASS_AUDIO = $000400;
BTH_COD_MAJOR_DEVICE_CLASS_PERIPHERAL = $000500;
BTH_COD_MAJOR_DEVICE_CLASS_UNCLASSIFIED = $001f00;
BTH_COD_MINOR_COMPUTER_UNCLASSIFIED = $000000;
BTH_COD_MINOR_COMPUTER_DESKTOP = $000004;
BTH_COD_MINOR_COMPUTER_SERVER = $000008;
BTH_COD_MINOR_COMPUTER_LAPTOP = $00000c;
BTH_COD_MINOR_COMPUTER_HANDHELD = $000010;
BTH_COD_MINOR_COMPUTER_PDA = $000014;
BTH_COD_MINOR_PHONE_UNCLASSIFIED = $000000;
BTH_COD_MINOR_PHONE_CELL = $000004;
BTH_COD_MINOR_PHONE_CORDLESS = $000008;
BTH_COD_MINOR_PHONE_SMART = $00000c;
BTH_COD_MINOR_PHONE_WIRED = $000010;
BTH_COD_MINOR_LAP_AVAILABLE = $000000;
BTH_COD_MINOR_LAP_1_17 = $000004;
BTH_COD_MINOR_LAP_17_33 = $000008;
BTH_COD_MINOR_LAP_33_50 = $00000c;
BTH_COD_MINOR_LAP_50_67 = $000010;
BTH_COD_MINOR_LAP_67_83 = $000014;
BTH_COD_MINOR_LAP_83_99 = $000018;
BTH_COD_MINOR_LAP_NO_SERVICE = $00001c;
BTH_COD_MINOR_AUDIO_UNCLASSIFIED = $000000;
BTH_COD_MINOR_AUDIO_HEADSET = $000004;
BTH_NAMEDEVENT_PAIRING_CHANGED = 'system/events/bluetooth/PairingChange';
BTH_NAMEDEVENT_HARDWARE_CHANGED = 'system/events/bluetooth/HardwareChange';
BTH_NAMEDEVENT_DEVICEID_CHANGED = 'system/events/bluetooth/DeviceIdChange';
BTH_NAMEDEVENT_CONNECTIVITY_CHANGED = 'system/events/bluetooth/ConnectivityChange';
BTH_NAMEDEVENT_SECURITY_CHANGED = 'system/events/bluetooth/SecurityChange';
BTH_NAMEDEVENT_CONNECTIONS_CHANGED = 'system/events/bluetooth/ConnectionsChange';
BTH_NAMEDEVENT_BASEBAND_CHANGED = 'system/events/bluetooth/BasebandChange';
BTH_NAMEDEVENT_STACK_INITED = 'system/events/bluetooth/StackInitialized';
BTH_NAMEDEVENT_PAN_REFRESH = 'system/events/bluetooth/pan/refresh';
{$IFNDEF __bt_ddi_H__}
//
// Attention: also defined in bt_ddi.h! Keep in sync!
//
// Hardware Status
//
const
HCI_HARDWARE_UNKNOWN = 0;
HCI_HARDWARE_NOT_PRESENT = 1;
HCI_HARDWARE_INITIALIZING = 2;
HCI_HARDWARE_RUNNING = 3;
HCI_HARDWARE_SHUTDOWN = 4;
HCI_HARDWARE_ERROR = 5;
{$ENDIF __bt_ddi_H__}
const
BTH_GET_BASEBAND_CONNECTIONS_EX_API_VERSION = 1;
type
_BASEBAND_CONNECTION = record
hConnection:USHORT;
baAddress:BT_ADDR;
cDataPacketsPending:longint;
_flags:UINT;
{
UINT fLinkType : 1; // The type of link. Zero (0) indicates SCO, and 1 indicates ACL.
UINT fEncrypted : 1; // Encryption is enabled.
UINT fAuthenticated : 1; // Indicates whether the connection has been authenticated.
UINT fMode : 3; // The connection mode.
}
end;
BASEBAND_CONNECTION = _BASEBAND_CONNECTION;
PBASEBAND_CONNECTION = ^_BASEBAND_CONNECTION;
type
_BASEBAND_CONNECTION_EX = record
hConnection:USHORT;
baAddress:BT_ADDR;
cDataPacketsPending:longint;
link_type:UCHAR;
mode:UCHAR;
_flags:UINT;
{
UINT fEncrypted : 1;
BOOL fAuthenticated : 1;
}
end;
BASEBAND_CONNECTION_EX = _BASEBAND_CONNECTION_EX;
PBASEBAND_CONNECTION_EX = ^_BASEBAND_CONNECTION_EX;
const
HCI_PAGE_SCAN_TYPE_STANDARD = $00;
HCI_PAGE_SCAN_TYPE_INTERLACED = $01;
HCI_INQUIRY_SCAN_TYPE_STANDARD = $00;
HCI_INQUIRY_SCAN_TYPE_INTERLACED = $01;
//
// Warning: To use the following Bth* APIs you must link to btdrt.lib.
// This library may or may not be available in your SDK.
//
// To preserve Win32 compatibility, consider using the Winsock equivalent
// of these functions.
//
const
BtdrtDll = 'btdrt.dll';
//
// Management APIs
//
function BthWriteScanEnableMask(mask:byte):longint; external BtdrtDll name 'BthWriteScanEnableMask';
function BthReadScanEnableMask(pmask:LPBYTE):longint; external BtdrtDll name 'BthReadScanEnableMask';
function BthWritePageTimeout(timeout:word):longint; external BtdrtDll name 'BthWritePageTimeout';
function BthReadPageTimeout(ptimeout:LPWORD):longint; external BtdrtDll name 'BthReadPageTimeout';
function BthWriteCOD(cod:dword):longint; external BtdrtDll name 'BthWriteCOD';
function BthReadCOD(pcod:LPDWORD):longint; external BtdrtDll name 'BthReadCOD';
function BthGetRemoteCOD(pbt:PBT_ADDR; pcod:LPDWORD):longint; external BtdrtDll name 'BthGetRemoteCOD';
function BthWriteAuthenticationEnable(ae:byte):longint; external BtdrtDll name 'BthWriteAuthenticationEnable';
function BthReadAuthenticationEnable(pae:LPBYTE):longint; external BtdrtDll name 'BthReadAuthenticationEnable';
function BthWriteLinkPolicySettings(pba:PBT_ADDR; lps:word):longint; external BtdrtDll name 'BthWriteLinkPolicySettings';
function BthReadLinkPolicySettings(pba:PBT_ADDR; plps:LPWORD):longint; external BtdrtDll name 'BthReadLinkPolicySettings';
function BthEnterHoldMode(pba:PBT_ADDR; hold_mode_max:word; hold_mode_min:word; pinterval:LPWORD):longint; external BtdrtDll name 'BthEnterHoldMode';
function BthEnterSniffMode(pba:PBT_ADDR;
sniff_mode_max:word;
sniff_mode_min:word;
sniff_attempt:word;
sniff_timeout:word;
pinterval:LPWORD):longint; external BtdrtDll name 'BthEnterSniffMode';
function BthExitSniffMode(pba:PBT_ADDR):longint; external BtdrtDll name 'BthExitSniffMode';
function BthEnterParkMode(pba:PBT_ADDR; beacon_max:word; beacon_min:word; pinterval:LPWORD):longint; external BtdrtDll name 'BthEnterParkMode';
function BthExitParkMode(pba:PBT_ADDR):longint; external BtdrtDll name 'BthExitParkMode';
function BthGetCurrentMode(pba:PBT_ADDR; pmode:LPBYTE):longint; external BtdrtDll name 'BthGetCurrentMode';
function BthGetBasebandHandles(cHandles:longint; pHandles:LPWORD; pcHandlesReturned:PLongint):longint; external BtdrtDll name 'BthGetBasebandHandles';
function BthGetBasebandConnections(cConnections:longint; pConnections:PBASEBAND_CONNECTION; pcConnectionsReturned:PLongint):longint; external BtdrtDll name 'BthGetBasebandConnections';
function BthGetBasebandConnectionsEx(dwApiVersion:DWORD;
cConnections:longint;
pConnections:PBASEBAND_CONNECTION_EX;
pcConnectionsReturned:PLongint):longint; external BtdrtDll name 'BthGetBasebandConnectionsEx';
function BthGetAddress(_handle:word; pba:PBT_ADDR):longint; external BtdrtDll name 'BthGetAddress';
function BthReadLocalAddr(pba:PBT_ADDR):longint; external BtdrtDll name 'BthReadLocalAddr';
function BthGetHardwareStatus(pistatus:PLongint):longint; external BtdrtDll name 'BthGetHardwareStatus';
function BthReadLocalVersion(phci_version:LPBYTE;
phci_revision:LPWORD;
plmp_version:LPBYTE;
plmp_subversion:LPWORD;
pmanufacturer:LPWORD;
plmp_features:LPBYTE):longint; external BtdrtDll name 'BthReadLocalVersion';
function BthReadRemoteVersion(pba:PBT_ADDR;
plmp_version:LPBYTE;
plmp_subversion:LPWORD;
pmanufacturer:LPWORD;
plmp_features:LPBYTE):longint; external BtdrtDll name 'BthReadRemoteVersion';
function BthPerformInquiry(LAP:LongWord;
_length:byte;
num_responses:byte;
cBuffer:LongWord;
pcDiscoveredDevices:LPDWORD;
InquiryList:PBthInquiryResult):longint; external BtdrtDll name 'BthPerformInquiry';
function BthCancelInquiry:longint; external BtdrtDll name 'BthCancelInquiry';
function BthRemoteNameQuery(pba:PBT_ADDR; cBuffer:LongWord; pcRequired:LPDWORD; szString:PWCHAR):longint; external BtdrtDll name 'BthRemoteNameQuery';
function BthTerminateIdleConnections:longint; external BtdrtDll name 'BthTerminateIdleConnections';
function BthSetInquiryFilter(pba:PBT_ADDR):longint; external BtdrtDll name 'BthSetInquiryFilter';
function BthSetCODInquiryFilter(cod:LongWord; codMask:LongWord):longint; external BtdrtDll name 'BthSetCODInquiryFilter';
function BthClearInquiryFilter:longint; external BtdrtDll name 'BthClearInquiryFilter';
function BthSwitchRole(pbt:PBT_ADDR; usRole:USHORT):longint; external BtdrtDll name 'BthSwitchRole';
function BthGetRole(pbt:PBT_ADDR; pusRole:PUSHORT):longint; external BtdrtDll name 'BthGetRole';
function BthReadRSSI(pbt:PBT_ADDR; pbRSSI:LPBYTE):longint; external BtdrtDll name 'BthReadRSSI';
//
// Security manager APIs
//
function BthSetPIN(pba:PBT_ADDR; cPinLength:longint; ppin:LPBYTE):longint; external BtdrtDll name 'BthSetPIN';
function BthRevokePIN(pba:PBT_ADDR):longint; external BtdrtDll name 'BthRevokePIN';
type
TBthLinkKey = packed array[0..15] of byte;
PBthLinkKey = ^TBthLinkKey;
function BthSetLinkKey(pba:PBT_ADDR; key:TBthLinkKey):longint; external BtdrtDll name 'BthSetLinkKey';
function BthGetLinkKey(pba:PBT_ADDR; key:TBthLinkKey):longint; external BtdrtDll name 'BthGetLinkKey';
function BthRevokeLinkKey(pba:PBT_ADDR):longint; external BtdrtDll name 'BthRevokeLinkKey';
function BthAuthenticate(pba:PBT_ADDR):longint; external BtdrtDll name 'BthAuthenticate';
function BthSetEncryption(pba:PBT_ADDR; fOn:longint):longint; external BtdrtDll name 'BthSetEncryption';
function BthSetSecurityUI(_hEvent:HANDLE; dwStoreTimeout:DWORD; dwProcTimeout:DWORD):longint; external BtdrtDll name 'BthSetSecurityUI';
function BthGetPINRequest(pbt:PBT_ADDR):longint; external BtdrtDll name 'BthGetPINRequest';
function BthRefusePINRequest(pbt:PBT_ADDR):longint; external BtdrtDll name 'BthRefusePINRequest';
function BthAnswerPairRequest(pba:PBT_ADDR; cPinLength:longint; ppin:LPBYTE):longint; external BtdrtDll name 'BthAnswerPairRequest';
function BthPairRequest(pba:PBT_ADDR; cPinLength:longint; ppin:LPBYTE):longint; external BtdrtDll name 'BthAnswerPairRequest';
//
// Connection APIs
//
function BthCreateACLConnection(pbt:PBT_ADDR; _phandle:LPWORD):longint; external BtdrtDll name 'BthCreateACLConnection';
function BthCreateSCOConnection(pbt:PBT_ADDR; _phandle:LPWORD):longint; external BtdrtDll name 'BthCreateSCOConnection';
function BthCloseConnection(_handle:word):longint; external BtdrtDll name 'BthCloseConnection';
function BthAcceptSCOConnections(fAccept:BOOL):longint; external BtdrtDll name 'BthAcceptSCOConnections';
function BthWritePageScanActivity(pageScanInterval:word; pageScanWindow:word):longint; external BtdrtDll name 'BthWritePageScanActivity';
function BthWriteInquiryScanActivity(inquiryScanInterval:word; inquiryScanWindow:word):longint; external BtdrtDll name 'BthWriteInquiryScanActivity';
function BthReadPageScanActivity(pPageScanInterval:LPWORD; pPageScanWindow:LPWORD):longint; external BtdrtDll name 'BthReadPageScanActivity';
function BthReadInquiryScanActivity(pInquiryScanInterval:LPWORD; pInquiryScanWindow:LPWORD):longint; external BtdrtDll name 'BthReadInquiryScanActivity';
function BthWritePageScanType(pageScanType:byte):longint; external BtdrtDll name 'BthWritePageScanType';
function BthWriteInquiryScanType(inquiryScanType:byte):longint; external BtdrtDll name 'BthWriteInquiryScanType';
function BthReadPageScanType(pPageScanType:LPBYTE):longint; external BtdrtDll name 'BthReadPageScanType';
function BthReadInquiryScanType(pInquiryScanType:LPBYTE):longint; external BtdrtDll name 'BthReadInquiryScanType';
function BthCreateSynchronousConnection(pbt:PBT_ADDR;
pHandle:LPWORD;
txBandwidth:LongWord;
rxBandwidth:LongWord;
maxLatency:word;
voiceSetting:word;
retransmit:byte):longint; external BtdrtDll name 'BthCreateSynchronousConnection';
function BthAcceptSynchronousConnections(fAccept:BOOL):longint; external BtdrtDll name 'BthAcceptSynchronousConnections';
//
// SDP Name Service APIs
//
type
{
SdpAttributeRange = _SdpAttributeRange;
SdpQueryUuid = _SdpQueryUuid;
}
_WSAQuerySetW = TWSAQuerySetW;
_WSAESETSERVICEOP = TWSAeSetServiceOp;
WSAESETSERVICEOP = _WSAESETSERVICEOP;
function BthNsSetService(pSet:LPWSAQUERYSET; op:WSAESETSERVICEOP; dwFlags:DWORD):longint; external BtdrtDll name 'BthNsSetService';
function BthNsLookupServiceBegin(pQuerySet:LPWSAQUERYSET; dwFlags:DWORD; lphLookup:LPHANDLE):longint; external BtdrtDll name 'BthNsLookupServiceBegin';
function BthNsLookupServiceNext(hLookup:HANDLE; dwFlags:DWORD; lpdwBufferLength:LPDWORD; pResults:LPWSAQUERYSET):longint; external BtdrtDll name 'BthNsLookupServiceNext';
function BthNsLookupServiceEnd(hLookup:HANDLE):longint; external BtdrtDll name 'BthNsLookupServiceEnd';
//
// RFCOMM Apis
//
const
RFCOMM_PORT_FLAGS_REMOTE_DCB = $00000001;
RFCOMM_PORT_FLAGS_KEEP_DCD = $00000002;
RFCOMM_PORT_FLAGS_AUTHENTICATE = $00000004;
RFCOMM_PORT_FLAGS_ENCRYPT = $00000008;
{$IFNDEF __bt_ddi_H__}
//
// Attention: also defined in bt_ddi.h! Keep in sync!
//
// channel:
// RFCOMM_CHANNEL_ALL accept connection on all channels (default upper layer)
// RFCOMM_CHANNEL_CLIENT_ONLY do not accept connections at all (client only)
// ...or channel to restrict connections on
//
const
RFCOMM_CHANNEL_ALL = $00;
RFCOMM_CHANNEL_MULTIPLE = $fe;
RFCOMM_CHANNEL_CLIENT_ONLY = $ff;
{$ENDIF __bt_ddi_H__}
type
_portemu_port_params = record
channel:longint;
flocal:longint;
device:BT_ADDR;
imtu:longint;
iminmtu:longint;
imaxmtu:longint;
isendquota:longint;
irecvquota:longint;
uuidService:GUID;
uiportflags:LongWord;
end;
PORTEMUPortParams = _portemu_port_params;
// Bluetooth serial IOCTLs are cross-defined in pegdser.h to reserve spot there.
const
IOCTL_BLUETOOTH_GET_RFCOMM_CHANNEL = (FILE_DEVICE_SERIAL_PORT shl 16) or
(FILE_ANY_ACCESS shl 14) or
(24 shl 2) or
METHOD_BUFFERED;
// #define IOCTL_BLUETOOTH_GET_RFCOMM_CHANNEL CTL_CODE(FILE_DEVICE_SERIAL_PORT,24,METHOD_BUFFERED,FILE_ANY_ACCESS)
IOCTL_BLUETOOTH_GET_PEER_DEVICE = (FILE_DEVICE_SERIAL_PORT shl 16) or
(FILE_ANY_ACCESS shl 14) or
(25 shl 2) or
METHOD_BUFFERED;
// #define IOCTL_BLUETOOTH_GET_PEER_DEVICE CTL_CODE(FILE_DEVICE_SERIAL_PORT,25,METHOD_BUFFERED,FILE_ANY_ACCESS)
//
// Bluetooth notification system
//
function RequestBluetoothNotifications(
dwClass:DWORD; // class of notifications to register for
hMsgQ:HANDLE // message queue created by caller
):HANDLE; external BtdrtDll name 'RequestBluetoothNotifications';
function StopBluetoothNotifications(
h:HANDLE // Handle returned from RequestBluetoothNotifications
):BOOL; external BtdrtDll name 'StopBluetoothNotifications';
type
_BTEVENT = record
dwEventId:DWORD; // Event ID
dwReserved:DWORD; // Reserved
baEventData:array[0..63] of byte; // Event Data
end;
BTEVENT = _BTEVENT;
PBTEVENT = ^_BTEVENT;
//
// Class of events to notify connections going up/down
// and other connection-related changes (role, mode).
//
const
BTE_CLASS_CONNECTIONS = 1;
BTE_CONNECTION = 100;
BTE_DISCONNECTION = 101;
BTE_ROLE_SWITCH = 102;
BTE_MODE_CHANGE = 103;
BTE_PAGE_TIMEOUT = 104;
type
BT_CONNECT_EVENT = record
dwSize:DWORD; // To keep track of version
hConnection:USHORT; // Baseband connection handle
bta:BT_ADDR; // Address of remote device
ucLinkType:UCHAR; // Link Type (ACL/SCO)
ucEncryptMode:UCHAR; // Encryption mode
end;
PBT_CONNECT_EVENT = ^BT_CONNECT_EVENT;
type
BT_DISCONNECT_EVENT = record
dwSize:DWORD; // To keep track of version
hConnection:USHORT; // Baseband connection handle
ucReason:UCHAR; // Reason for disconnection
end;
PBT_DISCONNECT_EVENT = ^BT_DISCONNECT_EVENT;
type
BT_ROLE_SWITCH_EVENT = record
dwSize:DWORD; // To keep track of version
bta:BT_ADDR; // Address of remote device
_flags:UINT;
{
UINT fRole : 1; // New Role (master/slave)
}
end;
PBT_ROLE_SWITCH_EVENT = ^BT_ROLE_SWITCH_EVENT;
type
BT_MODE_CHANGE_EVENT = record
dwSize:DWORD; // To keep track of version
hConnection:USHORT; // Baseband connection handle
bta:BT_ADDR; // Address of remote device
bMode:byte; // Power mode (sniff, etc)
usInterval:USHORT; // Power mode interval
end;
PBT_MODE_CHANGE_EVENT = ^BT_MODE_CHANGE_EVENT;
//
// Class of events to notify changes in pairing.
//
const
BTE_CLASS_PAIRING = 2;
BTE_KEY_NOTIFY = 200;
BTE_KEY_REVOKED = 201;
type
BT_LINK_KEY_EVENT = record
dwSize:DWORD; // To keep track of version
bta:BT_ADDR; // Address of remote device
link_key:array[0..15] of UCHAR; // Link key data
key_type:UCHAR; // Link key type
end;
PBT_LINK_KEY_EVENT = ^BT_LINK_KEY_EVENT;
//
// Class of events to notify changes specific to the
// local device (cod, name)
//
const
BTE_CLASS_DEVICE = 4;
BTE_LOCAL_NAME = 300;
BTE_COD = 301;
//
// Class of events to notify change of state of the
// core stack.
//
const
BTE_CLASS_STACK = 8;
BTE_STACK_UP = 400;
BTE_STACK_DOWN = 401;
//
// Class of events to notify change of state of AVDTP
//
const
BTE_CLASS_AVDTP = 16;
BTE_AVDTP_STATE = 500;
BT_AVDTP_STATE_DISCONNECTED = 0;
BT_AVDTP_STATE_SUSPENDED = 1;
BT_AVDTP_STATE_STREAMING = 2;
type
BT_AVDTP_STATE_CHANGE = record
dwSize:DWORD; // To keep track of version
bta:BT_ADDR; // Address of remote device
dwState:DWORD; // New state of the AVDTP stream
end;
PBT_AVDTP_STATE_CHANGE = ^BT_AVDTP_STATE_CHANGE;
//
// Class of events to notify change of PAN state
//
const
BTE_CLASS_PAN = 32;
BTE_PAN_CONNECTIONS = 600;
type
BT_PAN_NUM_CONNECTIONS = record
dwSize:DWORD; // To keep track of version
NumConnections:DWORD; // Number of peers connected
end;
PBT_PAN_NUM_CONNECTIONS = ^BT_PAN_NUM_CONNECTIONS;
//
// PAN APIs
//
function BthActivatePAN(fActivate:BOOL):longint; external BtdrtDll name 'BthActivatePAN';
function rfRegisterDevice(lpszType:LPCWSTR; dwIndex:DWORD; lpszLib:LPCWSTR; dwInfo:DWORD):HANDLE; external KernelDLL name 'RegisterDevice'; // index 14F
function rfDeregisterDevice(hDevice:HANDLE):BOOL; external KernelDLL name 'DeregisterDevice';
function rfCreateFile(lpFileName:LPCTSTR;
dwDesiredAccess:DWORD;
dwShareMode:DWORD;
lpSecurityAttributes:LPSECURITY_ATTRIBUTES;
dwCreationDisposition:DWORD;
dwFlagsAndAttributes:DWORD;
hTemplateFile:HANDLE):HANDLE; external KernelDLL name 'CreateFileW';
function rfReadFile(_hFile:HANDLE; // handle to file
lpBuffer:LPVOID; // data buffer
nNumberOfBytesToRead:DWORD; // number of bytes to read
lpNumberOfBytesRead:LPDWORD; // number of bytes read
lpOverlapped:LPOVERLAPPED // overlapped buffer
):BOOL; external KernelDLL name 'ReadFile'; // index F4
function rfWriteFile(_hFile:HANDLE; // handle to file
lpBuffer:LPCVOID; // data buffer
nNumberOfBytesToWrite:DWORD; // number of bytes to write
lpNumberOfBytesWritten:LPDWORD; // number of bytes written
lpOverlapped:LPOVERLAPPED // overlapped buffer
):BOOL; external KernelDLL name 'WriteFile';
function rfCloseHandle(_hFile:HANDLE):BOOL; external KernelDLL name 'CloseHandle';
implementation
end.

View File

@ -0,0 +1,228 @@
{
This file is part of the Free Pascal run time library.
Copyright (c) 2008 Free Pascal development team.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
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.
********************************************************************** }
//------------------------------------------------------------------------------
//
// Bluetooth Test Client
//
// Module Name:
//
// bt_sdp.h
//
// Abstract:
//
// This file contains constants and structures for Simple Discovery Protocol.
//
//------------------------------------------------------------------------------
//
// Microsoft Windows Mobile 6.0 for PocketPC SDK.
//
unit bt_sdp;
interface
uses Windows;
const
SDP_ERROR_INVALID_SDP_VERSION = $0001;
SDP_ERROR_INVALID_RECORD_HANDLE = $0002;
SDP_ERROR_INVALID_REQUEST_SYNTAX = $0003;
SDP_ERROR_INVALID_PDU_SIZE = $0004;
SDP_ERROR_INVALID_CONTINUATION_STATE = $0005;
SDP_ERROR_INSUFFICIENT_RESOURCES = $0006;
const
SDP_ATTRIB_RECORD_HANDLE = $0000;
SDP_ATTRIB_CLASS_ID_LIST = $0001;
SDP_ATTRIB_RECORD_STATE = $0002;
SDP_ATTRIB_SERVICE_ID = $0003;
SDP_ATTRIB_PROTOCOL_DESCRIPTOR_LIST = $0004;
SDP_ATTRIB_BROWSE_GROUP_LIST = $0005;
SDP_ATTRIB_LANG_BASE_ATTRIB_ID_LIST = $0006;
SDP_ATTRIB_INFO_TIME_TO_LIVE = $0007;
SDP_ATTRIB_AVAILABILITY = $0008;
SDP_ATTRIB_PROFILE_DESCRIPTOR_LIST = $0009;
SDP_ATTRIB_DOCUMENTATION_URL = $000A;
SDP_ATTRIB_CLIENT_EXECUTABLE_URL = $000B;
SDP_ATTRIB_ICON_URL = $000C;
//
// Attribute IDs in the range of = $000D - = $01FF are reserved for future use
//
SDP_ATTRIB_PROFILE_SPECIFIC = $0200;
STRING_NAME_OFFSET = $0000;
STRING_DESCRIPTION_OFFSET = $0001;
STRING_PROVIDER_NAME_OFFSET = $0002;
SDP_ATTRIB_SDP_VERSION_NUMBER_LIST = $0200;
SDP_ATTRIB_SDP_DATABASE_STATE = $0201;
SDP_ATTRIB_BROWSE_GROUP_ID = $0200;
SDP_ATTRIB_CORDLESS_EXTERNAL_NETWORK = $0301;
SDP_ATTRIB_FAX_CLASS_1_SUPPORT = $0302;
SDP_ATTRIB_FAX_CLASS_2_0_SUPPORT = $0303;
SDP_ATTRIB_FAX_CLASS_2_SUPPORT = $0304;
SDP_ATTRIB_FAX_AUDIO_FEEDBACK_SUPPORT = $0305;
SDP_ATTRIB_HEADSET_REMOTE_AUDIO_VOLUME_CONTROL = $0302;
SDP_ATTRIB_LAN_LPSUBNET = $0200;
SDP_ATTRIB_OBJECT_PUSH_SUPPORTED_FORMATS_LIST = $0303;
SDP_ATTRIB_SYNCH_SUPPORTED_DATA_STORES_LIST = $0301;
// this is in the assigned numbers doc, but it does not show up in any profile
SDP_ATTRIB_SERVICE_VERSION = $0300;
SDP_ATTRIB_PAN_SECURITY_DESCRIPTION = $030A;
SDP_ATTRIB_PAN_NET_ACCESS_TYPE = $030B;
SDP_ATTRIB_PAN_MAX_NET_ACCESS_RATE = $030C;
SDP_ATTRIB_PAN_IPV4_SUBNET = $030D;
SDP_ATTRIB_PAN_IPV6_SUBNET = $030E;
// Bluetooth base UUID for service discovery
const
// Bluetooth_Base_UUID:GUID = '{00000000-0000-1000-7007-00805F9B34FB}';
Bluetooth_Base_UUID :GUID = '{00000000-0000-1000-8000-00805F9B34FB}';
SDP_PROTOCOL_UUID :GUID = '{00000001-0000-1000-8000-00805F9B34FB}';
UDP_PROTOCOL_UUID :GUID = '{00000002-0000-1000-8000-00805F9B34FB}';
RFCOMM_PROTOCOL_UUID:GUID = '{00000003-0000-1000-8000-00805F9B34FB}';
TCP_PROTOCOL_UUID :GUID = '{00000004-0000-1000-8000-00805F9B34FB}';
TCSBIN_PROTOCOL_UUID:GUID = '{00000005-0000-1000-8000-00805F9B34FB}';
TCSAT_PROTOCOL_UUID :GUID = '{00000006-0000-1000-8000-00805F9B34FB}';
OBEX_PROTOCOL_UUID :GUID = '{00000008-0000-1000-8000-00805F9B34FB}';
IP_PROTOCOL_UUID :GUID = '{00000009-0000-1000-8000-00805F9B34FB}';
FTP_PROTOCOL_UUID :GUID = '{0000000A-0000-1000-8000-00805F9B34FB}';
HTTP_PROTOCOL_UUID :GUID = '{0000000C-0000-1000-8000-00805F9B34FB}';
WSP_PROTOCOL_UUID :GUID = '{0000000E-0000-1000-8000-00805F9B34FB}';
BNEP_PROTOCOL_UUID :GUID = '{0000000F-0000-1000-8000-00805F9B34FB}';
L2CAP_PROTOCOL_UUID :GUID = '{00000100-0000-1000-8000-00805F9B34FB}';
ServiceDiscoveryServerServiceClassID_UUID :GUID = '{00001000-0000-1000-8008-00805F9B34FB}';
BrowseGroupDescriptorServiceClassID_UUID :GUID = '{00001001-0000-1000-8000-00805F9B34FB}';
PublicBrowseGroupServiceClass_UUID :GUID = '{00001002-0000-1000-8000-00805F9B34FB}';
SerialPortServiceClass_UUID :GUID = '{00001101-0000-1000-8000-00805F9B34FB}';
LANAccessUsingPPPServiceClass_UUID :GUID = '{00001102-0000-1000-8000-00805F9B34FB}';
DialupNetworkingServiceClass_UUID :GUID = '{00001103-0000-1000-8000-00805F9B34FB}';
IrMCSyncServiceClass_UUID :GUID = '{00001104-0000-1000-8000-00805F9B34FB}';
OBEXObjectPushServiceClass_UUID :GUID = '{00001105-0000-1000-8000-00805F9B34FB}';
OBEXFileTransferServiceClass_UUID :GUID = '{00001106-0000-1000-8000-00805F9B34FB}';
IrMCSyncCommandServiceClass_UUID :GUID = '{00001107-0000-1000-8000-00805F9B34FB}';
HeadsetServiceClass_UUID :GUID = '{00001108-0000-1000-8000-00805F9B34FB}';
CordlessTelephonyServiceClass_UUID :GUID = '{00001109-0000-1000-8000-00805F9B34FB}';
AudioSourceServiceClass_UUID :GUID = '{0000110A-0000-1000-8000-00805F9B34FB}';
AudioSinkServiceClass_UUID :GUID = '{0000110B-0000-1000-8000-00805F9B34FB}';
AV_RemoteControlTargetServiceClass_UUID :GUID = '{0000110C-0000-1000-8000-00805F9B34FB}';
AdvancedAudioDistributionServiceClass_UUID:GUID = '{0000110D-0000-1000-8000-00805F9B34FB}';
AV_RemoteControlServiceClass_UUID :GUID = '{0000110E-0000-1000-8000-00805F9B34FB}';
VideoConferencingServiceClass_UUID :GUID = '{0000110F-0000-1000-8000-00805F9B34FB}';
IntercomServiceClass_UUID :GUID = '{00001110-0000-1000-8000-00805F9B34FB}';
FaxServiceClass_UUID :GUID = '{00001111-0000-1000-8000-00805F9B34FB}';
HeadsetAudioGatewayServiceClass_UUID :GUID = '{00001112-0000-1000-8000-00805F9B34FB}';
PANUServiceClass_UUID :GUID = '{00001115-0000-1000-8000-00805F9B34FB}';
NAPServiceClass_UUID :GUID = '{00001116-0000-1000-8000-00805F9B34FB}';
GNServiceClass_UUID :GUID = '{00001117-0000-1000-8000-00805F9B34FB}';
HandsfreeServiceClass_UUID :GUID = '{0000111E-0000-1000-8000-00805F9B34FB}';
HandsfreeAudioGatewayServiceClass_UUID :GUID = '{0000111F-0000-1000-8000-00805F9B34FB}';
PnPInformationServiceClass_UUID :GUID = '{00001200-0000-1000-8000-00805F9B34FB}';
GenericNetworkingServiceClass_UUID :GUID = '{00001201-0000-1000-8000-00805F9B34FB}';
GenericFileTransferServiceClass_UUID :GUID = '{00001202-0000-1000-8000-00805F9B34FB}';
GenericAudioServiceClass_UUID :GUID = '{00001203-0000-1000-8000-00805F9B34FB}';
GenericTelephonyServiceClass_UUID :GUID = '{00001204-0000-1000-8000-00805F9B34FB}';
const
SDP_PROTOCOL_UUID16 = $0001;
UDP_PROTOCOL_UUID16 = $0002;
RFCOMM_PROTOCOL_UUID16 = $0003;
TCP_PROTOCOL_UUID16 = $0004;
TCSBIN_PROTOCOL_UUID16 = $0005;
TCSAT_PROTOCOL_UUID16 = $0006;
OBEX_PROTOCOL_UUID16 = $0008;
IP_PROTOCOL_UUID16 = $0009;
FTP_PROTOCOL_UUID16 = $000A;
HTTP_PROTOCOL_UUID16 = $000C;
WSP_PROTOCOL_UUID16 = $000E;
BNEP_PROTOCOL_UUID16 = $000F;
HID_PROTOCOL_UUID16 = $0011;
AVCTP_PROTOCOL_UUID16 = $0017;
AVDTP_PROTOCOL_UUID16 = $0019;
L2CAP_PROTOCOL_UUID16 = $0100;
ServiceDiscoveryServerServiceClassID_UUID16 = $1000;
BrowseGroupDescriptorServiceClassID_UUID16 = $1001;
PublicBrowseGroupServiceClassID_UUID16 = $1002;
SerialPortServiceClassID_UUID16 = $1101;
LANAccessUsingPPPServiceClassID_UUID16 = $1102;
DialupNetworkingServiceClassID_UUID16 = $1103;
IrMCSyncServiceClassID_UUID16 = $1104;
OBEXObjectPushServiceClassID_UUID16 = $1105;
OBEXFileTransferServiceClassID_UUID16 = $1106;
IrMcSyncCommandServiceClassID_UUID16 = $1107;
HeadsetServiceClassID_UUID16 = $1108;
CordlessServiceClassID_UUID16 = $1109;
AudioSourceServiceClassID_UUID16 = $110A;
AudioSinkServiceClassID_UUID16 = $110B;
AV_RemoteControlTargetServiceClassID_UUID16 = $110C;
AdvancedAudioDistributionServiceClassID_UUID16 = $110D;
AV_RemoteControlServiceClassID_UUID16 = $110E;
VideoConferencingServiceClassID_UUID16 = $110F;
IntercomServiceClassID_UUID16 = $1110;
FaxServiceClassID_UUID16 = $1111;
HeadsetAudioGatewayServiceClassID_UUID16 = $1112;
PANUServiceClassID_UUID16 = $1115;
NAPServiceClassID_UUID16 = $1116;
GNServiceClassID_UUID16 = $1117;
HandsfreeServiceClassID_UUID16 = $111E;
HandsfreeAudioGatewayServiceClassID_UUID16 = $111F;
PnPInformationServiceClassID_UUID16 = $1200;
GenericNetworkingServiceClassID_UUID16 = $1201;
GenericFileTransferServiceClassID_UUID16 = $1202;
GenericAudioServiceClassID_UUID16 = $1203;
GenericTelephonyServiceClassID_UUID16 = $1204;
PSM_SDP = $0001;
PSM_RFCOMM = $0003;
PSM_TCS_BIN = $0005;
PSM_TCS_BIN_CORDLESS = $0007;
// HID specific SDP attrib ids.
const
SDP_ATTRIB_HID_DEVICE_RELEASE_NUMBER = $0200;
SDP_ATTRIB_HID_PARSER_VERSION = $0201;
SDP_ATTRIB_HID_DEVICE_SUBCLASS = $0202;
SDP_ATTRIB_HID_COUNTRY_CODE = $0203;
SDP_ATTRIB_HID_VIRTUAL_CABLE = $0204;
SDP_ATTRIB_HID_RECONNECT_INITIATE = $0205;
SDP_ATTRIB_HID_DESCRIPTOR_LIST = $0206;
SDP_ATTRIB_HID_LANGID_BASE_LIST = $0207;
SDP_ATTRIB_HID_SDP_DISABLE = $0208;
SDP_ATTRIB_HID_BATTERY_POWER = $0209;
SDP_ATTRIB_HID_REMOTE_WAKE = $020A;
SDP_ATTRIB_HID_PROFILE_VERSION = $020B;
SDP_ATTRIB_HID_SUPERVISION_TIMEOUT = $020C;
SDP_ATTRIB_HID_NORMALLY_CONNECTABLE = $020D;
SDP_ATTRIB_HID_BOOT_DEVICE = $020E;
implementation
end.

View File

@ -0,0 +1,388 @@
{
This file is part of the Free Pascal run time library.
Copyright (c) 2008 Free Pascal development team.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
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.
********************************************************************** }
//
// Module: bthapi.h, bthapi.idl
//
//
// Microsoft Windows Mobile 6.0 for PocketPC SDK.
//
unit bthapi;
{$MODE OBJFPC}
interface
uses Windows;
const
LIBID_BTHAPILib:TIID = '{00BC26C8-0A87-41d0-82BA-61FF9E0B1BB5}';
const
IID_ISdpWalk:TIID = '{57134AE6-5D3C-462D-BF2F-810361FBD7E7}';
IID_ISdpNodeContainer:TIID = '{43F6ED49-6E22-4F81-A8EB-DCED40811A77}';
IID_ISdpSearch:TIID = '{D93B6B2A-5EEF-4E1E-BECF-F5A4340C65F5}';
IID_ISdpStream = '{A6ECD9FB-0C7A-41A3-9FF0-0B617E989357}';
IID_ISdpRecord:TIID = '{10276714-1456-46D7-B526-8B1E83D5116E}';
IID_IBluetoothDevice:TIID = '{5BD0418B-D705-4766-B215-183E4EADE341}';
IID_IBluetoothAuthenticate:TIID = '{5F0FBA2B-8300-429D-99AD-96A2835D4901}';
const
CLSID_SdpNodeContainer:CLSID = '{D5CA76C5-0DEE-4453-96A1-E603C2401766}';
CLSID_SdpSearch:CLSID = '{3B898402-857E-4E41-9145-BC35431B7B4D}';
CLSID_SdpWalk:CLSID = '{ED384010-59AE-44c7-8FCA-F3DF22CDCD28}';
CLSID_SdpStream:CLSID = '{249797FA-19DB-4dda-94D4-E0BCD30EA65E}';
CLSID_SdpRecord:CLSID = '{ACD02BA7-9667-4085-A100-CC6ACA9621D6}';
{$IFNDEF __BTHSDPDEF_H__}
type
SDP_LARGE_INTEGER_16 = record
LowPart:ULONGLONG;
HighPart:LONGLONG;
end;
PSDP_LARGE_INTEGER_16 = ^SDP_LARGE_INTEGER_16;
LPSDP_LARGE_INTEGER_16 = ^SDP_LARGE_INTEGER_16;
SDP_ULARGE_INTEGER_16 = record
LowPart:ULONGLONG;
HighPart:ULONGLONG;
end;
PSDP_ULARGE_INTEGER_16 = ^SDP_ULARGE_INTEGER_16;
LPSDP_ULARGE_INTEGER_16 = ^SDP_ULARGE_INTEGER_16;
type
NodeContainerType = (NodeContainerTypeSequence := 0,
NodeContainerTypeAlternative);
PNodeContainerType = ^NodeContainerType;
type
SDP_ERROR = USHORT;
PSDP_ERROR = ^SDP_ERROR;
type
SDP_TYPE = (SDP_TYPE_NIL := 0,
SDP_TYPE_UINT := $1,
SDP_TYPE_INT := $2,
SDP_TYPE_UUID := $3,
SDP_TYPE_STRING := $4,
SDP_TYPE_BOOLEAN := $5,
SDP_TYPE_SEQUENCE := $6,
SDP_TYPE_ALTERNATIVE := $7,
SDP_TYPE_URL := $8,
SDP_TYPE_CONTAINER := $20);
PSDP_TYPE = ^SDP_TYPE;
SDP_SPECIFICTYPE = (SDP_ST_NONE := 0,
SDP_ST_UINT8 := $10,
SDP_ST_INT8 := $20,
SDP_ST_UINT16 := $110,
SDP_ST_INT16 := $120,
SDP_ST_UUID16 := $130,
SDP_ST_UINT32 := $210,
SDP_ST_INT32 := $220,
SDP_ST_UUID32 := $230,
SDP_ST_UINT64 := $310,
SDP_ST_INT64 := $320,
SDP_ST_UINT128 := $410,
SDP_ST_INT128 := $420,
SDP_ST_UUID128 := $430);
PSDP_SPECIFICTYPE = ^SDP_SPECIFICTYPE;
type
_SdpAttributeRange = record
minAttribute:USHORT;
maxAttribute:USHORT;
end;
SdpAttributeRange = _SdpAttributeRange;
PSdpAttributeRange = ^_SdpAttributeRange;
type
SdpQueryUuidUnion = record
case integer of
0: (uuid128:GUID);
1: (uuid32:ULONG);
2: (uuid16:USHORT);
end;
type
_SdpQueryUuid = record
u:SdpQueryUuidUnion;
uuidType:USHORT;
end;
SdpQueryUuid = _SdpQueryUuid;
PSdpQueryUuid = ^_SdpQueryUuid;
const
BTH_SDP_VERSION = 1;
type
_BTHNS_SETBLOB = record
pSdpVersion:PULONG;
pRecordHandle:PULONG;
Reserved:array[0..3] of ULONG;
fSecurity:ULONG;
fOptions:ULONG;
ulRecordLength:ULONG;
pRecord:array[0..0] of UCHAR;
end;
BTHNS_SETBLOB = _BTHNS_SETBLOB;
PBTHNS_SETBLOB = ^_BTHNS_SETBLOB;
const
MAX_UUIDS_IN_QUERY = 12;
SDP_SERVICE_SEARCH_REQUEST = 1;
SDP_SERVICE_ATTRIBUTE_REQUEST = 2;
SDP_SERVICE_SEARCH_ATTRIBUTE_REQUEST = 3;
//
// The following may be passed as parameters to BthNsLookupServiceNext as extended
// dwFlags options for device inquiry.
//
const
// Causes traversal through list to be reset to first element.
BTHNS_LUP_RESET_ITERATOR = $00010000;
// Does not increment list, causes next query to be performed on current item as well.
BTHNS_LUP_NO_ADVANCE = $00020000;
// Causes LookupServiceEnd to abort current inquiry.
BTHNS_ABORT_CURRENT_INQUIRY = $fffffffd;
type
_BTHNS_INQUIRYBLOB = record
LAP:ULONG;
_length:byte;
num_responses:byte;
end;
BTHNS_INQUIRYBLOB = _BTHNS_INQUIRYBLOB;
PBTHNS_INQUIRYBLOB = ^_BTHNS_INQUIRYBLOB;
type
_BTHNS_RESTRICTIONBLOB = record
_type:ULONG;
serviceHandle:ULONG;
uuids:array[0..11] of SdpQueryUuid;
numRange:ULONG;
pRange:array[0..0] of SdpAttributeRange;
end;
BTHNS_RESTRICTIONBLOB = _BTHNS_RESTRICTIONBLOB;
PBTHNS_RESTRICTIONBLOB = ^_BTHNS_RESTRICTIONBLOB;
{$DEFINE __BTHSDPDEF_H__}
{$ENDIF __BTHSDPDEF_H__}
type
SdpString = record
val:^ShortInt;
_length:ULONG;
end;
//
// flags for fConnect in SdpSearch::Connect
//
const
SDP_SEARCH_LOCAL = $00000001;
SDP_SEARCH_CACHED = $00000002;
type
// Forward declarations.
ISdpNodeContainer = interface;
ISdpRecord = interface;
PISdpRecord = ^ISdpRecord;
PPISdpRecord = ^PISdpRecord;
NodeDataUnion = record
case integer of
0: (int128:SDP_LARGE_INTEGER_16);
1: (uint128:SDP_ULARGE_INTEGER_16);
2: (uuid128:GUID);
3: (uuid32:ULONG);
4: (uuid16:USHORT);
5: (int64:LONGLONG);
6: (uint64:ULONGLONG);
7: (int32:LONG);
8: (uint32:ULONG);
9: (int16:SHORT);
10: (uint16:USHORT);
11: (int8:ShortInt);
12: (uint8:UCHAR);
13: (booleanVal:UCHAR);
14: (str:SdpString);
15: (url:SdpString);
16: (container:pointer{ISdpNodeContainer});
end;
NodeData = record
_type:USHORT;
specificType:USHORT;
u:NodeDataUnion;
end;
PNODEDATA = ^NodeData;
BthDeviceStringType = (BthDeviceStringTypeFriendlyName := 0,
BthDeviceStringTypeDeviceName,
BthDeviceStringTypeDisplay,
BthDeviceStringTypeClass,
BthDeviceStringTypeAddress);
// #pragma pack(push)
// #pragma pack(1)
{$PACKRECORDS 1}
_BthDeviceInfo = record
btAddress:ULONGLONG;
cod:ULONG;
lmpSupportedFeatures:ULONGLONG;
name:array[0..247] of ShortInt;
end;
BthDeviceInfo = _BthDeviceInfo;
PBthDeviceInfo = ^_BthDeviceInfo;
{$PACKRECORDS DEFAULT}
// #pragma pack(pop)
// Needful types.
PPUCHAR = ^PUCHAR;
PPUSHORT = ^PUSHORT;
PPWCHAR = ^PWCHAR;
ISdpWalk = interface(IUnknown)
['{57134AE6-5D3C-462D-BF2F-810361FBD7E7}']
function WalkNode(pData:PNODEDATA; state:ULONG):HRESULT; stdcall;
function WalkStream(elementType:UCHAR; elementSize:ULONG; pStream:PUCHAR):HRESULT; stdcall;
end;
ISdpNodeContainer = interface(IUnknown)
['{43F6ED49-6E22-4F81-A8EB-DCED40811A77}']
function CreateStream(out ppStream:PUCHAR;{ppStream:PPUCHAR;} pSize:PULONG):HRESULT; stdcall;
function WriteStream(pStream:PUCHAR; pNumBytesWritten:PULONG):HRESULT; stdcall;
function AppendNode(pData:PNODEDATA):HRESULT; stdcall;
function GetType(pType:PNodeContainerType):HRESULT; stdcall;
function SetType(_type:NodeContainerType):HRESULT; stdcall;
function Walk(pWalk:ISdpWalk):HRESULT; stdcall;
function SetNode(nodeIndex:ULONG; pData:PNODEDATA):HRESULT; stdcall;
function GetNode(nodeIndex:ULONG; pData:PNODEDATA):HRESULT; stdcall;
function LockContainer(lock:UCHAR):HRESULT; stdcall;
function GetNodeCount(pNodeCount:PULONG):HRESULT; stdcall;
function CreateFromStream(pStream:PUCHAR; _size:ULONG):HRESULT; stdcall;
function GetNodeStringData(nodeIndex:ULONG; pData:PNODEDATA):HRESULT; stdcall;
function GetStreamSize(pSize:PULONG):HRESULT; stdcall;
end;
ISdpSearch = interface(IUnknown)
['{D93B6B2A-5EEF-4E1E-BECF-F5A4340C65F5}']
function _Begin(pAddrss:PULONGLONG; fConnect:ULONG):HRESULT; stdcall;
function _End:HRESULT; stdcall;
function ServiceSearch(pUuidList:PSdpQueryUuid;
listSize:ULONG;
pHandles:PULONG;
pNumHandles:PUSHORT):HRESULT; stdcall;
function AttributeSearch(_handle:ULONG;
pRangeListP:SdpAttributeRange;
numRanges:ULONG;
out ppSdpRecord:ISdpRecord{ppSdpRecord:PISdpRecord}):HRESULT; stdcall;
function ServiceAndAttributeSearch(pUuidList:PSdpQueryUuid;
listSize:ULONG;
pRangeList:PSdpAttributeRange;
numRanges:ULONG;
out pppSdpRecord:PISdpRecord{pppSdpRecord:PPISdpRecord};
pNumRecords:PULONG):HRESULT; stdcall;
end;
ISdpStream = interface(IUnknown)
['{A6ECD9FB-0C7A-41A3-9FF0-0B617E989357}']
{$IF DEFINED(WINCE) OR DEFINED(WINCE_EMULATION)}
function Validate(pStream:PUCHAR; _size:ULONG; pErrorByte:PULONG):HRESULT; stdcall;
{$ELSE}
function Validate(pStream:PUCHAR; _size:ULONG; pErrorByte:PULONG_PTR):HRESULT; stdcall;
{$ENDIF}
function Walk(pStream:PUCHAR; _size:ULONG; pWalk:ISdpWalk):HRESULT; stdcall;
function RetrieveRecords(pStream:PUCHAR; _size:ULONG; var ppSdpRecords:ISdpRecord;{ppSdpRecords:PISdpRecord;} pNumRecords:PULONG):HRESULT; stdcall;
function RetrieveUuid128(pStream:PUCHAR; pUuid128:PGUID):HRESULT; stdcall;
function RetrieveUint16(pStream:PUCHAR; pUint16:PUSHORT):HRESULT; stdcall;
function RetrieveUint32(pStream:PUCHAR; pUint32:ULONG):HRESULT; stdcall;
function RetrieveUint64(pStream:PUCHAR; pUint64:PULONGLONG):HRESULT; stdcall;
function RetrieveUint128(pStream:PUCHAR; pUint128:PSDP_ULARGE_INTEGER_16):HRESULT; stdcall;
function RetrieveInt16(pStream:PUCHAR; pInt16:PSHORT):HRESULT; stdcall;
function RetrieveInt32(pStream:PUCHAR; pInt32:PLONG):HRESULT; stdcall;
function RetrieveInt64(pStream:PUCHAR; pInt64:PLONGLONG):HRESULT; stdcall;
function RetrieveInt128(pStream:PUCHAR; pInt128:PSDP_LARGE_INTEGER_16):HRESULT; stdcall;
function ByteSwapUuid128(pInUuid128:PGUID; pOutUuid128:PGUID):HRESULT; stdcall;
function ByteSwapUint128(pInUint128:PSDP_ULARGE_INTEGER_16; pOutUint128:PSDP_ULARGE_INTEGER_16):HRESULT; stdcall;
function ByteSwapUint64(inUint64:ULONGLONG; pOutUint64:PULONGLONG):HRESULT; stdcall;
function ByteSwapUint32(uint32:ULONG; pUint32:PULONG):HRESULT; stdcall;
function ByteSwapUint16(uint16:USHORT; pUint16:PUSHORT):HRESULT; stdcall;
function ByteSwapInt128(pInInt128:PSDP_LARGE_INTEGER_16; pOutInt128:PSDP_LARGE_INTEGER_16):HRESULT; stdcall;
function ByteSwapInt64(inInt64:LONGLONG; pOutInt64:PLONGLONG):HRESULT; stdcall;
function ByteSwapInt32(int32:LONG; pInt32:PLONG):HRESULT; stdcall;
function ByteSwapInt16(int16:SHORT; pInt16:PSHORT):HRESULT; stdcall;
function NormalizeUuid(pDataUuid:PNODEDATA; pNormalizeUuid:PGUID):HRESULT; stdcall;
function RetrieveElementInfo(pStream:PUCHAR;
pElementType:PSDP_TYPE;
pElementSpecificType:PSDP_SPECIFICTYPE;
pElementSize:PULONG;
pStorageSize:PULONG;
out ppData:PUCHAR{ppData:PPUCHAR}):HRESULT; stdcall;
function VerifySequenceOf(pStream:PUCHAR; _size:PULONG; ofType:SDP_TYPE; pSpecificSizes:PUCHAR; pNumFound:PULONG):HRESULT; stdcall;
end;
ISdpRecord = interface(IUnknown)
['{10276714-1456-46D7-B526-8B1E83D5116E}']
function CreateFromStream(pStream:PUCHAR; _size:ULONG):HRESULT; stdcall;
function WriteToStream(out ppStream:PUCHAR;{ppStream:PPUCHAR;} pStreamSize:PULONG; preSize:ULONG; postSize:ULONG):HRESULT; stdcall;
function SetAttribute(attribute:USHORT; pNode:PNODEDATA):HRESULT; stdcall;
function SetAttributeFromStream(attribute:USHORT; pStream:PUCHAR; _size:ULONG):HRESULT; stdcall;
function GetAttribute(attribute:USHORT; pNode:PNODEDATA):HRESULT; stdcall;
function GetAttributeAsStream(attribute:USHORT; out ppStream:PUCHAR;{ppStream:PPUCHAR;} pSize:PULONG):HRESULT; stdcall;
function Walk(pWalk:ISdpWalk):HRESULT; stdcall;
function GetAttributeList(out ppList:PUSHORT;{ppList:PPUSHORT;} pListSize:PULONG):HRESULT; stdcall;
function GetString(_offset:USHORT; pLangId:PUSHORT; var ppString:PWCHAR{ppString:PPWCHAR}):HRESULT; stdcall;
function GetIcon(cxRes:longint; cyRes:longint; phIcon:LPHICON):HRESULT; stdcall;
function GetServiceClass(pServiceClass:LPGUID):HRESULT; stdcall;
end;
IBluetoothDevice = interface(IUnknown)
['{5BD0418B-D705-4766-B215-183E4EADE341}']
function Initialize(pInfo:PBthDeviceInfo):HRESULT; stdcall;
function GetInfo(pInfo:PBthDeviceInfo):HRESULT; stdcall;
function GetString(_type:BthDeviceStringType; var ppString:PWCHAR{ppString:PPWCHAR}):HRESULT; stdcall;
function SetString(_type:BthDeviceStringType; pString:PWCHAR):HRESULT; stdcall;
function GetIcon(cxRes:longint; cyRes:longint; phIcon:LPHICON):HRESULT; stdcall;
function GetApprovedServices(pServices:PGUID; pServiceCount:PULONG):HRESULT; stdcall;
function GetPassKey(hwndParent:HWND; pPassKey:PUCHAR; pPassKeyLength:PUCHAR):HRESULT; stdcall;
end;
IBluetoothAuthenticate = interface(IUnknown)
['{5F0FBA2B-8300-429D-99AD-96A2835D4901}']
end;
implementation
end.

View File

@ -0,0 +1,83 @@
{
This file is part of the Free Pascal run time library.
Copyright (c) 2008 Free Pascal development team.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
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.
********************************************************************** }
//
// Microsoft Windows Mobile 6.0 for PocketPC SDK.
//
unit bthutil;
{$CALLING cdecl}
interface
uses Windows;
////////////////////////////////////////////////////////////////////////////////
//
// @enum BTH_RADIO_MODE |
// Enumerate all the possible modes of operation of the bluetooth radio
//
////////////////////////////////////////////////////////////////////////////////
type
BTH_RADIO_MODE = DWORD;
const
BTH_POWER_OFF = 0;
BTH_CONNECTABLE = 1;
BTH_DISCOVERABLE = 2;
const
BthutilDLL = 'bthutil.dll';
////////////////////////////////////////////////////////////////////////////////
//
// @func int | BthSetMode |
// This function set the bluetooth Mode of operation and reflects it in
// the control panel. It also persist that state across hardware insertion
// and reboot
//
// @syntax BthSetMode( DWORD dwMode )
//
// @parm DWORD | dwMode |
// BTH_POWER_OFF to turn the bluetooth radio OFF
// BTH_CONNECTABLE to turn the bluetooth radio ON and CONNECTABLE
// BTH_DISCOVERABLE to turn the bluetooth radio ON and CONNECTABLE and DISCOVERABLE
//
// @rdesc int: ERROR_SUCCESS on success. Error code describing error on failure.
//
////////////////////////////////////////////////////////////////////////////////
function BthSetMode(dwMode:DWORD):longint; external BthutilDLL name 'BthSetMode';
////////////////////////////////////////////////////////////////////////////////
//
// @func int | BthGetMode |
// This function retrieves the current mode of operation of the bluetooth radio
//
// @syntax BthGetMode( DWORD* pdwMode )
//
// @parm DWORD* | pdwMode |
// BTH_POWER_OFF to indicate the bluetooth radio is OFF
// BTH_CONNECTABLE to indicate the bluetooth radio ON and CONNECTABLE
// BTH_DISCOVERABLE to indicate the bluetooth radio ON and CONNECTABLE and DISCOVERABLE
//
// @rdesc int: ERROR_SUCCESS on success. Error code describing error on failure.
//
////////////////////////////////////////////////////////////////////////////////
function BthGetMode(pdwMode:LPDWORD):longint; external BthutilDLL name 'BthGetMode';
implementation
end.

View File

@ -23,7 +23,7 @@ interface
uses
aygshell,commctrl,commdlg,iphlpapi,notify,oleauto,power,shellapi,simmgr,tapi,
gpsapi,todaycmn,windbase,cesync,gx,winioctl,msgqueue,pm,service,htmlctrl,
sipapi, cpl;
sipapi, cpl, bt_api, bt_sdp, bthapi, bthutil, pimstore, ril, sms, ws2bth;
implementation

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,582 @@
{
This file is part of the Free Pascal run time library.
Copyright (c) 2008 Free Pascal development team.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
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.
********************************************************************** }
//
// Module: sms.h
//
//
// Microsoft Windows Mobile 6.0 for PocketPC SDK.
//
unit sms;
{$CALLING cdecl}
interface
uses Windows;
//
// Errors
//
const
FACILITY_SMS = $0200;
// MAKE_HRESULT rules OK!
// Specific registration errors (for SmsSetMessageNotification, SmsClearMessageNotification)
const
SMS_E_INVALIDPROTOCOL = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0001;
SMS_E_REGISTRATIONEXISTS = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0002;
SMS_S_NOSUCHREGISTRATION = (SEVERITY_SUCCESS shl 31) or (FACILITY_SMS shl 16) or $0003;
// Specific messaging errors (for SmsOpen, SmsSendMessage, SmsGetSMSC, etc.)
SMS_E_TOOMUCHDATA = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0100;
SMS_E_INVALIDDATA = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0101;
SMS_E_BUFFERTOOSMALL = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0102;
SMS_E_PROVIDERSPECIFICBUFFERWRONGSIZE = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0103;
SMS_E_TIMEUNAVAILABLE = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0104;
SMS_E_RECEIVEHANDLEALREADYOPEN = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0105;
SMS_E_DESTINATIONOUTOFSVC = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0106;
SMS_E_INVALIDADDRESS = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0107;
SMS_E_MSGBARREDBYOPERATOR = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0108;
SMS_E_MSGCALLBARRED = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0109;
SMS_E_NOSCSUBSCRIPTION = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010a;
SMS_E_SCBUSY = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010b;
SMS_E_SVCNOTSUBSCRIBED = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010c;
SMS_E_UNASSIGNEDNUMBER = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010d;
SMS_E_UNKNOWNSCADDRESS = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010e;
SMS_E_UNIDENTIFIEDSUBCRIBER = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010f;
SMS_E_FDNRESTRICT = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0110;
// General SMS messaging errors
SMS_E_MISC = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0200;
SMS_E_PASSWORD = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0201;
SMS_E_SIM = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0202;
SMS_E_NETWORKACCESS = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0203;
SMS_E_NETWORK = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0204;
SMS_E_MOBILE = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0205;
SMS_E_NETWORKUNSUPPORTED = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0206;
SMS_E_MOBILEUNSUPPORTED = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0207;
SMS_E_BADPARAM = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0208;
SMS_E_STORAGE = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0209;
SMS_E_SMSC = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $020a;
SMS_E_DESTINATION = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $020b;
SMS_E_DESTINATIONUNSUPPORTED = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $020c;
SMS_E_RADIOUNAVAILABLE = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $020d;
//
// Constants
//
const
SMS_DATAGRAM_SIZE = 140;
SMS_BROADCAST_DATAGRAM_SIZE = 82;
SMS_MAX_APPNAME_LENGTH = MAX_PATH;
SMS_MAX_PARAMS_LENGTH = MAX_PATH;
SMS_MAX_PROTOCOLNAME_LENGTH = MAX_PATH;
SMS_MAX_MESSAGEUID_SIZE = 1024;
SMS_MAX_ADDRESS_LENGTH = 256;
SMS_MAX_SUBADDRESS_SIZE = 256;
// dwMessageModes for SmsOpen
SMS_MODE_RECEIVE = $00000001;
SMS_MODE_SEND = $00000002;
// dwOptions for SmsSendMessage
SMS_OPTION_DELIVERY_NONE = $00000000;
SMS_OPTION_DELIVERY_NO_RETRY = $00000001;
// dwMessageOptions for TEXT_PROVIDER_SPECIFIC_DATA
PS_MESSAGE_OPTION_NONE = $00000000;
PS_MESSAGE_OPTION_REPLYPATH = $00000001;
PS_MESSAGE_OPTION_STATUSREPORT = $00000002;
PS_MESSAGE_OPTION_DISCARD = $00000004;
// dwMessageStatus0 and dwMessageStatus1 for SmsGetMessageStatus and the SMS status-message provider (SMS_MSGTYPE_STATUS)
// Message status is unknown iff dwMessageStatus0 and dwMessageStatus1 are both set to MESSAGE_STATUS_UNKNOWN
MESSAGE_STATUS_UNKNOWN = $00000000;
// Valid bits for dwMessageStatus0
MESSAGE_STATUS_0_RECEIVEDBYSME = $00000001;
MESSAGE_STATUS_0_FORWARDEDTOSME = $00000002;
MESSAGE_STATUS_0_REPLACEDBYSC = $00000004;
MESSAGE_STATUS_0_CONGESTION_TRYING = $00000008;
MESSAGE_STATUS_0_SMEBUSY_TRYING = $00000010;
MESSAGE_STATUS_0_SMENOTRESPONDING_TRYING = $00000020;
MESSAGE_STATUS_0_SVCREJECTED_TRYING = $00000040;
MESSAGE_STATUS_0_QUALITYUNAVAIL_TRYING = $00000080;
MESSAGE_STATUS_0_SMEERROR_TRYING = $00000100;
MESSAGE_STATUS_0_CONGESTION = $00000200;
MESSAGE_STATUS_0_SMEBUSY = $00000400;
MESSAGE_STATUS_0_SMENOTRESPONDING = $00000800;
MESSAGE_STATUS_0_SVCREJECTED = $00001000;
MESSAGE_STATUS_0_QUALITYUNAVAIL_TEMP = $00002000;
MESSAGE_STATUS_0_SMEERROR = $00004000;
MESSAGE_STATUS_0_REMOTEPROCERROR = $00008000;
MESSAGE_STATUS_0_INCOMPATIBLEDEST = $00010000;
MESSAGE_STATUS_0_CONNECTIONREJECTED = $00020000;
MESSAGE_STATUS_0_NOTOBTAINABLE = $00040000;
MESSAGE_STATUS_0_NOINTERNETWORKING = $00080000;
MESSAGE_STATUS_0_VPEXPIRED = $00100000;
MESSAGE_STATUS_0_DELETEDBYORIGSME = $00200000;
MESSAGE_STATUS_0_DELETEDBYSC = $00400000;
MESSAGE_STATUS_0_NOLONGEREXISTS = $00800000;
MESSAGE_STATUS_0_QUALITYUNAVAIL = $01000000;
MESSAGE_STATUS_0_RESERVED_COMPLETED = $02000000;
MESSAGE_STATUS_0_RESERVED_TRYING = $04000000;
MESSAGE_STATUS_0_RESERVED_ERROR = $08000000;
MESSAGE_STATUS_0_RESERVED_TMPERROR = $10000000;
MESSAGE_STATUS_0_SCSPECIFIC_COMPLETED = $20000000;
MESSAGE_STATUS_0_SCSPECIFIC_TRYING = $40000000;
MESSAGE_STATUS_0_SCSPECIFIC_ERROR = $80000000;
// Valid bits for dwMessageStatus1
MESSAGE_STATUS_1_SCSPECIFIC_TMPERROR = $00000001;
// Language identifiers for SMS_BROADCAST_RANGES.dwBroadcastMsgLangs
SMS_DCSLANG_UNKNOWN = $00000001;
SMS_DCSLANG_GERMAN = $00000002;
SMS_DCSLANG_ENGLISH = $00000004;
SMS_DCSLANG_ITALIAN = $00000008;
SMS_DCSLANG_FRENCH = $00000010;
SMS_DCSLANG_SPANISH = $00000020;
SMS_DCSLANG_DUTCH = $00000040;
SMS_DCSLANG_SWEDISH = $00000080;
SMS_DCSLANG_DANISH = $00000100;
SMS_DCSLANG_PORTUGUESE = $00000200;
SMS_DCSLANG_FINNISH = $00000400;
SMS_DCSLANG_NORWEGIAN = $00000800;
SMS_DCSLANG_GREEK = $00001000;
SMS_DCSLANG_TURKISH = $00002000;
SMS_DCSLANG_HUNGARIAN = $00004000;
SMS_DCSLANG_POLISH = $00008000;
SMS_DCSLANG_CZECH = $00010000;
SMS_DCSLANG_HEBREW = $00020000;
SMS_DCSLANG_ARABIC = $00040000;
SMS_DCSLANG_RUSSIAN = $00080000;
SMS_DCSLANG_ICELANDIC = $00100000;
SMS_DCSLANG_ALL = $001fffff;
// Valid flags for SMS_BROADCAST_RANGES.dwParams
SMS_PARAM_SBR_BROADCASTMSGIDS = $00000001;
SMS_PARAM_SBR_BROADCASTMSGLANGS = $00000002;
SMS_PARAM_SBR_ACCEPTIDS = $00000004;
//Valid values for ProtocolID
SMS_MSGPROTOCOL_UNKNOWN = $00000000;
SMS_MSGPROTOCOL_SMETOSME = $00000001;
SMS_MSGPROTOCOL_IMPLICIT = $00000002;
SMS_MSGPROTOCOL_TELEX = $00000003;
SMS_MSGPROTOCOL_TELEFAX_GROUP3 = $00000004;
SMS_MSGPROTOCOL_TELEFAX_GROUP4 = $00000005;
SMS_MSGPROTOCOL_VOICEPHONE = $00000006;
SMS_MSGPROTOCOL_ERMES = $00000007;
SMS_MSGPROTOCOL_PAGING = $00000008;
SMS_MSGPROTOCOL_VIDEOTEX = $00000009;
SMS_MSGPROTOCOL_TELETEX = $0000000a;
SMS_MSGPROTOCOL_TELETEX_PSPDN = $0000000b;
SMS_MSGPROTOCOL_TELETEX_CSPDN = $0000000c;
SMS_MSGPROTOCOL_TELETEX_PSTN = $0000000d;
SMS_MSGPROTOCOL_TELETEX_ISDN = $0000000e;
SMS_MSGPROTOCOL_UCI = $0000000f;
SMS_MSGPROTOCOL_MSGHANDLING = $00000010;
SMS_MSGPROTOCOL_X400 = $00000011;
SMS_MSGPROTOCOL_EMAIL = $00000012;
SMS_MSGPROTOCOL_SCSPECIFIC1 = $00000013;
SMS_MSGPROTOCOL_SCSPECIFIC2 = $00000014;
SMS_MSGPROTOCOL_SCSPECIFIC3 = $00000015;
SMS_MSGPROTOCOL_SCSPECIFIC4 = $00000016;
SMS_MSGPROTOCOL_SCSPECIFIC5 = $00000017;
SMS_MSGPROTOCOL_SCSPECIFIC6 = $00000018;
SMS_MSGPROTOCOL_SCSPECIFIC7 = $00000019;
SMS_MSGPROTOCOL_GSMSTATION = $0000001a;
SMS_MSGPROTOCOL_SM_TYPE0 = $0000001b;
SMS_MSGPROTOCOL_RSM_TYPE1 = $0000001c;
SMS_MSGPROTOCOL_RSM_TYPE2 = $0000001d;
SMS_MSGPROTOCOL_RSM_TYPE3 = $0000001e;
SMS_MSGPROTOCOL_RSM_TYPE4 = $0000001f;
SMS_MSGPROTOCOL_RSM_TYPE5 = $00000020;
SMS_MSGPROTOCOL_RSM_TYPE6 = $00000021;
SMS_MSGPROTOCOL_RSM_TYPE7 = $00000022;
SMS_MSGPROTOCOL_RETURNCALL = $00000023;
SMS_MSGPROTOCOL_ME_DOWNLOAD = $00000024;
SMS_MSGPROTOCOL_DEPERSONALIZATION = $00000025;
SMS_MSGPROTOCOL_SIM_DOWNLOAD = $00000026;
//
// Enumerations
//
type
SMS_ADDRESS_TYPE = (SMSAT_UNKNOWN := 0,
SMSAT_INTERNATIONAL,
SMSAT_NATIONAL,
SMSAT_NETWORKSPECIFIC,
SMSAT_SUBSCRIBER,
SMSAT_ALPHANUMERIC,
SMSAT_ABBREVIATED);
SMS_DATA_ENCODING = (SMSDE_OPTIMAL := 0,
SMSDE_GSM,
SMSDE_UCS2);
PROVIDER_SPECIFIC_MESSAGE_CLASS = (PS_MESSAGE_CLASS0 := 0,
PS_MESSAGE_CLASS1,
PS_MESSAGE_CLASS2,
PS_MESSAGE_CLASS3,
PS_MESSAGE_CLASSUNSPECIFIED);
PROVIDER_SPECIFIC_REPLACE_OPTION = (PSRO_NONE := 0,
PSRO_REPLACE_TYPE1,
PSRO_REPLACE_TYPE2,
PSRO_REPLACE_TYPE3,
PSRO_REPLACE_TYPE4,
PSRO_REPLACE_TYPE5,
PSRO_REPLACE_TYPE6,
PSRO_REPLACE_TYPE7,
PSRO_RETURN_CALL,
PSRO_DEPERSONALIZATION);
//
// Types
//
type
SMS_HANDLE = DWORD;
LPSMS_HANDLE = ^SMS_HANDLE;
SMS_MESSAGE_ID = DWORD;
LPSMS_MESSAGE_ID = ^SMS_MESSAGE_ID;
const
INVALID_MESSAGE_ID = SMS_MESSAGE_ID($ffffffff);
// Registration structure used by SmsSetMessageNotification and SmsClearMessageNotification
type
smsregistrationdata_tag = record
cbSize:DWORD;
tszAppName:array[0..SMS_MAX_APPNAME_LENGTH-1] of TCHAR;
tszParams:array[0..SMS_MAX_PARAMS_LENGTH-1] of TCHAR;
tszProtocolName:array[0..SMS_MAX_PROTOCOLNAME_LENGTH-1] of TCHAR;
end;
SMSREGISTRATIONDATA = smsregistrationdata_tag;
LPSMSREGISTRATIONDATA = ^smsregistrationdata_tag;
// SMS addressing information
type
sms_address_tag = record
smsatAddressType:SMS_ADDRESS_TYPE;
ptsAddress:array[0..SMS_MAX_ADDRESS_LENGTH-1] of TCHAR;
end;
SMS_ADDRESS = sms_address_tag;
LPSMS_ADDRESS = ^sms_address_tag;
// SMS status message information
type
sms_status_information_tag = record
smsmidMessageID:SMS_MESSAGE_ID;
dwMessageStatus0:DWORD;
dwMessageStatus1:DWORD;
smsaRecipientAddress:SMS_ADDRESS;
stServiceCenterTimeStamp:SYSTEMTIME; // (UTC time)
stDischargeTime:SYSTEMTIME; // (UTC time)
end;
SMS_STATUS_INFORMATION = sms_status_information_tag;
LPSMS_STATUS_INFORMATION = ^sms_status_information_tag;
// SMS broadcast message range information
type
sms_range_tag = record
dwMinimum:DWORD;
dwMaximum:DWORD;
end;
SMS_RANGE = sms_range_tag;
LPSMS_RANGE = ^sms_range_tag;
// SMS broadcast message ranges information
// Use #pragma to avoid "warning C4200: nonstandard extension used : zero-sized array in struct/union
type
sms_broadcast_ranges_tag = record
cbSize:DWORD;
dwParams:DWORD;
dwNumRanges:DWORD;
dwBroadcastMsgLangs:DWORD;
bAccept:BOOL;
smsrBroadcastRanges:array[0..0] of SMS_RANGE;
end;
SMS_BROADCAST_RANGES = sms_broadcast_ranges_tag;
LPSMS_BROADCAST_RANGES = ^sms_broadcast_ranges_tag;
//
// SMS message types (for use with SmsOpen)
//
// Text message type
const
SMS_MSGTYPE_TEXT = 'Microsoft Text SMS Protocol';
// Provider-specific data for use with SmsSendMessage and SmsReadMessage
// Bitfield values for the extended parameters of the text provider structure.
const
TEXTPSEXTPARM_NONE = $00000000;
TEXTPSEXTPARM_CALLBACK = $00000001;
TEXTPSEXTPARM_PRIORITY = $00000002;
TEXTPSEXTPARM_ALL = $00000003;
// The priority enum should match up with the RIL_MSGPRIORITY_* defines.
// If any new values are added, the Priority mapping functions of sms_txtshared_cdma.cpp
// should also be adjusted.
type
TEXT_PROVIDER_SPECIFIC_PRIORITY_TYPE = (TEXTPSPRI_NONE := 0,
TEXTPSPRI_NORMAL := 1,
TEXTPSPRI_INTERACTIVE,
TEXTPSPRI_URGENT,
TEXTPSPRI_EMERGENCY);
type
text_provider_specific_data_tag = record
dwMessageOptions:DWORD;
psMessageClass:PROVIDER_SPECIFIC_MESSAGE_CLASS;
psReplaceOption:PROVIDER_SPECIFIC_REPLACE_OPTION;
dwHeaderDataSize:DWORD;
pbHeaderData:array[0..SMS_DATAGRAM_SIZE-1] of byte; // For concatenated messages, only the header from the first segment is returned.
fMessageContainsEMSHeaders:BOOL; // At least one segment of this message contains EMS headers.
// Only set if EMS handler installed.
dwProtocolID:DWORD; // PID of incoming message, or desired PID of outgoing message.
// Applies only to GSM. Set to SMS_MSGPROTOCOL_UNKNOWN if psReplaceOption
// is not PSRO_NONE.
dwExtParams:DWORD; // Bitfield of valid additional structure parameters (all structure
// values above are considered always valid).
tpsPriority:TEXT_PROVIDER_SPECIFIC_PRIORITY_TYPE; // Applies only to CDMA IS637. Priority indicator.
smsaCallback:SMS_ADDRESS; // Applies only to CDMA IS637. Callback number
end;
TEXT_PROVIDER_SPECIFIC_DATA = text_provider_specific_data_tag;
// Class 2 Text message type
const
SMS_MSGTYPE_CLASS2 = 'Microsoft Class2 SMS Protocol';
type
class2_provider_specific_data_tag = record
dwMessageOptions:DWORD;
psMessageClass:PROVIDER_SPECIFIC_MESSAGE_CLASS;
psReplaceOption:PROVIDER_SPECIFIC_REPLACE_OPTION;
dwHeaderDataSize:DWORD;
pbHeaderData:array[0..SMS_DATAGRAM_SIZE-1] of byte; // For concatenated messages, only the header from the first segment is returned.
fMessageContainsEMSHeaders:BOOL; // At least one segment of this message contains EMS headers.
// Only set if EMS handler installed.
dwProtocolID:DWORD; // PID of incoming message, or desired PID of outgoing message.
// Applies only to GSM. Set to SMS_MSGPROTOCOL_UNKNOWN if psReplaceOption
// is not PSRO_NONE.
dwLocation:DWORD;
dwIndex:DWORD;
end;
CLASS2_PROVIDER_SPECIFIC_DATA = class2_provider_specific_data_tag;
// Notification message type
const
SMS_MSGTYPE_NOTIFICATION = 'Microsoft Notification SMS Protocol (Receive Only)';
// Provider-specific data for use with SmsReadMessage
type
NOTIFICATION_PROVIDER_SPECIFIC_MSG_WAITING_TYPE = (NOTIFICATIONPSMWT_NONE := 0,
NOTIFICATIONPSMWT_GENERIC,
NOTIFICATIONPSMWT_VOICEMAIL,
NOTIFICATIONPSMWT_FAX,
NOTIFICATIONPSMWT_EMAIL,
NOTIFICATIONPSMWT_OTHER);
const
NOTIFICATIONPS_NUM_MSG_WAITING_UNKNOWN = -1;
NOTIFICATIONPS_NUM_MSG_WAITING_NONZERO = -2;
type
NOTIFICATION_PROVIDER_SPECIFIC_INDICATOR_TYPE = (NOTIFICATIONPSIT_NONE := 0,
NOTIFICATIONPSIT_LINE1 := 1,
NOTIFICATIONPSIT_LINE2 := 2);
type
notification_provider_specific_data_tag = record
dwMessageOptions:DWORD;
psMessageClass:PROVIDER_SPECIFIC_MESSAGE_CLASS;
psReplaceOption:PROVIDER_SPECIFIC_REPLACE_OPTION;
npsMsgWaitingType:NOTIFICATION_PROVIDER_SPECIFIC_MSG_WAITING_TYPE;
iNumberOfMessagesWaiting:longint;
npsIndicatorType:NOTIFICATION_PROVIDER_SPECIFIC_INDICATOR_TYPE;
end;
NOTIFICATION_PROVIDER_SPECIFIC_DATA = notification_provider_specific_data_tag;
// WDP message type
const
SMS_MSGTYPE_WDP = 'Microsoft WDP SMS Protocol';
// Provider-specific data for use with SmsSendMessage and SmsReadMessage
type
WDP_PROVIDER_SPECIFIC_PORT_ADDRESSING = (WDPPSPA_8_BIT_PORT_NUMBERS := 0,
WDPPSPA_16_BIT_PORT_NUMBERS);
type
wdp_provider_specific_data_tag = record
wdppsPortAddressing:WDP_PROVIDER_SPECIFIC_PORT_ADDRESSING;
wDestinationPort:word;
wOriginatorPort:word;
end;
WDP_PROVIDER_SPECIFIC_DATA = wdp_provider_specific_data_tag;
// WCMP message type
const
SMS_MSGTYPE_WCMP = 'Microsoft WCMP SMS Protocol';
// Provider-specific data for use with SmsSendMessage and SmsReadMessage
type
WCMP_PROVIDER_SPECIFIC_MESSAGE_TYPE = (WCMPPSMT_UNSUPPORTED := 0,
WCMPPSMT_PORT_UNREACHABLE,
WCMPPSMT_MESSAGE_TOO_BIG,
WCMPPSMT_ECHO_REQUEST,
WCMPPSMT_ECHO_REPLY);
type
wcmp_provider_specific_data_tag = record
wcmppsMessageType:WCMP_PROVIDER_SPECIFIC_MESSAGE_TYPE;
wParam1:word;
wParam2:word;
wParam3:word;
smsaAddress:SMS_ADDRESS;
end;
WCMP_PROVIDER_SPECIFIC_DATA = wcmp_provider_specific_data_tag;
// Status message type
const
SMS_MSGTYPE_STATUS = 'Microsoft Status Message SMS Protocol (Receive Only)';
// Provider-specific data for use with SmsReadMessage
type
status_provider_specific_data_tag = record
smssiStatusInformation:SMS_STATUS_INFORMATION;
end;
STATUS_PROVIDER_SPECIFIC_DATA = status_provider_specific_data_tag;
// Broadcast message type
const
SMS_MSGTYPE_BROADCAST = 'Microsoft Broadcast Message SMS Protocol (Receive Only)';
type
BROADCAST_PROVIDER_SPECIFIC_GEOGRAPHICAL_SCOPE = (BPSGS_UNKNOWN := 0,
BPSGS_CELL_DISPLAY_IMMEDIATE,
BPSGS_CELL,
BPSGS_PLMN,
BPSGS_LOCATION_AREA);
// Provider-specific data for use with SmsReadMessage
type
broadcast_provider_specific_data_tag = record
wMessageID:word;
wMessageCode:word;
bpsgsGeographicalScope:BROADCAST_PROVIDER_SPECIFIC_GEOGRAPHICAL_SCOPE;
wUpdateNumber:word;
end;
BROADCAST_PROVIDER_SPECIFIC_DATA = broadcast_provider_specific_data_tag;
// Raw message type
const
SMS_MSGTYPE_RAW = 'Microsoft Raw SMS Protocol (Receive Only)';
// Provider-specific data for use with SmsReadMessage
type
raw_provider_specific_data_tag = record
dwHeaderDataSize:DWORD;
pbHeaderData:array[0..SMS_DATAGRAM_SIZE-1] of byte;
end;
RAW_PROVIDER_SPECIFIC_DATA = raw_provider_specific_data_tag;
//
// APIs for SMS.dll
//
const
SmsDLL = 'sms.dll';
function SmsSetMessageNotification(psmsrd:LPSMSREGISTRATIONDATA):HRESULT; external SmsDLL name 'SmsSetMessageNotification';
function SmsClearMessageNotification(tszProtocolName:LPCTSTR):HRESULT; external SmsDLL name 'SmsClearMessageNotification';
// Open the SMS Messaging component for read and/or write access
//
// Each protocol may only have one handle open with SMS_MODE_RECEIVE.
// Additional attempts to get RECEIVE mode on a given protocol will result in
// SMS_E_RECEIVEHANDLEALREADYOPEN.
//
// Currently all protocols have applications whith open RECEIVE handles. As a
// result, using the SMS API to receive SMS messages is not supported. Attempts
// to do so may interfere with the proper operation of Inbox, WAP, or other SMS
// applications.
//
// The IMailRuleClient interface in cemapi.h may be used to access received
// text SMS messages.
function SmsOpen(ptsMessageProtocol:LPCTSTR;
dwMessageModes:DWORD;
psmshHandle:LPSMS_HANDLE;
phMessageAvailableEvent:LPHANDLE):HRESULT; external SmsDLL name 'SmsOpen';
// Close a handle to the SMS messaging component
function SmsClose(smshHandle:SMS_HANDLE):HRESULT; external SmsDLL name 'SmsClose';
// Send an SMS message
function SmsSendMessage(smshHandle:SMS_HANDLE;
psmsaSMSCAddress:LPSMS_ADDRESS;
psmsaDestinationAddress:SMS_ADDRESS;
pstValidityPeriod:LPSYSTEMTIME; // (Values in this structure are expressed relative to the current time)
pbData:LPBYTE;
dwDataSize:DWORD;
pbProviderSpecificData:LPBYTE;
dwProviderSpecificDataSize:DWORD;
smsdeDataEncoding:SMS_DATA_ENCODING;
dwOptions:DWORD;
psmsmidMessageID:LPSMS_MESSAGE_ID):HRESULT; external SmsDLL name 'SmsSendMessage';
// Determine an upper-bound for the size of the buffer needed by the next call to SmsReadMessage
function SmsGetMessageSize(smshHandle:SMS_HANDLE;
pdwDataSize:LPDWORD):HRESULT; external SmsDLL name 'SmsGetMessageSize';
// Read an SMS message (the appropriate size of the buffer can be found via a call to SmsGetMessageSize)
function SmsReadMessage(smshHandle:SMS_HANDLE;
psmsaSMSCAddress:LPSMS_ADDRESS;
psmsaSourceAddress:LPSMS_ADDRESS;
pstReceiveTime:LPSYSTEMTIME; // (UTC time)
pbBuffer:LPBYTE;
dwBufferSize:DWORD;
pbProviderSpecificBuffer:LPBYTE;
dwProviderSpecificDataBuffer:DWORD;
pdwBytesRead:LPDWORD):HRESULT; external SmsDLL name 'SmsReadMessage';
// Waits to receive a status-report for an SMS message
function SmsGetMessageStatus(smshHandle:SMS_HANDLE;
smsmidMessageID:SMS_MESSAGE_ID;
psmssiStatusInformation:LPSMS_STATUS_INFORMATION;
dwTimeout:DWORD):HRESULT; external SmsDLL name 'SmsGetMessageStatus';
// Get the default SMS Service Center address
function SmsGetSMSC(psmsaSMSCAddress:LPSMS_ADDRESS):HRESULT; external SmsDLL name 'SmsGetSMSC';
// Set the default SMS Service Center address
function SmsSetSMSC(psmsaSMSCAddress:LPSMS_ADDRESS):HRESULT; external SmsDLL name 'SmsSetSMSC';
// Get the range of broadcast messages to listen for
function SmsGetBroadcastMsgRanges(psmsbrBroadcastRanges:LPSMS_BROADCAST_RANGES):HRESULT; external SmsDLL name 'SmsGetBroadcastMsgRanges';
// Set the range of broadcast messages to listen for
function SmsSetBroadcastMsgRanges(psmsbrBroadcastRanges:LPSMS_BROADCAST_RANGES):HRESULT; external SmsDLL name 'SmsSetBroadcastMsgRanges';
// Get the device's phone number for SMS
function SmsGetPhoneNumber(psmsaAddress:LPSMS_ADDRESS):HRESULT; external SmsDLL name 'SmsGetPhoneNumber';
// Approximate the system time based on the time indicated by the SMSC in the last status-report message
function SmsGetTime(ptsCurrentTime:LPSYSTEMTIME; // (UTC time)
pdwErrorMargin:LPDWORD):HRESULT; external SmsDLL name 'SmsGetTime';
implementation
end.

View File

@ -0,0 +1,320 @@
{
This file is part of the Free Pascal run time library.
Copyright (c) 2008 Free Pascal development team.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
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.
********************************************************************** }
//
// Module Name:
//
// ws2bth.h
//
// Abstract:
//
// Winsock 2 Bluetooth Annex definitions.
//
//
// Microsoft Windows Mobile 6.0 for PocketPC SDK.
//
unit ws2bth;
{$CALLING cdecl}
interface
uses Windows;
const
BTH_MAX_NAME_SIZE = 248; // max length of device friendly name.
// Some explanations of the BT_ADDR structure.
// Taken from module bt_ddi.h which is a part of MS WinCE 6.0 Platform Builder
// and defines interfaces between layers of Bluetooth device driver.
// ------------------------------------ BD_ADDR------------------------------------
//
{$PACKRECORDS 1} // #pragma pack(push, 1)
type
__bd_addr = record
SAP:Cardinal; // Significant address part.
// The lower 24 bits are the 'Lower address part' and
// the higher 8 bits are the 'Upper address part'.
NAP:word; // Non-significant address part.
end;
BD_ADDR = __bd_addr;
(* Declared as:
typedef struct __bd_addr {
union {
struct {
unsigned int LAP : 24; // Lower address part
unsigned int UAP : 8; // Upper address part
};
unsigned int SAP; // Significant address part
};
unsigned short NAP; // Non-significant address part
} BD_ADDR;
*)
{$PACKRECORDS DEFAULT} // #pragma pack(pop)
const
BLUETOOTH_TRANSPORT_NAME = 'MSBT';
// End of BT_ADDR explanation.
type
BT_ADDR = ULONGLONG;
PBT_ADDR = ^BT_ADDR;
TBtAddr = BT_ADDR;
PBtAddr = ^TBtAddr;
type
BT_COD = ULONG;
TBtCod = BT_COD;
type
BT_LAP = ULONG;
TBtLap = BT_LAP;
const
NAP_MASK = ULONGLONG($FFFF00000000);
SAP_MASK = ULONGLONG($0000FFFFFFFF);
NAP_BIT_OFFSET = 8 * 4;
SAP_BIT_OFFSET = 0;
// Macro functions.
function GET_NAP(const _bt_addr:BT_ADDR):USHORT;
function GET_SAP(const _bt_addr:BT_ADDR):ULONG;
function SET_NAP(const _nap:USHORT):ULONGLONG;
function SET_SAP(const _sap:ULONG):ULONGLONG;
function SET_NAP_SAP(const _nap:USHORT; const _sap:ULONG):ULONGLONG;
// Turn 1 byte packing of structures on
const
L2CAP_MAX_MTU = 65535;
const
BT_ADDR_NULL = $000000000000;
BT_ADDR_IAC_FIRST = $9E8B00;
BT_ADDR_IAC_LAST = $9E8B3f;
BT_ADDR_LIAC = $9E8B00;
BT_ADDR_GIAC = $9E8B33;
BT_PORT_NULL = 0;
BT_PORT_WILDCARD = 0;
BT_PORT_ANY = -1;
BT_PORT_MIN = $1;
BT_PORT_MAX = $ffff;
BT_PORT_DYN_FIRST = $1001;
BT_PORT_EXCL_BIT = $0100;
const
AF_BTH = 32;
AF_BT = AF_BTH;
WINDOWS_AF_BT = AF_BTH;
AF_MAX = 33;
PF_BTH = AF_BTH;
PF_MAX = AF_BTH;
NS_BTH = 16;
const
SVCID_BTH_PROVIDER:GUID = (D1: $06AA63E0; D2: $7D60; D3: $41FF; D4: ($AF, $B2, $3E, $E6, $D2, $D9, $39, $2D));
// SVCID_BTH_PROVIDER:GUID = '{06AA63E0-7D60-41FF-AFB2-3EE6D2D9392D}';
// Bluetooth protocol #s are assigned according to the Bluetooth
// Assigned Numbers portion of the Bluetooth Specification
const
BTHPROTO_RFCOMM = $0003;
BTHPROTO_L2CAP = $0100;
SDP_ENUMDEVICES = $00000010;
SDP_SET = $00000011;
SDP_QUERY = $00000012;
RFCOMM_FLOW_CONTROL = $00000013;
SOL_RFCOMM = $03;
SOL_BTHTDI = $100;
SOL_SDP = $0101;
type
_BTH_SOCKOPT_SECURITY = record
iLength:longint; // == 0 or 16 for link key, 0<=..<=16 for PIN. 0 = revoke
btAddr:BT_ADDR;
caData:array[0..15] of byte;
end;
BTH_SOCKOPT_SECURITY = _BTH_SOCKOPT_SECURITY;
PBTH_SOCKOPT_SECURITY = ^_BTH_SOCKOPT_SECURITY;
type
_BTH_LOCAL_VERSION = record
hci_version:byte;
hci_revision:word;
lmp_version:byte;
lmp_subversion:word;
manufacturer:word;
lmp_features:array[0..7] of byte;
end;
BTH_LOCAL_VERSION = _BTH_LOCAL_VERSION;
PBTH_LOCAL_VERSION = ^_BTH_LOCAL_VERSION;
type
_BTH_REMOTE_VERSION = record
lmp_version:byte;
lmp_subversion:word;
manufacturer:word;
lmp_features:array[0..7] of byte;
end;
BTH_REMOTE_VERSION = _BTH_REMOTE_VERSION;
PBTH_REMOTE_VERSION = ^_BTH_REMOTE_VERSION;
type
_BTH_REMOTE_NAME = record
bt:BT_ADDR;
szNameBuffer:array[0..BTH_MAX_NAME_SIZE-1] of WideChar;
end;
BTH_REMOTE_NAME = _BTH_REMOTE_NAME;
PBTH_REMOTE_NAME = ^_BTH_REMOTE_NAME;
type
_BTH_HOLD_MODE = record
hold_mode_max:word;
hold_mode_min:word;
interval:word; // out
end;
BTH_HOLD_MODE = _BTH_HOLD_MODE;
PBTH_HOLD_MODE = ^_BTH_HOLD_MODE;
type
_BTH_SNIFF_MODE = record
sniff_mode_max:word;
sniff_mode_min:word;
sniff_attempt:word;
sniff_timeout:word;
interval:word; // out
end;
BTH_SNIFF_MODE = _BTH_SNIFF_MODE;
PBTH_SNIFF_MODE = ^_BTH_SNIFF_MODE;
type
_BTH_PARK_MODE = record
beacon_max:word;
beacon_min:word;
interval:word; // out
end;
BTH_PARK_MODE = _BTH_PARK_MODE;
PBTH_PARK_MODE = ^_BTH_PARK_MODE;
const
SO_BTH_AUTHENTICATE = $00000001; // optlen=0, optval ignored
SO_BTH_ENCRYPT = $00000002; // optlen=sizeof(unsigned int), optval = &(unsigned int)TRUE/FALSE
SO_BTH_SET_PIN = $00000003; // bound only! survives socket! optlen=sizeof(BTH_SOCKOPT_SECURITY), optval=&BTH_SOCKOPT_SECURITY
SO_BTH_SET_LINK = $00000004; // bound only! survives socket! optlen=sizeof(BTH_SOCKOPT_SECURITY), optval=&BTH_SOCKOPT_SECURITY
SO_BTH_GET_LINK = $00000005; // bound only! optlen=sizeof(BTH_SOCKOPT_SECURITY), optval=&BTH_SOCKOPT_SECURITY
SO_BTH_SET_MTU = $00000006; // unconnected only! optlen=sizeof(unsigned int), optval = &mtu
SO_BTH_GET_MTU = $00000007; // optlen=sizeof(unsigned int), optval = &mtu
SO_BTH_SET_MTU_MAX = $00000008; // unconnected only! optlen=sizeof(unsigned int), optval = &max. mtu
SO_BTH_GET_MTU_MAX = $00000009; // bound only! optlen=sizeof(unsigned int), optval = &max. mtu
SO_BTH_SET_MTU_MIN = $0000000a; // unconnected only! optlen=sizeof(unsigned int), optval = &min. mtu
SO_BTH_GET_MTU_MIN = $0000000b; // bound only! optlen=sizeof(unsigned int), optval = &min. mtu
SO_BTH_SET_XON_LIM = $0000000c; // optlen=sizeof(unsigned int), optval = &xon limit (set flow off)
SO_BTH_GET_XON_LIM = $0000000d; // optlen=sizeof(unsigned int), optval = &xon
SO_BTH_SET_XOFF_LIM = $0000000e; // optlen=sizeof(unsigned int), optval = &xoff limit (set flow on)
SO_BTH_GET_XOFF_LIM = $0000000f; // optlen=sizeof(unsigned int), optval = &xoff
SO_BTH_SET_SEND_BUFFER = $00000010; // optlen=sizeof(unsigned int), optval = &max buffered size for send
SO_BTH_GET_SEND_BUFFER = $00000011; // optlen=sizeof(unsigned int), optval = &max buffered size for send
SO_BTH_SET_RECV_BUFFER = $00000012; // optlen=sizeof(unsigned int), optval = &max buffered size for recv
SO_BTH_GET_RECV_BUFFER = $00000013; // optlen=sizeof(unsigned int), optval = &max buffered size for recv
SO_BTH_GET_V24_BR = $00000014; // connected only! optlen=2*sizeof(unsigned int), optval = &{v24 , br}
SO_BTH_GET_RLS = $00000015; // connected only! optlen=sizeof(unsigned int), optval = &rls
SO_BTH_SEND_MSC = $00000016; // connected only! optlen=2*sizeof(unsigned int), optval = &{v24, br}
SO_BTH_SEND_RLS = $00000017; // connected only! optlen=sizeof(unsigned int), optval = &rls
SO_BTH_GET_FLOW_TYPE = $00000018; // connected only! optlen=sizeof(unsigned int), optval=&1=credit-based, 0=legacy
SO_BTH_SET_PAGE_TO = $00000019; // no restrictions. optlen=sizeof(unsigned int), optval = &page timeout
SO_BTH_GET_PAGE_TO = $0000001a; // no restrictions. optlen=sizeof(unsigned int), optval = &page timeout
SO_BTH_SET_SCAN = $0000001b; // no restrictions. optlen=sizeof(unsigned int), optval = &scan mode
SO_BTH_GET_SCAN = $0000001c; // no restrictions. optlen=sizeof(unsigned int), optval = &scan mode
SO_BTH_SET_COD = $0000001d; // no restrictions. optlen=sizeof(unsigned int), optval = &cod
SO_BTH_GET_COD = $0000001e; // no restrictions. optlen=sizeof(unsigned int), optval = &cod
SO_BTH_GET_LOCAL_VER = $0000001f; // no restrictions. optlen=sizeof(BTH_LOCAL_VERSION), optval = &BTH_LOCAL_VERSION
SO_BTH_GET_REMOTE_VER = $00000020; // connected only! optlen=sizeof(BTH_REMOTE_VERSION), optval = &BTH_REMOTE_VERSION
SO_BTH_GET_AUTHN_ENABLE = $00000021; // no restrictions. optlen=sizeof(unsigned int), optval = &authentication enable
SO_BTH_SET_AUTHN_ENABLE = $00000022; // no restrictions. optlen=sizeof(unsigned int), optval = &authentication enable
SO_BTH_SET_READ_REMOTE_NAME = $00000023; // no restrictions. optlen=sizeof(BTH_REMOTE_NAME), optval=&BTH_REMOTE_NAME
SO_BTH_GET_LINK_POLICY = $00000024; // connected only! optlen=sizeof(unsigned int), optval = &link policy
SO_BTH_SET_LINK_POLICY = $00000025; // connected only! optlen=sizeof(unsigned int), optval = &link policy
SO_BTH_ENTER_HOLD_MODE = $00000026; // connected only! optlen=sizeof(BTH_HOLD_MODE), optval = &BTH_HOLD_MODE
SO_BTH_ENTER_SNIFF_MODE = $00000027; // connected only! optlen=sizeof(BTH_SNIFF_MODE), optval = &BTH_SNIFF_MODE
SO_BTH_EXIT_SNIFF_MODE = $00000028; // connected only! optlen=0, optval - ignored
SO_BTH_ENTER_PARK_MODE = $00000029; // connected only! optlen=sizeof(BTH_PARK_MODE), optval = &BTH_PARK_MODE
SO_BTH_EXIT_PARK_MODE = $0000002a; // connected only! optlen=0, optval - ignored
SO_BTH_GET_MODE = $0000002b; // connected only! optlen=sizeof(int), optval = &mode
type
_SOCKADDR_BTH = record
addressFamily:USHORT;
btAddr:BT_ADDR;
serviceClassId:GUID;
port:ULONG;
end;
SOCKADDR_BTH = _SOCKADDR_BTH;
PSOCKADDR_BTH = ^_SOCKADDR_BTH;
type
__bth_inquiry_result = record
ba:BT_ADDR;
cod:LongWord;
clock_offset:word;
page_scan_mode:byte;
page_scan_period_mode:byte;
page_scan_repetition_mode:byte;
end;
BthInquiryResult = __bth_inquiry_result;
PBthInquiryResult = ^BthInquiryResult;
implementation
function GET_NAP(const _bt_addr:BT_ADDR):USHORT; inline;
begin
GET_NAP:=USHORT((_bt_addr and NAP_MASK) shr NAP_BIT_OFFSET);
end;
function GET_SAP(const _bt_addr:BT_ADDR):ULONG; inline;
begin
GET_SAP:=ULONG((_bt_addr and SAP_MASK) shr SAP_BIT_OFFSET);
end;
function SET_NAP(const _nap:USHORT):ULONGLONG; inline;
begin
SET_NAP:=ULONGLONG(_nap shl NAP_BIT_OFFSET);
end;
function SET_SAP(const _sap:ULONG):ULONGLONG; inline;
begin
SET_SAP:=ULONGLONG(_sap shr SAP_BIT_OFFSET);
end;
function SET_NAP_SAP(const _nap:USHORT; const _sap:ULONG):ULONGLONG; inline;
begin
SET_NAP_SAP:=SET_NAP(_nap) or SET_SAP(_sap);
end;
end.