InTheHand.Net.Personal Service Attribute IDs defined by the Device Identification Profile specification. - “This document specifies a method by which Bluetooth devices may provide information that may be used by peer Bluetooth devices to find representative icons or load associated support software. This information is published as Bluetooth SDP records, and optionally in an Extended Inquiry Response.” Used in records with Service Class ID: . As well as the attributes defined here, use of some of the universal attributes is recommended, they are: , , and . SpecificationId [0x0200] The version of the Bluetooth Device ID Profile Specification supported by the device. e.g. version 1.3 will be value 0x0103. [UInt16] VendorId [0x0201] The id assigned by the organisation in . [UInt16] “The value FFFF is reserved as the default id when no Device ID Service Record is present in the device.” ProductId [0x0202] Distinguishes between different products made by the same vendor. [UInt16] Version [0x0203] The version of the product. [UInt16] PrimaryRecord [0x0204] If multiple Device ID records are present this indicates the one ’primary‚ record. [Boolean] VendorIdSource [0x0205] Designates which organisation assigned the Vendor ID value. [UInt16] ValueAssigning Organisation 1Bluetooth SIG 2USB Implementors Forum 0, 3-FFFFreserved Service Attribute IDs defined by the Human Interface Device (HID) Profile specification. HIDDeviceReleaseNumber [16-bit unsigned integer] “A numeric expression identifying the device release number in Binary-Coded Decimal. This is a vendor-assigned field, which defines the version of the product identified by the Bluetooth Device Identification [13] VendorID and ProductID attributes. This attribute is intended to differentiate between versions of products with identical VendorIDs and ProductIDs. The value of the field is 0xJJMN for version JJ.M.N (JJ – major version number, M – minor version number, N – sub-minor version number). …” HIDParserVersion [16-bit unsigned integer] “Each version of a profile is assigned a 16-bit unsigned integer version number of the base HID Specification [4] that the device was designed to. The value of the field is 0xJJMN for version JJ.M.N …” HIDDeviceSubclass [8-bit unsigned integer] “The HIDDeviceSubclass attribute is an 8-bit integer, which identifies the type of device (keyboard, mouse, joystick, gamepad, remote control, sensing device, etc.). Keyboards and mice are required to support boot mode operation. In boot mode, a device presents a fixed report, thus negating the requirement for a HID parser. The Attribute value is identical to the low-order 8 bits of the Class of Device/Service (CoD) field in the FHS packet, where bits 7-2 contain the 6 bit Minor Device Class value (defined in Section 1.2 of the Bluetooth Assigned Numbers document [8]) and bits 1-0 are set to zero. …” HIDCountryCode [8-bit unsigned integer] “The HIDCountryCode attribute is an 8-bit integer, which identifies which country the hardware is localized for. Most hardware is not localized and thus this value would be zero (0).… The valid country codes are listed in the HID Specification [4].” HIDVirtualCable [8-bit Boolean] “The HIDVirtualCable attribute is a boolean value, which indicates whether the device supports virtual connections as described in Section Virtual Cables and Connection Re-Establishment. Devices that have this attribute True indicate that the device supports 1:1 bonding with a host, and the device expects to automatically reconnect if the connection is dropped for any unknown reason.” HIDReconnectInitiate [8-bit Boolean] “The HIDReconnectInitiate attribute is a boolean value, which indicates whether the device initiates the reconnection process or expects the host to. …” HIDDescriptorList [Data element sequence] “The HIDDescriptorList Data Element Sequence performs the function of the HID Descriptor that is defined in Section 6.2 of the HID Specification [4]. The HIDDescriptorList identifies the descriptors associated with the device. … The HIDDescriptorList is a Data Element Sequence that consists of one or more HIDDescriptors. A HIDDescriptor is a data element sequence containing, minimally, a pair of elements. For compatibility with future versions of the HID profile, addition elements found in a HIDDescriptor shall be ignored. … ” HIDLANGIDBaseList [Data element sequence] “The HIDLANGIDBaseList is a Data Element Sequence that consists of one or more HIDLANGIDBases. A HIDLANGIDBase is a data element sequence containing, minimally, two elements for each of the languages used in the service record: a language identifier (LANGID) and a base attribute ID. For compatibility with future versions of the HID profile, additional elements found in a HIDLANGIDBase shall be ignored. The first element, called the HIDLANGID, contains an identifier representing the natural language ID. The language is encoded according to the “Universal Serial Bus Language Identifiers (LANGIDs)” Specification [9]. The second element, called the HIDLanguageBase, contains an attribute ID that serves as the base attribute ID for the natural language in the service record. Different service records within a server may use different base attribute ID values for the same language. …” HIDSDPDisable [8-bit Boolean] “The HIDSDPDisable attribute is a boolean value, which indicates whether connection to the SDP channel and Control or Interrupt channels are mutually exclusive. …” HIDBatteryPower [8-bit Boolean] “The HIDBatteryPower attribute is a boolean value, which indicates whether the device is battery powered (and requires careful power management) or has some other source of power that requires minimal management. …” HIDRemoteWake [8-bit Boolean] “The HIDRemoteWake attribute is a boolean value, which indicates whether the device considers itself remote wake up-capable. When a system enters a suspend (or standby) state, this flag shall be used to determine whether the host includes this device in the set of devices that can wake it up. A mouse or keyboard are typical examples of Remote Wake up devices.” HIDBootDevice [8-bit Boolean] “HIDBootDevice is an 8-bit Boolean value that when True indicates whether the device supports boot protocol mode and by inference the Set_Protocol and Get_Protocol commands. …” HIDSupervisionTimeout [16-bit unsigned integer] “The HIDSupervisionTimeout is a 16-bit value which indicates the device vendor’s recommended baseband Link Supervision Timeout value in slots. …” HIDNormallyConnectable [8-bit Boolean] “HIDNormallyConnectable is an optional Boolean attribute that specifies whether a HID is normally in Page Scan mode (when no connection is active) or not. …” HIDProfileVersion [16-bit unsigned integer] “Each device designed to this specification shall include a 16-bit unsigned integer version number of the Bluetooth HID Specification (this document) that the device was designed to. The value of the field is 0xJJMN for version JJ.M.N (JJ – major version number, M – minor version number, N – sub-minor version number); …” Defines the ids for the “universal attributes”, those “whose definitions are common to all service records.” “ Universal attributes are those service attributes whose definitions are common to all service records. Note that this does not mean that every service record must contain values for all of these service attributes. However, if a service record has a service attribute with an attribute ID allocated to a universal attribute, the attribute value must conform to the universal attribute’s definition. “ Only two attributes are required to exist in every service record instance. They are the ServiceRecordHandle (attribute ID 0x0000) and the ServiceClassIDList (attribute ID 0x0001). All other service attributes are optional within a service record. ” “Attribute IDs in the range of 0x000D-0x01FF are reserved.” A service record handle is a 32-bit number that uniquely identifies each service record within an SDP server. [0x0000] [32-bit unsigned integer] The ServiceClassIDList attribute consists of a data element sequence in which each data element is a UUID representing the service classes that a given service record conforms to. [0x0001] [Data Element Sequence] “The ServiceClassIDList attribute consists of a data element sequence in which each data element is a UUID representing the service classes that a given service record conforms to. The UUIDs are listed in order from the most specific class to the most general class. The ServiceClassIDList must contain at least one service class UUID.” The ServiceRecordState is a 32-bit integer that is used to facilitate caching of ServiceAttributes. [0x0002] [32-bit unsigned integer] “ The ServiceRecordState is a 32-bit integer that is used to facilitate caching of ServiceAttributes. If this attribute is contained in a service record, its value is guaranteed to change when any other attribute value is added to, deleted from or changed within the service record. This permits a client to check the value of this single attribute. If its value has not changed since it was last checked, the client knows that no other attribute values within the service record have changed. ” The ServiceID is a UUID that universally and uniquely identifies the service instance described by the service record. [0x0003] [UUID] “ The ServiceID is a UUID that universally and uniquely identifies the service instance described by the service record. This service attribute is particularly useful if the same service is described by service records in more than one SDP server. ” The ProtocolDescriptorList attribute describes one or more protocol stacks that may be used to gain access to the service described by the service record. [0x0004] [Data Element Sequence or Data Element Alternative] “ The ProtocolDescriptorList attribute describes one or more protocol stacks that may be used to gain access to the service described by the service record. “ If the ProtocolDescriptorList describes a single stack, it takes the form of a data element sequence in which each element of the sequence is a protocol descriptor. Each protocol descriptor is, in turn, a data element sequence whose first element is a UUID identifying the protocol and whose successive elements are protocol-specific parameters. Potential protocol-specific parameters are a protocol version number and a connection-port number. The protocol descriptors are listed in order from the lowest layer protocol to the highest layer protocol used to gain access to the service. “ If it is possible for more than one kind of protocol stack to be used to gain access to the service, the ProtocolDescriptorList takes the form of a data element alternative where each member is a data element sequence as described in the previous paragraph. “ Protocol Descriptors “ A protocol descriptor identifies a communications protocol and provides protocol- specific parameters. A protocol descriptor is represented as a data element sequence. The first data element in the sequence must be the UUID that identifies the protocol. Additional data elements optionally provide protocol-specific information, such as the L2CAP protocol/service multiplexer (PSM) and the RFCOMM server channel number (CN) shown below. “ ProtocolDescriptorList Examples “ These examples are intended to be illustrative. The parameter formats for each protocol are not defined within this specification. “ In the first two examples, it is assumed that a single RFCOMM instance exists on top of the L2CAP layer. In this case, the L2CAP protocol specific information (PSM) points to the single instance of RFCOMM. In the last example, two different and independent RFCOMM instances are available on top of the L2CAP layer. In this case, the L2CAP protocol specific information (PSM) points to a distinct identifier that distinguishes each of the RFCOMM instances. According to the L2CAP specification, this identifier takes values in the range 0x1000-0xFFFF. “ IrDA-like printer “ ( ( L2CAP, PSM=RFCOMM ), ( RFCOMM, CN=1 ), ( PostscriptStream ) ) “ IP Network Printing “ ( ( L2CAP, PSM=RFCOMM ), ( RFCOMM, CN=2 ), ( PPP ), ( IP ), ( TCP ), ( IPP ) ) “ Synchronization Protocol Descriptor Example “ ( ( L2CAP, PSM=0x1001 ), ( RFCOMM, CN=1 ), ( Obex ), ( vCal ) ) “ ( ( L2CAP, PSM=0x1002 ), ( RFCOMM, CN=1 ), ( Obex ), “ ( otherSynchronisationApplication ) ) ” The BrowseGroupList attribute consists of a data element sequence in which each element is a UUID that represents a browse group to which the service record belongs. [0x0005] [Data Element Sequence] “ The BrowseGroupList attribute consists of a data element sequence in which each element is a UUID that represents a browse group to which the service record belongs. The top-level browse group ID, called PublicBrowseRoot and representing the root of the browsing hierarchy, has the value 00001002-0000-1000-8000-00805F9B34FB (UUID16: 0x1002) from the Bluetooth Assigned Numbers document. ” In order to support human-readable attributes for multiple natural languages in a single service record, a base attribute ID is assigned for each of the natural languages used in a service record. The human-readable universal attributes are then defined with an attribute ID offset from each of these base values, rather than with an absolute attribute ID. [0x0006] [Data Element Sequence] “ In order to support human-readable attributes for multiple natural languages in a single service record, a base attribute ID is assigned for each of the natural languages used in a service record. The human-readable universal attributes are then defined with an attribute ID offset from each of these base values, rather than with an absolute attribute ID. “ The LanguageBaseAttributeIDList attribute is a list in which each member contains a language identifier, a character encoding identifier, and a base attribute ID for each of the natural languages used in the service record. The Language- BaseAttributeIDList attribute consists of a data element sequence in which each element is a 16-bit unsigned integer. The elements are grouped as triplets (threes). “ The first element of each triplet contains an identifier representing the natural language. The language is encoded according to ISO 639:1988 (E/F): “Code for the representation of names of languages”. “ The second element of each triplet contains an identifier that specifies a character encoding used for the language. Values for character encoding can be found in IANA's database1, and have the values that are referred to as MIBEnum values. The recommended character encoding is UTF-8. “ The third element of each triplet contains an attribute ID that serves as the base attribute ID for the natural language in the service record. Different service records within a server may use different base attribute ID values for the same language. “ To facilitate the retrieval of human-readable universal attributes in a principal language, the base attribute ID value for the primary language supported by a service record must be 0x0100. Also, if a LanguageBaseAttributeIDList attribute is contained in a service record, the base attribute ID value contained in its first element must be 0x0100. The ServiceTimeToLive attribute is a 32-bit integer that contains the number of seconds for which the information in a service record is expected to remain valid and unchanged. [0x0007] [32-bit unsigned integer] “ The ServiceTimeToLive attribute is a 32-bit integer that contains the number of seconds for which the information in a service record is expected to remain valid and unchanged. This time interval is measured from the time that the attribute value is retrieved from the SDP server. This value does not imply a guarantee that the service record will remain available or unchanged. It is simply a hint that a client may use to determine a suitable polling interval to revalidate the service record contents. ” The ServiceAvailability attribute is an 8-bit unsigned integer that represents the relative ability of the service to accept additional clients. [0x0008] [8-bit unsigned integer] “ The ServiceAvailability attribute is an 8-bit unsigned integer that represents the relative ability of the service to accept additional clients. A value of 0xFF indicates that the service is not currently in use and is thus fully available, while a value of 0x00 means that the service is not accepting new clients. For services that support multiple simultaneous clients, intermediate values indicate the relative availability of the service on a linear scale. ”“ For example, a service that can accept up to 3 clients should provide ServiceAvailability values of 0xFF, 0xAA, 0x55, and 0x00 when 0, 1, 2, and 3 clients, respectively, are utilizing the service. The value 0xAA is approximately (2/3) * 0xFF and represents 2/3 availability, while the value 0x55 is approximately (1/3)*0xFF and represents 1/3 availability. Note that the availability value may be approximated as ”( 1 - ( current_number_of_clients / maximum_number_of_clients ) ) * 0xFF“ When the maximum number of clients is large, this formula must be modified to ensure that ServiceAvailability values of 0x00 and 0xFF are reserved for their defined meanings of unavailability and full availability, respectively. ”“ Note that the maximum number of clients a service can support may vary according to the resources utilized by the service's current clients. ”“ A non-zero value for ServiceAvailability does not guarantee that the service will be available for use. It should be treated as a hint or an approximation of availability status. ” The BluetoothProfileDescriptorList attribute consists of a data element sequence in which each element is a profile descriptor that contains information about a Bluetooth profile to which the service represented by this service record conforms. [0x0009] [Data Element Sequence] “ The BluetoothProfileDescriptorList attribute consists of a data element sequence in which each element is a profile descriptor that contains information about a Bluetooth profile to which the service represented by this service record conforms. Each profile descriptor is a data element sequence whose first element is the UUID assigned to the profile and whose second element is a 16-bit profile version number. ”“ Each version of a profile is assigned a 16-bit unsigned integer profile version number, which consists of two 8-bit fields. The higher-order 8 bits contain the major version number field and the lower-order 8 bits contain the minor version number field. The initial version of each profile has a major version of 1 and a minor version of 0. When upward compatible changes are made to the profile, the minor version number will be incremented. If incompatible changes are made to the profile, the major version number will be incremented. ” This attribute is a URL which points to documentation on the service described by a service record. [0x000A] [URL] This attribute contains a URL that refers to the location of an application that may be used to utilize the service described by the service record. [0x000B] [URL] “ This attribute contains a URL that refers to the location of an application that may be used to utilize the service described by the service record. Since different operating environments require different executable formats, a mechanism has been defined to allow this single attribute to be used to locate an executable that is appropriate for the client device’s operating environment. In the attribute value URL, the first byte with the value 0x2A (ASCII character ‘*’) is to be replaced by the client application with a string representing the desired operating environment before the URL is to be used. ”“ The list of standardized strings representing operating environments is contained in the Bluetooth Assigned Numbers document. ”“ For example, assume that the value of the ClientExecutableURL attribute is http://my.fake/public/*/client.exe. On a device capable of executing SH3 WindowsCE files, this URL would be changed to http://my.fake/public/sh3- microsoft-wince/client.exe. On a device capable of executing Windows 98 binaries, this URL would be changed to http://my.fake/public/i86-microsoft-win98/ client.exe. ” This attribute contains a URL that refers to the location of an icon that may be used to represent the service described by the service record. [0x000C] [URL] “ This attribute contains a URL that refers to the location of an icon that may be used to represent the service described by the service record. Since different hardware devices require different icon formats, a mechanism has been defined to allow this single attribute to be used to locate an icon that is appropriate for the client device. In the attribute value URL, the first byte with the value 0x2A (ASCII character ‘*’) is to be replaced by the client application with a string representing the desired icon format before the URL is to be used. ”“ The list of standardized strings representing icon formats is contained in the Bluetooth Assigned Numbers document. ”“ For example, assume that the value of the IconURL attribute is http://my.fake/ public/icons/*. On a device that prefers 24 x 24 icons with 256 colors, this URL would be changed to http://my.fake/public/icons/24x24x8.png. On a device that prefers 10 x 10 monochrome icons, this URL would be changed to http:// my.fake/public/icons/10x10x1.png. ” The ServiceName attribute is a string containing the name of the service represented by a service record. [0x0000 + LangBaseAttrId] [String] “ The ServiceName attribute is a string containing the name of the service represented by a service record. It should be brief and suitable for display with an Icon representing the service. The offset 0x0000 must be added to the attribute ID base (contained in the LanguageBaseAttributeIDList attribute) in order to compute the attribute ID for this attribute. ” This attribute is a string containing a brief description of the service. [0x0001 + LangBaseAttrId] [String] “ This attribute is a string containing a brief description of the service. It should be less than 200 characters in length. The offset 0x0001 must be added to the attribute ID base (contained in the LanguageBaseAttributeIDList attribute) in order to compute the attribute ID for this attribute. ” This attribute is a string containing the name of the person or organization providing the service. [0x0002 + LangBaseAttrId] [String] “ This attribute is a string containing the name of the person or organization providing the service. The offset 0x0002 must be added to the attribute ID base (contained in the LanguageBaseAttributeIDList attribute) in order to compute the attribute ID for this attribute. ” The AdditionalProtocolDescriptorLists attribute supports services that require more channels in addition to the service described in the ProtocolDescriptorList attribute. It contains a sequence of ProtocolDescriptorList-elements. [0x000D] [Data Element Sequence or Data Element Alternative] Defined in Bluetooth version 2.1, SDP section 5.1.6. “The AdditionalProtocolDescriptorLists attribute contains a sequence of ProtocolDescriptorList-elements. Each element having the same format as the described in section 5.1.5. The ordering of the elements is significant and should be specified and fixed in Profiles that make use of this attribute. ”The AdditionalProtocolDescriptorLists attribute supports services that require more channels in addition to the service described in Section 5.1.5 . If the AdditionalProtocolDescriptorLists attribute is included in a service record, the ProtocolDescriptorList attribute must be included.” This service class describes service records that contain attributes of service discovery server itself. “ This service class describes service records that contain attributes of service discovery server itself. The attributes listed in this section are only valid if the ServiceClassIDList attribute contains the ServiceDiscoveryServerServiceClassID. Note that all of the universal attributes may be included in service records of the ServiceDiscoveryServer class. ” “Attribute IDs in the range of 0x0202-0x02FF are reserved.” The VersionNumberList is a data element sequence in which each element of the sequence is a version number supported by the SDP server. [Data Element Sequence] “ The VersionNumberList is a data element sequence in which each element of the sequence is a version number supported by the SDP server. ”“ A version number is a 16-bit unsigned integer consisting of two fields. The higher-order 8 bits contain the major version number field and the low-order 8 bits contain the minor version number field. The initial version of SDP has a major version of 1 and a minor version of 0. When upward compatible changes are made to the protocol, the minor version number will be incremented. If incompatible changes are made to SDP, the major version number will be incremented. This guarantees that if a client and a server support a common major version number, they can communicate if each uses only features of the specification with a minor version number that is supported by both client and server. ” The ServiceDatabaseState is a 32-bit integer that is used to facilitate caching of service records. [32-bit unsigned integer] “ The ServiceDatabaseState is a 32-bit integer that is used to facilitate caching of service records. If this attribute exists, its value is guaranteed to change when any of the other service records are added to or deleted from the server's database. If this value has not changed since the last time a client queried its value, the client knows that a) none of the other service records maintained by the SDP server have been added or deleted; and b) any service record handles acquired from the server are still valid. A client should query this attribute's value when a connection to the server is established, prior to using any service record handles acquired during a previous connection. ”“ Note that the ServiceDatabaseState attribute does not change when existing service records are modified, including the addition, removal, or modification of service attributes. A service record's ServiceRecordState attribute indicates when that service record is modified. ” This service class describes the ServiceRecord provided for each BrowseGroupDescriptor service offered on a Bluetooth device. “ This service class describes the ServiceRecord provided for each BrowseGroupDescriptor service offered on a Bluetooth device. The attributes listed in this section are only valid if the ServiceClassIDList attribute contains the BrowseGroupDescriptorServiceClassID. Note that all of the universal attributes may be included in service records of the BrowseGroupDescriptor class. ” “Attribute IDs in the range of 0x0201-0x02FF are reserved.” This attribute contains a UUID that can be used to locate services that are members of the browse group that this service record describes. [UUID] Service Attribute IDs defined by the OBEX related specifications, i.e. Object Push and Synchronization Profiles specifications. GOEP L2Cap PSM New in GOEP v2.0 but not numbered there. New in OPP v1.2, FTP v1.2, and BIP v1.1. [UInt16] Supported Data Stores List (Synchronization Profile) Synchronization Profile — service class. [Data Element Sequence of UInt8] Values ValueMeaning 0x01Phonebook 0x03Calendar 0x05Notes 0x06Message Supported Formats List (Object Push Profile) Object Push Profile — service class. [Data Element Sequence of UInt8] Values ValueMeaning 0x01vCard 2.1 0x02vCard 3.0 0x03vCard 2.1 0x04vCal 1.0 0x05vNote 0x06vMessage 0xFFany type of object Supported Capabilities (BIP) Basic Imaging Profile — , , , service classes. [UInt8] Values ValueMeaning Bit 0Generic imaging Bit 1Capturing Bit 2Printing Bit 3Displaying Bit 4..7Reserved Supported Features (BIP) Basic Imaging Profile — , , , service classes. [UInt16] Values ValueMeaning Bit 0ImagePush Bit 1ImagePush-Store Bit 2ImagePush-Print Bit 3ImagePush-Display Bit 4ImagePull Bit 5AdvancedImagePrinting Bit 6AutomaticArchive Bit 7RemoteCamera Bit 8RemoteDisplay Bit 9..15Reserved Supported Functions (BIP) Basic Imaging Profile — , , , service classes. [UInt32] Values ValueMeaning Bit 0GetCapabilities Bit 1PutImage Bit 2PutLinkedAttachment Bit 3PutLinkedThumbnail Bit 4RemoteDisplay Bit 5GetImagesList Bit 6GetImageProperties Bit 7GetImage Bit 8GetLinkedThumbnail Bit 9GetLinkedAttachment Bit 10DeleteImage Bit 11StartPrint Bit 12Reserved Bit 13StartArchive Bit 14GetMonitoringImage Bit 16GetStatus Bit 15, 17..31Reserved Total Imaging Data Capacity (BIP) Basic Imaging Profile — , , , service classes. [UInt64] Service Attribute IDs defined by the Basic Printing Profile specification. Document Formats Supported [String] Character Repertoires Supported [UInt128] XHTML-Print Image Formats Supported [String] Color Supported [Boolean] 1284ID [String] Printer Name [String] Printer Location [String] Duplex Supported [Boolean] Media Types Supported [String] MaxMediaWidth [UInt16] MaxMediaLength [UInt16] Enhanced Layout Supported [Boolean] RUI Formats Supported [String] Reference Printing RUI Supported [Boolean] Direct Printing RUI Supported [Boolean] Reference Printing Top URL [URL] Direct Printing Top URL [URL] Printer Admin RUI Top URL [URL] Device Name [String] Service Attribute IDs defined by the Personal Area Networking Profile specification. PersonalAreaNetworkingProfile Security Description “Security Description” [UInt16] NetAccessType “Type of Network Access Available” [UInt16] MaxNetAccessRate “Maximum possible Network Access Data Rate” [UInt32] IPv4Subnet [String] IPv6Subnet [String] Service Attribute IDs defined by the Headset Profile specification. Remote audio volume control [Boolean] Service Attribute IDs defined by the Hand-Free Profile specification. HandFreeProfile Network “The "Network" attribute states, if the AG has the capability to reject incoming calls[4]. This attribute is not encoded as a data element sequence; it is simply an 8-bit unsigned integer. The information given in the “Network” attribute shall be the same as the information given in Bit 5 of the unsolicited result code +BRSF (see Section 4.24.3). An attribute value of 0x00 is translated to a bit value of 0; an attribute value of 0x01 is translated to a bit value of 1.” [UInt8] SupportedFeatures “The attribute “SupportedFeatures” states the features supported in each device. … The set of features supported in each case is bit-wise defined in this attribute on a yes/no basis. The mapping between the features and their corresponding bits within the attribute is listed below in for the HF and in for the AG. … Bit Feature Default in HF (0=LSB) 0 EC and/or NR function (yes/no, 1 = yes, 0 = no) 0 1 Call waiting and three way calling(yes/no, 1 = yes, 0 = no) 0 2 CLI presentation capability (yes/no, 1 = yes, 0 = no) 0 3 Voice recognition activation (yes/no, 1= yes, 0 = no) 0 4 Remote volume control (yes/no, 1 = yes, 0 = no) 0 Table 5.2 “SupportedFeatures” attribute bit mapping for the HF Bit Feature Default in AG (0=LSB) 0 Three-way calling (yes/no, 1 = yes, 0 = no) 1 1 EC and/or NR function (yes/no, 1 = yes, 0 = no) 0 2 Voice recognition function (yes/no, 1 = yes, 0 = no) 0 3 In-band ring tone capability (yes/no, 1 = yes, 0 = no) 1 4 Attach a phone number to a voice tag (yes/no, 1 = yes, 0 = no) 0 Table 5.4 “SupportedFeatures” attribute bit mapping for the AG” [UInt16] Service Attribute IDs defined by the Health Device Profile specification. SupportFeaturesList - "This is a sequence for which each element is a sequence that describes a single application data end-point on the device. The Supported Features attribute (MDEP List) provides an indication of the data types that an MDEP supports.", "...each description is itself a sequence of three or more elements." [Sequence] DataExchangeSpecification - "This attribute is a one-byte reference, with the value taken from the Bluetooth Assigned Numbers [3] to identify the Data Exchange Protocol used (e.g. ISO/IEEE 11073-20601 specification)." e.g. value 0x01 is ISO/IEEE 11073-20601, "Health informatics - Personal health device communication - Application profile - Optimized exchange protocol" [UInt8] MCAP Supported Procedures - "This attribute is a one byte bit-mask that indicates the MCAP procedures that are supported by this HDP service." 0x02 Supports Reconnect Initiation 3 0x04 Supports Reconnect Acceptance 4 0x08 Supports Clock Synchronization Protocol (includes support for at least Sync-Slave Role) 0x10 Supports Sync-Master Role [UInt8] SocketException holding a BlueSoleil error code from the original error, which is added to the exception message. - Will always be internal so just catch SocketException as for the other stacks. “No service record with the specified search pattern is found on the remote device.” “The specified service record does not exist on the remote device..” “HCI error “Page Timeout (0X04)” is received.” The Btsdk_IsSDKInitialized function indicates whether a successful call to Btsdk_Init is made. The Btsdk_IsServerConnected function checks whether client application can call BlueSoleil Server APIs. When this fuction returns , client application can call APIs normally, versa versit. The Btsdk_SetStatusInfoFlag function is used to set the status changing callback types which the user wants to receive. - usMsgType can be one of the following value or their combination: BTSDK_NTSERVICE_STATUS_FLAG The status change of BlueSoleil server event or OS message event. BTSDK_BLUETOOTH_STATUS_FLAG Message event of the change of Bluetooth status. BTSDK_REFRESH_STATUS_FLAG Refresh event. - See remarks. - BTSDK_OK for success, other for error code. The Btsdk_IsBluetoothReady function checks whether the local Bluetooth device is working. Boolean Gets the current user-friendly name of the specified remote device. - Before calling Btsdk_UpdateRemoteDeviceName, the device database must be initialized by a previous successful call to Btsdk_StartBluetooth. The user-friendly device name is a UTF-8 character string. The device name acquired by this command is stored automatically in the device database. "gets the RSSI value of the specified remote device." - "a connection between local device and the specified remote device must be created first." - hDev "Range: -128 to 127 (dB)." "gets the current link quality value of the connection between local device and the specified remote device." - "The higher the value, the better the link quality is." - "Range: 0 to 0xFF." "Gets the user-friendly name of the specified remote device from the device database." - "Before calling Btsdk_GetRemoteDeviceName, the device database must be initialized by a previous successful call to Btsdk_Init. The user-friendly device name is a UTF-8 character string. The Btsdk_GetRemoteDeviceNamefunction returns =BTSDK_OPERATION_FAILURE immediately if the device name doesn’t exist in the database. In this case, the application shall call Btsdk_UpdateRemoteDeviceName to acquire the name information directly from the remote device. BlueSoleil will automatically update the device name when the local device connects to the specified remote device. Gets the current user-friendly name of the specified remote device. - Before calling Btsdk_UpdateRemoteDeviceName, the device database must be initialized by a previous successful call to Btsdk_StartBluetooth. The user-friendly device name is a UTF-8 character string. The device name acquired by this command is stored automatically in the device database. "gets the current link quality value of the connection between local device and the specified remote device." - "The higher the value, the better the link quality is." - "Range: 0 to 0xFF." "Gets the user-friendly name of the specified remote device from the device database." - "Before calling Btsdk_GetRemoteDeviceName, the device database must be initialized by a previous successful call to Btsdk_Init. The user-friendly device name is a UTF-8 character string. The Btsdk_GetRemoteDeviceNamefunction returns =BTSDK_OPERATION_FAILURE immediately if the device name doesn’t exist in the database. In this case, the application shall call Btsdk_UpdateRemoteDeviceName to acquire the name information directly from the remote device. BlueSoleil will automatically update the device name when the local device connects to the specified remote device. For FooBarClient.Connected “Sets the device into general discoverable mode. This is the default discoverable mode.” “Sets the device into limited discoverable mode. If this value is specified, BTSDK_GENERAL_DISCOVERABLE mode value is ignored by BlueSoleil.” “Makes the device discoverable. This is equivalent to BTSDK_GENERAL_DISCOVERABLE.” “Makes the device connectable. This is the default connectable mode.” “Makes the device pairable. This is the default pairable mode.” “A remote device connects to a local service record.” “The remote device disconnects the connection, or the connection is lost due to radio communication problems, e.g. the remote device is out of communication range.” “A local device connects to a remote service record.” “The local device disconnects the connection from remote service.” "Possible flags for member 'mask' in _BtSdkRemoteServiceAttrStru" for Test. for Test. Values of the flags parameter to sdp_record_register Values of the flags parameter to sdp_connect Attributes are specified as individual elements Attributes are specified as a range Use with struct rfcomm_conninfo{hci_handle, dev_class}. Use with so_RFCOMM_CONNINFO. PRE-RELEASE Get the instance of the given factory type -- if it exists. - The factory type e.g. or etc. - The instance of the given type or null. PRE-RELEASE Get the instance of the given factory type -- if it exists. - The factory type e.g. or etc. - The instance of the given type or null. When overidden, initiates lookup the SDP record with the give Service Class Id to find the RFCOMM port number (SCN) that the server is listening on. The process returns a list of port numbers. The remote device. The Service Class Id. callback state IAsyncResult When overidden, completes the SDP Record to port number lookup process - IAsyncResult from . - There must be at least one entry in the result list for each Service Record found for the specified Service Class Id. This allows us to know if no records were found, or that records were found but none of them were for RFCOMM. If a particular record does not have a RFCOMM port then -1 (negative one should be added to the list for it). The process may throw an exception if an error occurs, e.g. the remote device did not respond. - A with at least one entry for each Service Record found for the specified Service Class Id, the item being -1 if the record has no port. is . Get timeout value in Int32 milliseconds, as NETCF WaitHandle.WaitOne can't use TimeSpan. - An Int32 containing the timeout value in milliseconds. Convert the user Inquiry parameters to the formats used by HCI. The maxDevices parameter from e.g. . The property . On return contains the Num_Responses value to be passed to the HCI Inquiry command. If greater that 255 or less than zero, the value 0 will be returned. HCI uses zero as "Unlimited". On return contains the Inquiry_Length value to be passed to the HCI Inquiry command. Is scaled by the divisor 1.28secs and if not in range 1 to 0x30 inclusive is set to 10. - Sub-class must call various methods at the following events: open or on failure close data arrival flow control off Fails if state is not Connected. Fails if state is not Connected or PeerDidClose. Used by Client, note from MSDN Socket.Connected: "Gets a value that indicates whether a Socket is connected to a remote host as of the last Send or Receive operation." - From MSDN : "Gets a value that indicates whether a Socket is connected to a remote host as of the last Send or Receive operation." From MSDN : "true if the Client socket was connected to a remote resource as of the most recent operation; otherwise, false." Disposing Called from CloseInternal and Dispose; RemovePortRecords is called before from both places. Dispose then calls DoOtherPreDestroy and DoPortDestroy in that order. Disposing Disposing Called before DoOpenClient. For instance is empty on BTPS, on Widcomm it calls SetScnForPeerServer and SetSecurityLevelClient. Endpoint Channel number Starts the connect process. The async completion should call either or . scn addr Call when connection is successfully made. Used for logging etc. Pass a string containing the name of the stack's event/status that occurred. Get the remote address. - On return contains the address to which we are connected. - if connected, but we ignore the result. Call when connection is un-successfully made (fails), and also when the connection closes. Used for logging etc. Pass a string containing the name of the stack's event/status that occurred. The socket error code for this failure -- known. Pass for instance a value from as an ; or respectively. Used: 1. when we get CONNECT_ERR from the stack, and POSSIBLY 2. when we close the stream to do consumer timeout (SO_RCVTIMEO/etc). Out: to call on. Out: to call on. Close the connection from the network/stack side (not from the consumer side). - When we call Close the object is disposed and outstanding and new operations fail with ObjectDisposedException. This method instead closes the connection from the network/stack side and thus operations fail with an IO error etc. DEPRECATED, should return false. Whether Bonding was attempted and thus the connect should be retried. Update the instance with value from the other. - The other device, to read properties from. - Used by the device discovery code in merging the devices found by Inquiry and the 'remembered' devices. The current device is the one found by inqury and the device is a 'remembered' one. So its common to update the 'Remembered' and 'Authenticated' properties for instance. Defines a class that provides Bluetooth Factory initialisation but returns multiple factories. - In most cases configuration is provided so that loads one or more classes each derived from . There the instance is the factory. This interface allows a class to be loaded by but instead returns a list of factory instances. Get the list of factories. A list of exceptions, to which any errors in attempting to create the factories are added. A list of successfully created factories. Handles security between bluetooth devices. - Used by . Intiates pairing for a remote device. - Remote device with which to pair. Chosen PIN code, must be between 1 and 16 ASCII characters. - Whether the operation was successful. Remove the pairing with the specified device - Remote device with which to remove pairing. - TRUE if device was successfully removed, else FALSE. This function stores the personal identification number (PIN) for the Bluetooth device. Address of remote device. Pin, alphanumeric string of between 1 and 16 ASCII characters. On Windows CE platforms this calls BthSetPIN, its MSDN remarks say: “Stores the pin for the Bluetooth device identified in pba. The active connection to the device is not necessary, nor is the presence of the Bluetooth controller. The PIN is persisted in the registry until BthRevokePIN is called. “While the PIN is stored, it is supplied automatically after the PIN request is issued by the authentication mechanism, so the user will not be prompted for it. Typically, for UI-based devices, you would set the PIN for the duration of authentication, and then revoke it after authentication is complete.” See also True on success, else False. This function revokes the personal identification number (PIN) for the Bluetooth device. On Windows CE platforms this calls BthRevokePIN, its MSDN remarks say: “When the PIN is revoked, it is removed from registry. The active connection to the device is not necessary, nor is the presence of the Bluetooth controller.” On Windows CE platforms this removes any pending BluetoothWin32Authentication object but does not remove the PIN for an already authenticated device. Use RemoveDevice to ensure a pairing is completely removed. See also The remote device. True on success, else False. Retrieves the address of the Bluetooth peer device authentication that requires the PIN code. Not supported on Windows XP On Windows CE platforms this calls BthGetPINRequest, its MSDN remarks say: “There can be multiple requests outstanding. After the event that is provided by the UI handler is signaled, the UI handler must call this function multiple times until the call fails.” See also and of the remote device, or null if there is no outstanding PIN request. Refuses an outstanding PIN request. Not supported on Windows XP - Address of the requesting device. - true if the operation was successful; false otherwise. - On Windows CE platforms this calls BthRefusePINRequest, its MSDN remarks say: “This function refuses an outstanding PIN request that is retrieved by function.” See also and Not supported on Windows XP - The device whose Link Key to retrieve. The 16-byte Link Key to set. - true if the operation was successful; false otherwise. - On Windows CE platforms this calls BthSetLinkKey, its MSDN remarks say: “The link key is persisted in registry until BthRevokeLinkKey is called. “Typically, the Bluetooth stack manages link keys automatically, for example, it stores them when they are created. This function is useful primarily for backup purposes. “While link key is stored, it will be automatically supplied once the link key request is issued by the authentication mechanism. If the link key is incorrect, the renegotiation that involves the PIN is initiated by the Bluetooth adapter, and the PIN code may be requested from the user. “The link key length is 16 bytes. You cannot create link keys; they are generated by the Bluetooth hardware.” When overidden, initiates lookup the SDP record with the give Service Class Id to find the RFCOMM port number (SCN) that the server is listening on. The process returns a list of port numbers. The remote device. The Service Class Id. callback state IAsyncResult When overidden, completes the SDP Record to port number lookup process - IAsyncResult from . - There must be at least one entry in the result list for each Service Record found for the specified Service Class Id. This allows us to know if no records were found, or that records were found but none of them were for RFCOMM. If a particular record does not have a RFCOMM port then -1 (negative one should be added to the list for it). The process may throw an exception if an error occurs, e.g. the remote device did not respond. - A with at least one entry for each Service Record found for the specified Service Class Id, the item being -1 if the record has no port. is . Note that this exception will always be internal, just catch SocketException. To get to HandleDeviceResponded, HandleInquiryCompleted etc “This function requests a service discovery for a specific device.” - “When the discovery is complete the derived function OnDiscoveryComplete() is called.” - “TRUE, if discovery has started; FALSE, if discovery has not started.” “When multiple discovery operations are in progress, the application must call GetLastDiscoveryResult() from within the OnDiscoveryComplete() to determine which remote devices reported services.” “DISCOVERY_RESULT_SUCCESS, if the discovery operation was successful.” “This function is called when discovery is complete to retrieve the records received from the remote device.” - “Discovery results for a device are not removed until the device fails to respond to an inquiry.” - The discovery records read, which may have recordCount equals zero. Define RFCOMM Port events that registered application can receive in the callback Any Character received Received certain character Transmitt Queue Empty CTS changed state DSR changed state RLSD changed state Ring signal detected Line status error occurred Ring signal detected CTS state DSR state RLSD state receiver buffer overrun Any character transmitted RFCOMM connection established Was not able to establish connection; or disconnected flow control enabled flag changed by remote flow control status true = enabled Get the number of records that the buffer contains. - An integer containing the number of records that the buffer contains, may be zero. - The buffer has not yet been filled with a CSdpDiscoveryRec list. - In SdpSearchScope.ServiceClassOnly this returns the actual number of records as the filtering is done by the stack. In SdpSearchScope.Anywhere this returns the pre-filtered number of records. We do the filtering so this will likely be greater that the matching number of records. Presumably this is surfaced as a OnConnectionPending Get the number of records that the buffer contains. - An integer containing the number of records that the buffer contains, may be zero. - The buffer has not yet been filled with a CSdpDiscoveryRec list. - In SdpSearchScope.ServiceClassOnly this returns the actual number of records as the filtering is done by the stack. In SdpSearchScope.Anywhere this returns the pre-filtered number of records. We do the filtering so this will likely be greater that the matching number of records. Define for service attribute, all the 'Descriptor Type' values. These are also referred to as 'attribute type' values Provides client connections for Bluetooth network services with Widcomm stack. Used by WidcommBluetoothListener to return the newly accepted connection. - The WidcommRfcommStream containing the newly connected RfCommPort. Factory to use in GetRemoteMachineName etc. ... Allow the tests to disable the Registry lookup. Used when loading a stack stored/remembered/maybe-paired device. Used when a device is discovered during Inquiry. - When the result of Inquiry and get-stack-stored-devices are merged, the remembered/authenticated flags may get set then (with ). Called after reading the device from the Registry, to find if it is paired. For use when the results of Inquiry and get-stack-stored-devices are merged. Check whether all the of dependencies are correct. - The original exception we got on trying to load Widcomm. Or null if Widcomm loaded successfully and we're just doing a check of the dependencies. - Does not return if is non-null, instead will throw it, or a more explanatory exception (with it as an inner exception). If is null, ReportNeedNeedNativeDllUpgrade, call from pair of catch: EntryPointNotFoundException and MissingMethodException. The exception. Whether we may put up an (Debug.)Assert dialog box. Could not connect to remote device Remote device rejected the connection Security failed Remote Service Record Error Other error success response no more devices found can not find exsiting entry for bda provided as input out of memory Used by OnStackChanges virtual method. 1000-WCE-PG100-RCD.pdf (03/20/06) says: "... no longer used: DEVST_UP and DEVST_ERROR." and: "Values defined in BtIfClasses.h are: • DEVST_DOWN — The stack is down and no longer available. • DEVST_UNLOADED — The stack is down, but should be available again after DEVST_RELOADED. • DEVST_RELOADED — The stack has been successfully reloaded." Device is present, but down [Seen (on BTW)] Device is present and UP [Doc'd as obsolete, but I see it (on BTW)] Device is in error (maybe being removed) [Doc'd as obsolete] Stack is being unloaded Stack reloaded after being unloaded Remove the device by deleting it from the Registry. The device address. Whether the device is deleted -- it is no longer a remembered device. Call CBtIf::GetExtendedError. - Is not currently used anywhere... Not supported on Widcomm WCE WM/WinCE, we (natively) return -1. - A value. CBtIf::IsRemoteDevicePresent - "added BTW and SDK 5.0.1.1000" "added BTW-CE and SDK 1.7.1.2700" CBtIf::IsRemoteDeviceConnected - "added BTW 5.0.1.300, SDK 5.0" "added BTW-CE and SDK 1.7.1.2700" "Define common return code for new SDK functions that would normally return BOOL" - "Added BTW and SDK 5.0.1.1100". "The call was successful" "Unspecified failure" "The API is not supported on the platform BTW stack version" "The API cannot complete at this time, but may be retried" "One of the API parameters was invalid" "A necessary resource could not be obtained" "The operation timed out before completion" Wrapper around CBtIf::Bond(). if pairing was completed. if were already paired, or pairing failed. Define SPP connection states port now connected port now disconnected rfcomm connction failed Port in use, for SPPClient only [for SPP Client only] no port configured [for SPP Client only] service not found [for SPP Client only] [for SPP Server Only] [for SPP Server Only] Define SPP connection states port now connected port now disconnected Define return code for SPP Client functions Operation initiated without error COM server could not be started attempt to connect before previous connection closed attempt to close unopened connection local processor could not allocate memory for open One or more of function parameters are not valid Any condition other than the above no empty port license error Define return code for SPP Client functions Size of the structure. Internal bytes Bluetooth specific flags returned from WSALookupServiceNext in WSAQUERYSET.dwOutputFlags in response to device inquiry. Remove a SDP record as added by . The handle. The raw record, presumably not actually used by the stack. Add a SDP record. - An array of containing the complete SDP record. A containing any bits to set in the devices Class of Device value. - A handle representing the record, pass to to remote the record. The BluetoothAuthenticateDevice function sends an authentication request to a remote Bluetooth device. The window to parent the authentication wizard. If NULL, the wizard will be parented off the desktop. A valid local radio handle, or NULL. If NULL, authentication is attempted on all local radios; if any radio succeeds, the function call succeeds. A structure of type BLUETOOTH_DEVICE_INFO that contains the record of the Bluetooth device to be authenticated. A Personal Identification Number (PIN) to be used for device authentication. If set to NULL, the user interface is displayed and and the user must follow the authentication process provided in the user interface. If pszPasskey is not NULL, no user interface is displayed. If the passkey is not NULL, it must be a NULL-terminated string. For more information, see the Remarks section. The size, in characters, of pszPasskey. The size of pszPasskey must be less than or equal to BLUETOOTH_MAX_PASSKEY_SIZE. The BluetoothAuthenticateDeviceEx function sends an authentication request to a remote Bluetooth device. Additionally, this function allows for out-of-band data to be passed into the function call for the device being authenticated. Note This API is supported in Windows Vista SP2 and Windows 7. The window to parent the authentication wizard. If NULL, the wizard will be parented off the desktop. A valid local radio handle or NULL. If NULL, then all radios will be tried. If any of the radios succeed, then the call will succeed. A pointer to a BLUETOOTH_DEVICE_INFO structure describing the device being authenticated. Pointer to device specific out-of-band data to be provided with this API call. If NULL, then UI is displayed to continue the authentication process. If not NULL, no UI is displayed. An AUTHENTICATION_REQUIREMENTS enumeration that specifies the protection required for authentication. Input: none Output: BTH_LOCAL_RADIO_INFO Input: BTH_ADDR Output: BTH_RADIO_INFO use this ioctl to get a list of cached discovered devices in the port driver. Input: None Output: BTH_DEVICE_INFO_LIST Input: BTH_ADDR Output: none Input: BTH_GET_DEVICE_RSSI Output: ULONG Input: BTH_EIR_GET_RECORDS Output: UCHAR array, sequence of length + type + data fields triplets. Input: BTH_EIR_SUBMIT_RECORD Output HANDLE Input: BTH_EIR_SUBMIT_RECORD Output None Input: HANDLE Output: None Input: BTH_VENDOR_SPECIFIC_COMMAND Output: PVOID Input: BTH_SDP_CONNECT Output: BTH_SDP_CONNECT Input: HANDLE_SDP Output: none Input: BTH_SDP_SERVICE_SEARCH_REQUEST Output: ULONG * number of handles wanted Input: BTH_SDP_ATTRIBUTE_SEARCH_REQUEST Output: BTH_SDP_STREAM_RESPONSE or bigger Input: BTH_SDP_SERVICE_ATTRIBUTE_SEARCH_REQUEST Output: BTH_SDP_STREAM_RESPONSE or bigger Input: raw SDP stream (at least 2 bytes) Ouptut: HANDLE_SDP Input: HANDLE_SDP Output: none Input: BTH_SDP_RECORD + raw SDP record Output: HANDLE_SDP Register the service. For SAP, this means sending out a periodic broadcast. This is an NOP for the DNS namespace. For persistent data stores, this means updating the address information. Remove the service from the registry. For SAP, this means stop sending out the periodic broadcast. This is an NOP for the DNS namespace. For persistent data stores this means deleting address information. Delete the service from dynamic name and persistent spaces. For services represented by multiple CSADDR_INFO structures (using the SERVICE_MULTIPLE flag), only the specified address will be deleted, and this must match exactly the corresponding CSADDR_INFO structure that was specified when the service was registered Amount of time allowed to perform the query. On Windows CE the actual value used is expressed in units of 1.28 seconds, so will be the nearest match for the value supplied. The default value is 10 seconds. The maximum is 60 seconds. Discovers accessible Bluetooth devices and returns their names and addresses. The maximum number of devices to get information about. True to return previously authenticated/paired devices. True to return remembered devices. True to return previously unknown devices. True to return only discoverable devices (where both in range and in discoverable mode). When all other flags are ignored. Note: Does NOT work on Win32 with the Microsoft stack. An array of BluetoothDeviceInfo objects describing the devices discovered. - The flag will discover only the devices that are in range and are in discoverable mode. This works only on WM/CE with the Microsoft stack, or on any platform with the Widcomm stack. It does not work on desktop Windows with the Microsoft stack, where the in range and remembered devices are returned already merged! There simple all devices will be returned. Even the BluetoothDeviceInfo.LastSeen property is of no use there: on XP and Vista at least the value provided is always simply the current time. Gets or set a value that indicates whether a connection has been made. Connects a client to a specified endpoint. A that represents the remote device. Begins an asynchronous request for a remote host connection. The remote host is specified by a . A containing the address and UUID of the remote service. An AsyncCallback delegate that references the method to invoke when the operation is complete. A user-defined object that contains information about the connect operation. This object is passed to the requestCallback delegate when the operation is complete. Asynchronously accepts an incoming connection attempt. An object returned by a call to / . Gets or sets the authentication state of the current connect or behaviour to use when connection is established. For disconnected sockets, specifies that authentication is required in order for a connect or accept operation to complete successfully. Setting this option actively initiates authentication during connection establishment, if the two Bluetooth devices were not previously authenticated. The user interface for passkey exchange, if necessary, is provided by the operating system outside the application context. For outgoing connections that require authentication, the connect operation fails with WSAEACCES if authentication is not successful. In response, the application may prompt the user to authenticate the two Bluetooth devices before connection. For incoming connections, the connection is rejected if authentication cannot be established and returns a WSAEHOSTDOWN error. On unconnected sockets, enforces encryption to establish a connection. Encryption is only available for authenticated connections. For incoming connections, a connection for which encryption cannot be established is automatically rejected and returns WSAEHOSTDOWN as the error. For outgoing connections, the connect function fails with WSAEACCES if encryption cannot be established. In response, the application may prompt the user to authenticate the two Bluetooth devices before connection. Returns link key associated with peer Bluetooth device. Returns the Link Policy of the current connection. Sets the PIN associated with the currently connected device. PIN which must be composed of 1 to 16 ASCII characters. Assigning null (Nothing in VB) or an empty String will revoke the PIN. Set or change the PIN to be used with a specific remote device. Address of Bluetooth device. PIN string consisting of 1 to 16 ASCII characters. Assigning null (Nothing in VB) or an empty String will revoke the PIN. Gets the name of the remote device. Gets the name of the specified remote device. Address of remote device. Friendly name of specified device. Gets the name of a device by a specified socket. A . Returns a string value of the computer or device name. Releases the unmanaged resources used by the BluetoothClient and optionally releases the managed resources. true to release both managed and unmanaged resources; false to release only unmanaged resources. Closes the and the underlying connection. - Frees resources used by the class. Gets or sets the authentication state of the current connect or behaviour to use when connection is established. For disconnected sockets, specifies that authentication is required in order for a connect or accept operation to complete successfully. Setting this option actively initiates authentication during connection establishment, if the two Bluetooth devices were not previously authenticated. The user interface for passkey exchange, if necessary, is provided by the operating system outside the application context. For outgoing connections that require authentication, the connect operation fails with WSAEACCES if authentication is not successful. In response, the application may prompt the user to authenticate the two Bluetooth devices before connection. For incoming connections, the connection is rejected if authentication cannot be established and returns a WSAEHOSTDOWN error. On unconnected sockets, enforces encryption to establish a connection. Encryption is only available for authenticated connections. For incoming connections, a connection for which encryption cannot be established is automatically rejected and returns WSAEHOSTDOWN as the error. For outgoing connections, the connect function fails with WSAEACCES if encryption cannot be established. In response, the application may prompt the user to authenticate the two Bluetooth devices before connection. Provides information about an available device obtained by the client during device discovery. Initializes an instance of the class. - Initializes an instance of the class with the given native structure. Initializes an instance of the class for the device with the given address. Forces the system to refresh the device information. - See for one reason why this method is necessary. Updates the device name used to display the device, affects the local computer cache. On Windows CE this only affects devices which are already paired. Gets the device identifier. Gets a name of a device. - Note, that due the way in which Bluetooth device discovery works, the existence and address of a device is known first, but a separate query has to be carried out to find whether the device also has a name. This means that if a device is discovered afresh then this property might return only a text version of the device’s address and not its name, one can also see this in the Windows’ Bluetooth device dialogs where the device appears first with its address and the name is later updated. To see the name, wait for some time and access this property again having called in the meantime. Returns the Class of Device of the remote device. - Some CE 4.2 devices such as original PPC2003 devices don't have the native API on which this property depends — it was added as part of a hotfix. The property will always return zero in such a case. On WM/CE we also attempt to get the CoD value as part of the discovery process; this is of course only works for devices in-range. Returns the signal strength for the Bluetooth connection with the peer device. Requires Windows Mobile 5.0 or Windows Embedded CE 6.0 - Valid values for this property are -128 to 128. It returns Int32.MinValue on failure. - This method requires an open connection to the peer device. If there is no active connection, then it will attempt to create one. Requires Windows Mobile 5.0 or Windows Embedded CE 6.0 As well as the ‘no connection’ issue, the native method on which the property depends is only present in later OS versions, so it will fail on earlier devices. Returns a list of services which are already installed for use on the calling machine. This property returns the services already configured for use. Those are the ones that are checked in the “Services” tab of the device’s property sheet in the Bluetooth Control panel. I presume the behaviour is similar on CE. Will only return available services for paired devices. It of course will also only returns standard system services which Windows understands. (On desktop Windows this method calls the OS function BluetoothEnumerateInstalledServices). To see all the services that a device advertises use the method. Enables or disables services for a Bluetooth device. The service GUID on the remote device. Service state - TRUE to enable the service, FALSE to disable it. When called on Windows CE, the device will require a soft-reset to enabled the settings. The system maintains a mapping of service guids to supported drivers for Bluetooth-enabled devices. Enabling a service installs the corresponding device driver. Disabling a service removes the corresponding device driver. If a non-supported service is enabled, a driver will not be installed. This overload is silent on error; the other overload raises an exception if required (). - Thrown if this method is called on Windows CE platforms. Enables or disables services for a Bluetooth device. The service GUID on the remote device. Service state - TRUE to enable the service, FALSE to disable it. Whether the method should raise an exception when When called on Windows CE, the device will require a soft-reset to enabled the settings. The system maintains a mapping of service guids to supported drivers for Bluetooth-enabled devices. Enabling a service installs the corresponding device driver. Disabling a service removes the corresponding device driver. If a non-supported service is enabled, a driver will not be installed. - The call failed. Run an SDP query on the device’s Service Discovery Database. - For instance to see whether the device has an an Serial Port services search for UUID , or too find all the services that use RFCOMM use , or all the services use . If the device isn’t accessible a with 10108 (0x277C) occurs. - The UUID to search for, as a . - The parsed record as an . - Dim bdi As BluetoothDeviceInfo = ... Dim records As ServiceRecord() = bdi.GetServiceRecords(BluetoothService.RFCommProtocol) ' Dump each to console For Each curRecord As ServiceRecord In records ServiceRecordUtilities.Dump(Console.Out, curRecord) Next - The query failed. Run an SDP query on the device’s Service Discovery Database, returning the raw byte rather than a parsed record. - If the device isn’t accessible a with 10108 (0x277C) occurs. - The UUID to search for, as a . - An array of array of . - The query failed. Returns the raw results from the native call(s); the format is different on Win32 versus WinCE. On CE this is thus a single item which is a ElementSequence of records. On Win32 it is an array with each item being a record. Specifies whether the device is connected. Not supported under Windows CE and will always return false. Specifies whether the device is a remembered device. Not all remembered devices are authenticated. - Now supported under Windows CE — will return the same as . Specifies whether the device is authenticated, paired, or bonded. All authenticated devices are remembered. Is now supported on both CE and XP. Displays information about the device. Listens for connections from Bluetooth network clients. The class provides simple methods that listen for and accept incoming connection requests in blocking synchronous mode. You can use either a or a to connect with a Initializes a new instance of the class. ---- Initializes a new instance of the class to listen on the specified service identifier. The Bluetooth service to listen for. An SDP record is published on successful to advertise the server. A generic record is created, containing the essential ServiceClassIdList and ProtocolDescriptorList attributes. The specified service identifier is inserted into the former, and the RFCOMM Channel number that the server is listening on is inserted into the latter. See the Bluetooth SDP specification for details on the use and format of SDP records. If a SDP record with more elements is required, then use one of the other constructors that takes an SDP record e.g. , or when passing it as a byte array . The format of the generic record used here is shown there also. Call the method to begin listening for incoming connection attempts. Initializes a new instance of the class that listens for incoming connection attempts on the specified local Bluetooth address and service identifier. A that represents the local Bluetooth radio address. The Bluetooth service on which to listen for incoming connection attempts. An SDP record is published on successful to advertise the server. A generic record is created, containing the essential ServiceClassIdList and ProtocolDescriptorList attributes. The specified service identifier is inserted into the former, and the RFCOMM Channel number that the server is listening on is inserted into the latter. See the Bluetooth SDP specification for details on the use and format of SDP records. If a SDP record with more elements is required, then use one of the other constructors that takes an SDP record e.g. , or when passing it as a byte array, e.g. . The format of the generic record used here is shown there also. Call the method to begin listening for incoming connection attempts. Initializes a new instance of the class with the specified local endpoint. A that represents the local endpoint to which to bind the listener . An SDP record is published on successful to advertise the server. A generic record is created, containing the essential ServiceClassIdList and ProtocolDescriptorList attributes. The specified service identifier is inserted into the former, and the RFCOMM Channel number that the server is listening on is inserted into the latter. See the Bluetooth SDP specification for details on the use and format of SDP records. If a SDP record with more elements is required, then use one of the other constructors that takes an SDP record e.g. , or when passing it as a byte array . The format of the generic record used here is shown there also. Call the method to begin listening for incoming connection attempts. Initializes a new instance of the class to listen on the specified service identifier, publishing the specified SDP record. The Bluetooth service to listen for. Prepared SDP Record to publish. The index in the byte array where the RFCOMM Channel Number that the server is listening on is to be placed. However the supplied record is now parsed into an instance, and the channel offset is not used. The constructors taking the SDP record explicitly (as a byte array) should only be used if a specialized SDP record is required. For instance when using one of the standard profiles. Otherwise use one of the other constructors e.g. which create a generic SDP Record from the specified service identifier. Instead of passing a byte array containing a hand-built record, the record can also be built using the and classes, and passed to the respective constuctor, e.g. Any useful SDP record will include a ProtocolDescriptor element containing the RFCOMM Channel number that the server is listening on, and a ServiceClassId element containing the service UUIDs. The record supplied in the parameter should contain those elements. On successful , the RFCOMM Channel number that the protocol stack has assigned to the server is retrieved, and copied into the service record before it is published. The indicates the location of the respective byte in the byte array. An example SDP record is as follows. This is actually the format of the generic record used in the other constructors. For another example see the code in the ObexListener class. // The asterisks note where the Service UUID and the Channel number are // to be filled in. byte[] record = new byte[] { //Element Sequence: 0x35,0x27, //UInt16: 0x0001 -- ServiceClassIdList 0x09,0x00,0x01, //Element Sequence: 0x35,0x11, // UUID128: 00000000-0000-0000-0000-000000000000 -- * Service UUID 0x1c, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, // //UInt16: 0x0004 -- ProtocolDescriptorList 0x09,0x00,0x04, //Element Sequence: 0x35,0x0c, // Element Sequence: 0x35,0x03, // UUID16: 0x0100 -- L2CAP 0x19,0x01,0x00, // Element Sequence: 0x35,0x05, // UUID16: 0x0003 -- RFCOMM 0x19,0x00,0x03, // UInt8: 0x00 -- * Channel Number 0x08,0x00 }; For that record the channelOffset is 40. Initializes a new instance of the class that listens for incoming connection attempts on the specified local Bluetooth address and service identifier, publishing the specified SDP record. A that represents the local Bluetooth radio address. The Bluetooth service to listen for. Prepared SDP Record to publish The index in the byte array where the RFCOMM Channel Number that the server is listening on is to be placed. However the supplied record is now parsed into an instance, and the channel offset is not used. The constructors taking the SDP record explicitly (as a byte array) should only be used if a specialized SDP record is required. For instance when using one of the standard profiles. Otherwise use one of the other constructors e.g. which create a generic SDP Record from the specified service identifier. Instead of passing a byte array containing a hand-built record, the record can also be built using the and classes, and passed to the respective constuctor, e.g. Any useful SDP record will include a ProtocolDescriptor element containing the RFCOMM Channel number that the server is listening on, and a ServiceClassId element containing the service UUIDs. The record supplied in the parameter should contain those elements. On successful , the RFCOMM Channel number that the protocol stack has assigned to the server is retrieved, and copied into the service record before it is published. The indicates the location of the respective byte in the byte array. An example SDP record is as follows. This is actually the format of the generic record used in the other constructors. For another example see the code in the ObexListener class. // The asterisks note where the Service UUID and the Channel number are // to be filled in. byte[] record = new byte[] { //Element Sequence: 0x35,0x27, //UInt16: 0x0001 -- ServiceClassIdList 0x09,0x00,0x01, //Element Sequence: 0x35,0x11, // UUID128: 00000000-0000-0000-0000-000000000000 -- * Service UUID 0x1c, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, // //UInt16: 0x0004 -- ProtocolDescriptorList 0x09,0x00,0x04, //Element Sequence: 0x35,0x0c, // Element Sequence: 0x35,0x03, // UUID16: 0x0100 -- L2CAP 0x19,0x01,0x00, // Element Sequence: 0x35,0x05, // UUID16: 0x0003 -- RFCOMM 0x19,0x00,0x03, // UInt8: 0x00 -- * Channel Number 0x08,0x00 }; For that record the channelOffset is 40. Initializes a new instance of the class with the specified local endpoint, publishing the specified SDP record. A that represents the local endpoint to which to bind the listener . Prepared SDP Record to publish The index in the byte array where the RFCOMM Channel Number that the server is listening on is to be placed. However the supplied record is now parsed into an instance, and the channel offset is not used. The constructors taking the SDP record explicitly (as a byte array) should only be used if a specialized SDP record is required. For instance when using one of the standard profiles. Otherwise use one of the other constructors e.g. which create a generic SDP Record from the specified service identifier. Instead of passing a byte array containing a hand-built record, the record can also be built using the and classes, and passed to the respective constuctor, e.g. Any useful SDP record will include a ProtocolDescriptor element containing the RFCOMM Channel number that the server is listening on, and a ServiceClassId element containing the service UUIDs. The record supplied in the parameter should contain those elements. On successful , the RFCOMM Channel number that the protocol stack has assigned to the server is retrieved, and copied into the service record before it is published. The indicates the location of the respective byte in the byte array. An example SDP record is as follows. This is actually the format of the generic record used in the other constructors. For another example see the code in the ObexListener class. // The asterisks note where the Service UUID and the Channel number are // to be filled in. byte[] record = new byte[] { //Element Sequence: 0x35,0x27, //UInt16: 0x0001 -- ServiceClassIdList 0x09,0x00,0x01, //Element Sequence: 0x35,0x11, // UUID128: 00000000-0000-0000-0000-000000000000 -- * Service UUID 0x1c, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, // //UInt16: 0x0004 -- ProtocolDescriptorList 0x09,0x00,0x04, //Element Sequence: 0x35,0x0c, // Element Sequence: 0x35,0x03, // UUID16: 0x0100 -- L2CAP 0x19,0x01,0x00, // Element Sequence: 0x35,0x05, // UUID16: 0x0003 -- RFCOMM 0x19,0x00,0x03, // UInt8: 0x00 -- * Channel Number 0x08,0x00 }; For that record the channelOffset is 40. Initializes a new instance of the class to listen on the specified service identifier, publishing the specified SDP record. - The Bluetooth service to listen for. Prepared SDP Record to publish. - The constructors taking the SDP record explicitly should only be used if a specialized SDP record is required. For instance when using one of the standard profiles. Otherwise use one of the other constructors e.g. which create a generic SDP Record from the specified service identifier. Any useful SDP record will include a ProtocolDescriptor element containing the RFCOMM Channel number that the server is listening on, and a ServiceClassId element containing the service UUIDs. The record supplied in the parameter should contain those elements. On successful , the RFCOMM Channel number that the protocol stack has assigned to the server is retrieved, and copied into the service record before it is published. An example SDP record is as follows. This is actually the format of the generic record used in the other constructors. For another example see the code in the ObexListener class. private static ServiceRecord CreateBasicRfcommRecord(Guid serviceClassUuid) { ServiceElement pdl = ServiceRecordHelper.CreateRfcommProtocolDescriptorList(); ServiceElement classList = new ServiceElement(ElementType.ElementSequence, new ServiceElement(ElementType.Uuid128, serviceClassUuid)); ServiceRecord record = new ServiceRecord( new ServiceAttribute( InTheHand.Net.Bluetooth.AttributeIds.UniversalAttributeId.ServiceClassIdList, classList), new ServiceAttribute( InTheHand.Net.Bluetooth.AttributeIds.UniversalAttributeId.ProtocolDescriptorList, pdl)); return record; } Initializes a new instance of the class that listens for incoming connection attempts on the specified local Bluetooth address and service identifier, publishing the specified SDP record. - A that represents the local Bluetooth radio address. The Bluetooth service to listen for. Prepared SDP Record to publish - The constructors taking the SDP record explicitly should only be used if a specialized SDP record is required. For instance when using one of the standard profiles. Otherwise use one of the other constructors e.g. which create a generic SDP Record from the specified service identifier. Any useful SDP record will include a ProtocolDescriptor element containing the RFCOMM Channel number that the server is listening on, and a ServiceClassId element containing the service UUIDs. The record supplied in the parameter should contain those elements. On successful , the RFCOMM Channel number that the protocol stack has assigned to the server is retrieved, and copied into the service record before it is published. An example SDP record is as follows. This is actually the format of the generic record used in the other constructors. For another example see the code in the ObexListener class. private static ServiceRecord CreateBasicRfcommRecord(Guid serviceClassUuid) { ServiceElement pdl = ServiceRecordHelper.CreateRfcommProtocolDescriptorList(); ServiceElement classList = new ServiceElement(ElementType.ElementSequence, new ServiceElement(ElementType.Uuid128, serviceClassUuid)); ServiceRecord record = new ServiceRecord( new ServiceAttribute( InTheHand.Net.Bluetooth.AttributeIds.UniversalAttributeId.ServiceClassIdList, classList), new ServiceAttribute( InTheHand.Net.Bluetooth.AttributeIds.UniversalAttributeId.ProtocolDescriptorList, pdl)); return record; } Initializes a new instance of the class with the specified local endpoint, publishing the specified SDP record. A that represents the local endpoint to which to bind the listener . Prepared SDP Record to publish - The constructors taking the SDP record explicitly (as a byte array) should only be used if a specialized SDP record is required. For instance when using one of the standard profiles. Otherwise use one of the other constructors e.g. which create a generic SDP Record from the specified service identifier. Any useful SDP record will include a ProtocolDescriptor element containing the RFCOMM Channel number that the server is listening on, and a ServiceClassId element containing the service UUIDs. The record supplied in the parameter should contain those elements. On successful , the RFCOMM Channel number that the protocol stack has assigned to the server is retrieved, and copied into the service record before it is published. An example SDP record is as follows. This is actually the format of the generic record used in the other constructors. For another example see the code in the ObexListener class. private static ServiceRecord CreateBasicRfcommRecord(Guid serviceClassUuid) { ServiceElement pdl = ServiceRecordHelper.CreateRfcommProtocolDescriptorList(); ServiceElement classList = new ServiceElement(ElementType.ElementSequence, new ServiceElement(ElementType.Uuid128, serviceClassUuid)); ServiceRecord record = new ServiceRecord( new ServiceAttribute( InTheHand.Net.Bluetooth.AttributeIds.UniversalAttributeId.ServiceClassIdList, classList), new ServiceAttribute( InTheHand.Net.Bluetooth.AttributeIds.UniversalAttributeId.ProtocolDescriptorList, pdl)); return record; } Gets the underlying of the current . Get or set the Service Class flags that this service adds to the host device’s Class Of Device field. - The Class of Device value contains a Device part which describes the primary service that the device provides, and a Service part which is a set of flags indicating all the service types that the device supports, e.g. , , etc. This property supports setting those flags; bits set in this value will be added to the host device’s CoD Service Class bits when the listener is active. Supported on Win32, but not supported on WindowsMobile/WinCE as there's no native API for it. The WindowCE section of MSDN mentions the Registry value COD at key HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\sys. However my (Jam) has value 0x920100 there but advertises a CoD of 0x100114, so its not clear how the values relate to each other. Get or set the ServiceName the server will use in its SDP Record. - A string representing the value to be used for the Service Name SDP Attribute. Will be if not specfied. - The listener is already started. - or - A custom Service Record was given at initialization time. In that case the ServiceName attribute should be added to that record. Gets the underlying network . The underlying . creates a to listen for incoming client connection requests. Classes deriving from can use this property to get this . Use the underlying returned by the property if you require access beyond that which provides. Note property only returns the used to listen for incoming client connection requests. Use the method to accept a pending connection request and obtain a for sending and receiving data. You can also use the method to accept a pending connection request and obtain a for sending and receiving data. Starts listening for incoming connection requests. Starts listening for incoming connection requests with a maximum number of pending connection. The maximum length of the pending connections queue. Stops the socket from monitoring connections. Begins an asynchronous operation to accept an incoming connection attempt. An delegate that references the method to invoke when the operation is complete. A user-defined object containing information about the accept operation. This object is passed to the callback delegate when the operation is complete. An that references the asynchronous creation of the . The has been closed. Asynchronously accepts an incoming connection attempt and creates a new to handle remote host communication. An returned by a call to the method. A . Begins an asynchronous operation to accept an incoming connection attempt. Asynchronously accepts an incoming connection attempt and creates a new to handle remote host communication. An returned by a call to the method. A . Creates a new socket for a connection. AcceptSocket is a blocking method that returns a that you can use to send and receive data. If you want to avoid blocking, use the method to determine if connection requests are available in the incoming connection queue. The returned is initialized with the address and channel number of the remote device. You can use any of the Send and Receive methods available in the class to communicate with the remote device. When you are finished using the , be sure to call its method. If your application is relatively simple, consider using the method rather than the AcceptSocket method. provides you with simple methods for sending and receiving data over a network in blocking synchronous mode. A used to send and receive data. Listener is stopped. Creates a client object for a connection when the specified service or endpoint is detected by the listener component. AcceptTcpClient is a blocking method that returns a that you can use to send and receive data. Use the method to determine if connection requests are available in the incoming connection queue if you want to avoid blocking. Use the method to obtain the underlying of the returned . The will provide you with methods for sending and receiving with the remote host. When you are through with the , be sure to call its method. If you want greater flexibility than a offers, consider using . A component. Listener is stopped. Determines if there is a connection pending. true if there is a connection pending; otherwise, false. Returns the SDP Service Record for this service. Returns if the listener is not ed (and an record wasn’t supplied at initialization). Gets or sets the authentication state of the current connect or behaviour to use when connection is established. For disconnected sockets, specifies that authentication is required in order for a connect or accept operation to complete successfully. Setting this option actively initiates authentication during connection establishment, if the two Bluetooth devices were not previously authenticated. The user interface for passkey exchange, if necessary, is provided by the operating system outside the application context. For outgoing connections that require authentication, the connect operation fails with WSAEACCES if authentication is not successful. In response, the application may prompt the user to authenticate the two Bluetooth devices before connection. For incoming connections, the connection is rejected if authentication cannot be established and returns a WSAEHOSTDOWN error. On unconnected sockets, enforces encryption to establish a connection. Encryption is only available for authenticated connections. For incoming connections, a connection for which encryption cannot be established is automatically rejected and returns WSAEHOSTDOWN as the error. For outgoing connections, the connect function fails with WSAEACCES if encryption cannot be established. In response, the application may prompt the user to authenticate the two Bluetooth devices before connection. Set or change the PIN to be used with a specific remote device. Address of Bluetooth device. PIN string consisting of 1 to 16 ASCII characters. Assigning null (Nothing in VB) or an empty String will revoke the PIN. Gets a value that indicates whether the 32feet.NET library can be used with the current device. Handles security between bluetooth devices. This function stores the personal identification number (PIN) for the Bluetooth device. Address of remote device. Pin, alphanumeric string of between 1 and 16 ASCII characters. On Windows CE platforms this calls BthSetPIN, its MSDN remarks say: “Stores the pin for the Bluetooth device identified in pba. The active connection to the device is not necessary, nor is the presence of the Bluetooth controller. The PIN is persisted in the registry until BthRevokePIN is called. “While the PIN is stored, it is supplied automatically after the PIN request is issued by the authentication mechanism, so the user will not be prompted for it. Typically, for UI-based devices, you would set the PIN for the duration of authentication, and then revoke it after authentication is complete.” See also True on success, else False. This function revokes the personal identification number (PIN) for the Bluetooth device. On Windows CE platforms this calls BthRevokePIN, its MSDN remarks say: “When the PIN is revoked, it is removed from registry. The active connection to the device is not necessary, nor is the presence of the Bluetooth controller.” On Windows CE platforms this removes any pending BluetoothWin32Authentication object but does not remove the PIN for an already authenticated device. Use RemoveDevice to ensure a pairing is completely removed. See also The remote device. True on success, else False. Intiates pairing for a remote device. Remote device with which to pair. Chosen PIN code, must be between 1 and 16 ASCII characters. On Windows CE platforms this calls BthPairRequest, its MSDN remarks say: “BthPairRequest passes the parameters to the BthSetPIN function and creates an ACL connection. Once the connection is established, it calls the BthAuthenticate function to authenticate the device.” On Windows XP/Vista platforms this calls BluetoothAuthenticateDevice, if the pin argument is set to null a Wizard is displayed to accept a PIN from the user, otherwise the function executes in transparent mode. See also Whether the operation was successful. Intiates pairing for a remote device with SSP if it is available. - Remote device with which to pair. Note: not supported by all platforms. - Whether the operation was successful. Remove the pairing with the specified device - Remote device with which to remove pairing. - TRUE if device was successfully removed, else FALSE. Not supported on Windows XP On Windows CE platforms this calls BthSetLinkKey, its MSDN remarks say: “The link key is persisted in registry until BthRevokeLinkKey is called. “Typically, the Bluetooth stack manages link keys automatically, for example, it stores them when they are created. This function is useful primarily for backup purposes. “While link key is stored, it will be automatically supplied once the link key request is issued by the authentication mechanism. If the link key is incorrect, the renegotiation that involves the PIN is initiated by the Bluetooth adapter, and the PIN code may be requested from the user. “The link key length is 16 bytes. You cannot create link keys; they are generated by the Bluetooth hardware.” Retrieves the address of the Bluetooth peer device authentication that requires the PIN code. Not supported on Windows XP On Windows CE platforms this calls BthGetPINRequest, its MSDN remarks say: “There can be multiple requests outstanding. After the event that is provided by the UI handler is signaled, the UI handler must call this function multiple times until the call fails.” See also and of the remote device, or null if there is no outstanding PIN request. Refuses an outstanding PIN request. Not supported on Windows XP Address of the requesting device. On Windows CE platforms this calls BthRefusePINRequest, its MSDN remarks say: “This function refuses an outstanding PIN request that is retrieved by function.” See also and Specifies properties of a remote Bluetooth Device. - - Supported only by the Microsoft stack on desktop Windows. Originally from Win32 "bthdef.h" and used by struct BTH_DEVICE_INFO.flags. The flags are named BDIF_**. The address member contains valid data. The classOfDevice member contains valid data. The name member contains valid data. The device is a remembered and authenticated device. The BDIF_PERSONAL flag is always set when this flag is set. The device is a remembered device. If this flag is set and the BDIF_PAIRED flag is not set, the device is not authenticated. The remote Bluetooth device is currently connected to the local radio. [Vista SP1] Bluetooth Basic Rate — i.e. traditional Bluetooth [Windows 8] Bluetooth Low Energy The BluetoothAuthenticationMethod enumeration defines the supported authentication types during device pairing. The Bluetooth device supports authentication via a PIN. The Bluetooth device supports authentication via out-of-band data. The Bluetooth device supports authentication via numeric comparison. The Bluetooth device supports authentication via passkey notification. The Bluetooth device supports authentication via passkey. The AUTHENTICATION_REQUIREMENTS enumeration specifies the 'Man in the Middle' protection required for authentication. Protection against a "Man in the Middle" attack is not required for authentication. Protection against a "Man in the Middle" attack is required for authentication. Protection against a "Man in the Middle" attack is not required for bonding. Protection against a "Man in the Middle" attack is required for bonding. Protection against a "Man in the Middle" attack is not required for General Bonding. Protection against a "Man in the Middle" attack is required for General Bonding. Protection against "Man in the Middle" attack is not defined. Provides simple access to asynchronous methods on Bluetooth features, for instance to background device discovery. - Public Sub DiscoDevicesAsync() Dim bco As New BluetoothComponent() AddHandler bco.DiscoverDevicesProgress, AddressOf HandleDiscoDevicesProgress AddHandler bco.DiscoverDevicesComplete, AddressOf HandleDiscoDevicesComplete bco.DiscoverDevicesAsync(255, True, True, True, False, 99) End Sub Private Sub HandleDiscoDevicesProgress(ByVal sender As Object, ByVal e As DiscoverDevicesEventArgs) Console.WriteLine("DiscoDevicesAsync Progress found {0} devices.", e.Devices.Length) End Sub Private Sub HandleDiscoDevicesComplete(ByVal sender As Object, ByVal e As DiscoverDevicesEventArgs) Debug.Assert(CInt(e.UserState) = 99) If e.Cancelled Then Console.WriteLine("DiscoDevicesAsync cancelled.") ElseIf e.Error IsNot Nothing Then Console.WriteLine("DiscoDevicesAsync error: {0}.", e.Error.Message) Else Console.WriteLine("DiscoDevicesAsync complete found {0} devices.", e.Devices.Length) End If End Sub Initializes a new instance of the class. Initializes a new instance of the class. - A instance to use to run discovery on. Must be non-null. Optionally disposes of the managed resources used by the class. true to release both managed and unmanaged resources; false to release only unmanaged resources. Occurs when an device discovery operation completes. - This event is raised at the end of the discovery process and lists all the discovered devices. - Raises the event. A object that contains event data. Occurs during an device discovery operation to show one or more new devices. - This event is raised for all discovered devices, both the known devices which are presented first, if requested, as well as newly discovery device found by the inquiry process, again if requested. Note that any event instance may include one or more devices. Note also that a particular device may be presented more than one time; including once from the ‘known’ list, once when a device is dicovered, and possibly another time when the discovery process retrieves the new device’s Device Name. - Raises the event. A object that contains event data. Discovers accessible Bluetooth devices and returns their names and addresses. This method does not block the calling thread. - See for more information. The devices are presented in the and events. - The maximum number of devices to get information about. True to return previously authenticated/paired devices. True to return remembered devices. True to return previously unknown devices. True to return only the devices that are in range, and in discoverable mode. See the remarks section. A user-defined object that is passed to the method invoked when the asynchronous operation completes. - An array of BluetoothDeviceInfo objects describing the devices discovered. The BLUETOOTH_IO_CAPABILITY enumeration defines the input/output capabilities of a Bluetooth Device. The Bluetooth device is capable of output via display only. The Bluetooth device is capable of output via a display, and has the additional capability to presenting a yes/no question to the user. The Bluetooth device is capable of input via keyboard. The Bluetooth device is not capable of input/output. The input/output capabilities for the Bluetooth device are undefined. Provides the means to create Bluetooth classes on the one selected Bluetooth stack where multiple are loaded in the same process. - when When calling new BluetoothClient(), new BluetoothListener(), etc when multiple Bluetooth stacks are loaded at the same time then the instance is created on the primary stack. This class allows the application to select which stack the instance is created on. Access this class via property . Initialise a new instance of the class, using the respective stack and/or radio. - Initialise a new instance of the class, using the respective stack and/or radio. - The new instance. Initialise a new instance of the class, with the specified local endpoint and using the respective stack and/or radio. - See . - The new instance. Initialise a new instance of the class, using the respective stack and/or radio. - Initialise a new instance of the class, with the specified Service Class Id using the respective stack and/or radio. - See . - The new instance. Initialise a new instance of the class, with the specified Service Class Id and local device address using the respective stack and/or radio. - See . See . - The new instance. Initialise a new instance of the class, with the specified Service Class Id and local device address as a using the respective stack and/or radio. - See . - The new instance. Initialise a new instance of the class, with the specified Service Class Id and raw Service Record using the respective stack and/or radio. - See . See . See . - The new instance. Initialise a new instance of the class, with the specified Service Class Id, local device address and raw Service Record using the respective stack and/or radio. - See . See . See . See . - The new instance. Initialise a new instance of the class, with the specified Service Class Id and local device address as a and raw Service Record using the respective stack and/or radio. - See . See . See . - The new instance. Initialise a new instance of the class, with the specified Service Class Id and Service Record using the respective stack and/or radio. - See . See . - The new instance. Initialise a new instance of the class, with the specified Service Class Id, local device address and Service Record using the respective stack and/or radio. - See . See . See . - The new instance. Initialise a new instance of the class, with the specified Service Class Id and local device address as a and Service Record using the respective stack and/or radio. - See . See . - The new instance. Gets the instance for the respective stack and/or radio. - A as an Initialise a new instance of the class, using the respective stack and/or radio. - See . - The new instance. Initialise a new instance of the class, using the respective stack and/or radio. - The new instance of . - See . Initialize an instance of this class, given a scheme, a Bluetooth Device Address, and a remote path name; using the respective stack and/or radio. - The Uri scheme. One of obex, obex-push, obex-ftp, or obex-sync. The Bluetooth Device Address of the OBEX server. The path on the OBEX server. - The new instance of . Initialise a new instance of the class, using the respective stack and/or radio. - The new instance of . Represents a Bluetooth Radio device. Allows you to query properties of the radio hardware and set the mode. Gets an array of all Bluetooth radios on the system. Under Windows CE this will only ever return a single device. If the device has a third-party stack this property will return an empty collection Gets an array of all Bluetooth radios on the system. If there are no Bluetooth radios then this method will produce an error. The order in which the library will search for Bluetooth stacks is controlled by configuration. Gets the primary . For Windows CE based devices this is the only , for Windows XP this is the first available device. If the device has a third-party stack this property will return null Gets the primary . If there are no Bluetooth radios then this method will produce an error. The order in which the library will search for Bluetooth stacks is controlled by configuration. Gets a value that indicates whether the 32feet.NET library can be used with the current device. Gets a class factory for creating client and listener instances on a particular stack. Gets whether the radio is on a Bluetooth stack on a remote machine. - Is if the radio is on to the local machine, otherwise it’s the name of the remote machine to which the radio is attached. Gets the handle for this radio. Relevant only on Windows XP. Returns the current status of the Bluetooth radio hardware. A member of the enumeration. Gets or Sets the current mode of operation of the Bluetooth radio. Microsoft CE/WM This setting will be persisted when the device is reset. An Icon will be displayed in the tray on the Home screen and a ?Windows Mobile device will emit a flashing blue LED when Bluetooth is enabled. Widcomm Win32 Is supported. Widcomm CE/WM Get and Set both supported. ModeGetSet PowerOffDisabled or non-connectable CONNECT_ALLOW_NONE ConnectableConnectable CONNECT_ALLOW_ALL, note not CONNECT_ALLOW_PAIRED. DiscoverableDiscoverable Plus also discoverable. Note also that when the Widcomm stack is disabled/off we report PowerOff (not in 2.4 and earlier), but we can't turn put it in that mode from the library. Neither can we turn it back on, except that it happens when the application first uses Bluetooth! Widcomm Win32 Set is not supported. There's no Widcomm API support. Get whether the radio is connectable and/or discoverable, and powered-up. - A Bluetooth radio can be powered-off and thus cannot be used, or it can be powered-up and can make connections to a remote device (outbound), it can then also independently have the two "Scan Modes" set, they are: Connectable (for inbound connections) and Discoverable. There are restrictions on the various platforms that we support: for instance when the radio is powered-down how the scan state is reported, whether the power state can be reported, whether the radio can be make non-connectable if is still discoverable, and finally whether a user application is restricted in how it can change modes. See for more information. The Microsoft stack on desktop Windows for instance does not allow the radio to be set non-connectable when it is discoverable, the radio cannot be powered-down (in Windows 7 and earlier), and the mode options that can be set are restructed depending on what mode settings the user has made manually in the Bluetooth Control Panel. Get the address of the local Bluetooth radio device. - The property can return a value in some cases. For instance on CE when the radio is powered-off the value will be null. - The address of the local Bluetooth radio device. Returns the friendly name of the local Bluetooth radio. - Devices normally cache the remote device name, only reading it the first time the remote device is discovered. It is generally not useful then to change the name to provide a status update. For instance on desktop Windows with the Microsoft stack we haven't found a good way for the name to be flushed so that it is re-read, even deleting the device didn't flush the name if I remember correctly. Currently read-only on Widcomm stack. Probably could be supported, let us know if you need this function. Returns the Class of Device. Returns the manufacturer of the device. See for more information. Bluetooth Version supported by the Host Controller Interface implementation. - There are five fields returned by the Read Local Version Information HCI command: HCI Version, HCI Revision, LMP Version, Manufacturer_Name, and LMP Subversion. We expose all five, but not all platforms provide access to them all. The Microsoft stack on desktop Windows exposes all five, except for Windows XP which only exposes the Manufacturer and LmpSubversion values. Bluetopia apparently exposes none of them. The Microsoft stack on Windows Mobile, Widcomm on both platforms, BlueSoleil, and BlueZ expose all five. Manufacture's Revision number of the HCI implementation. See for more information. Bluetooth Version supported by the Link Manager Protocol implementation. See for more information. Manufacture's Revision number of the LMP implementation. See for more information. Get the LMP Features flags for the radio. - Implemented on all stacks except Widcomm. Only tested so far on MSFT+Win32, MSFT+WM, and Bluetopia. Implemented *after* version 3.5, see workitem 33059. Returns the manufacturer of the Bluetooth software stack running locally. Handles security between bluetooth devices. Intiates pairing for a remote device. Remote device with which to pair. Chosen PIN code, must be between 1 and 16 ASCII characters. Or null to initiate pairing to be handled for instance by . - These days most devices are using Bluetooth version 2.1's Secure Simple Pairing (SSP) which does not use a PIN code. So instead use this function only to initiate pairing by passing null as . To handle pairing, at least on desktop Windows with the Microsoft Bluetooth stack, use class and respond to the pairing callback method as required; for most of the SSP pairing methods that is to set BluetoothWin32AuthenticationEventArgs.Confirm to true, and for traditional pairing instead set BluetoothWin32AuthenticationEventArgs.Pin to the PIN code. On Windows CE platforms this calls BthPairRequest, its MSDN remarks say: “BthPairRequest passes the parameters to the BthSetPIN function and creates an ACL connection. Once the connection is established, it calls the BthAuthenticate function to authenticate the device.” On Windows XP/Vista platforms this calls BluetoothAuthenticateDevice. If the pin argument is set to null pairing is initiated and if there is no instance of class then a Wizard is displayed to accept a PIN from the user. See also Whether the operation was successful. Remove the pairing with the specified device - Remote device with which to remove pairing. - TRUE if device was successfully removed, else FALSE. This function stores the personal identification number (PIN) for the Bluetooth device. Address of remote device. Pin, alphanumeric string of between 1 and 16 ASCII characters. On Windows CE platforms this calls BthSetPIN, its MSDN remarks say: “Stores the pin for the Bluetooth device identified in pba. The active connection to the device is not necessary, nor is the presence of the Bluetooth controller. The PIN is persisted in the registry until BthRevokePIN is called. “While the PIN is stored, it is supplied automatically after the PIN request is issued by the authentication mechanism, so the user will not be prompted for it. Typically, for UI-based devices, you would set the PIN for the duration of authentication, and then revoke it after authentication is complete.” See also True on success, else False. This function revokes the personal identification number (PIN) for the Bluetooth device. On Windows CE platforms this calls BthRevokePIN, its MSDN remarks say: “When the PIN is revoked, it is removed from registry. The active connection to the device is not necessary, nor is the presence of the Bluetooth controller.” On Windows CE platforms this removes any pending BluetoothWin32Authentication object but does not remove the PIN for an already authenticated device. Use RemoveDevice to ensure a pairing is completely removed. See also The remote device. True on success, else False. Not supported on Windows XP - The device whose Link Key to retrieve. The 16-byte Link Key to set. - true if the operation was successful; false otherwise. - On Windows CE platforms this calls BthSetLinkKey, its MSDN remarks say: “The link key is persisted in registry until BthRevokeLinkKey is called. “Typically, the Bluetooth stack manages link keys automatically, for example, it stores them when they are created. This function is useful primarily for backup purposes. “While link key is stored, it will be automatically supplied once the link key request is issued by the authentication mechanism. If the link key is incorrect, the renegotiation that involves the PIN is initiated by the Bluetooth adapter, and the PIN code may be requested from the user. “The link key length is 16 bytes. You cannot create link keys; they are generated by the Bluetooth hardware.” Retrieves the address of the Bluetooth peer device authentication that requires the PIN code. Not supported on Windows XP On Windows CE platforms this calls BthGetPINRequest, its MSDN remarks say: “There can be multiple requests outstanding. After the event that is provided by the UI handler is signaled, the UI handler must call this function multiple times until the call fails.” See also and of the remote device, or null if there is no outstanding PIN request. Refuses an outstanding PIN request. Not supported on Windows XP - Address of the requesting device. - true if the operation was successful; false otherwise. - On Windows CE platforms this calls BthRefusePINRequest, its MSDN remarks say: “This function refuses an outstanding PIN request that is retrieved by function.” See also and Standard Bluetooth Profile identifiers. - See the list at . The Bluetooth Base UUID is {00000000-0000-1000-8000-00805F9B34FB} Represents an empty service Guid. Represents the base Guid from which all standard Bluetooth profiles are derived - not used for connections. Is {00000000-0000-1000-8000-00805F9B34FB} [0x0001] [0x0002] [0x0003] [0x0004] [0x0005] [0x0006] [0x0008] [0x0008] [0x0009] [0x000A] [0x000C] [0x000E] [0x000F] [0x0010] [0x0011] [0x0012] [0x0014] [0x0016] [0x0017] [0x0019] [0x001B] [0x001D] ????? [0x001E] [0x001F] [0x0100] [0x1000] [0x1001] [0x1002] Provides a basic Serial emulation connect over Bluetooth. [0x1101] Used to establish PPP connections over RFComm channels. [0x1102] [0x1103] [0x1104] Used for sending binary objects between devices.[0x1105] OBEX version of an FTP server [0x1106] [0x1107] HSP (Headset Profile) — Supports Bluetooth headset devices.[0x1108] See also [0x1109] [0x110A] [0x110B] [0x110C] [0x110D] [0x110E] [0x110F] [0x1110] [0x1111] [0x1112] See also [0x1113] [0x1114] [0x1115] [0x1116] [0x1117] [0x1118] [0x1119] [0x111A] [0x111B] [0x111C] [0x111D] Supports hands free kits such as a car kits which provide audio and more advanced call control than the Headset profile. [0x111E] [0x111F] [0x1120] [0x1121] Used for printing simple text, HTML, vCard objects and similar. [0x1122] [0x1123] Supports human interface devices such as keyboards and mice. [0x1124] [0x1125] [0x1126] [0x1127] Common_ISDN_Access [0x1128] [0x1129] UDI_MT [0x112A] UDI_TA [0x112B] [0x112C] SIM_Access [0x112D] Phonebook Access - PCE [0x112E] Phonebook Access - PSE [0x112F] Phonebook Access [0x1130] Headset [0x1131] See also Message Access Server [0x1132] Message Notification Server [0x1133] Message Access Profile [0x1134] Bluetooth Device Identification. [0x1200] [0x1201] [0x1202] [0x1203] [0x1204] [0x1205] [0x1206] ESDP_UPNP_IP_PAN [0x1300] ESDP_UPNP_IP_LAP [0x1301] ESDP_UPNP_L2CAP [0x1302] Video Distribution Profile - Source [0x1303] Video Distribution Profile - Sink [0x1304] Video Distribution Profile [0x1305] Health Device Profile (HDP) [0x1400] Health Device Profile (HDP) - Source [0x1401] Health Device Profile (HDP) - Sink [0x1402] Retrieves the name of the Service Class UUID that has the specified value. The service class UUID as a . A string containing the name of the service class whose UUID value is , or a null reference (Nothing in Visual Basic) if no such constant is found. Retrieves the name of the Service Class UUID that has the specified value. The service class UUID in the 16-bit UUID short form as a . A string containing the name of the service class whose UUID value is , or a null reference (Nothing in Visual Basic) if no such constant is found. Retrieves the name of the Service Class UUID that has the specified value. The service class UUID in the 16-bit short UUID form as a . A string containing the name of the service class whose UUID value is , or a null reference (Nothing in Visual Basic) if no such constant is found. Retrieves the name of the Service Class UUID that has the specified value. The service class UUID in the 32-bit short UUID form as a . A string containing the name of the service class whose UUID value is , or a null reference (Nothing in Visual Basic) if no such constant is found. Retrieves the name of the Service Class UUID that has the specified value. The service class UUID in the 32-bit UUID short form as a . A string containing the name of the service class whose UUID value is , or a null reference (Nothing in Visual Basic) if no such constant is found. Create a full 128-bit Service class UUID from its 16-bit short form. The service class UUID in the 16-bit UUID short form as a . A containing the full 128-bit form of the supplied Bluetooth service class UUID. Create a full 128-bit Service class UUID from its 16-bit short form. The service class UUID in the 16-bit UUID short form as a . A containing the full 128-bit form of the supplied Bluetooth service class UUID. Create a full 128-bit Service class UUID from its 16-bit short form. The service class UUID in the 32-bit UUID short form as a . A containing the full 128-bit form of the supplied Bluetooth service class UUID. Create a full 128-bit Service class UUID from its 16-bit short form. The service class UUID in the 32-bit UUID short form as a . A containing the full 128-bit form of the supplied Bluetooth service class UUID. Provides Bluetooth authentication services on desktop Windows. - This class is supported on desktop Windows and with the Microsoft stack only. This class can be used in one of two ways. Firstly an instance can be created specifying one device that is being connected to and the PIN string to use for it. (That form is used internally by to support its method). Secondly it can also be used a mode where a user supplied callback will be called when any device requires authentication, the callback includes a parameter of type . Various authentication methods are available in Bluetooth version 2.1 and later. Which one is being used is indicated by the property. If it is then the callback method should set the property. For the other authentication methods e.g. or the callback method should use one or more of the other properties and methods e.g. , , , etc. See the example below for a 'Legacy' method handler. The callback mode can be configured to do a callback after the ‘send PIN’ action, this allows one to see if it was successful etc. An example sequence where the PIN was incorrect is as follows. Authenticate one device -- with wrong passcode here the first two times. Passcode respectively: 'BAD-x', 'BAD-y', '9876' Making PC discoverable Hit Return to complete Authenticating 0017E464CF1E wm_alan1 Attempt# 0, Last error code 0 Sending "BAD-x" Authenticating 0017E464CF1E wm_alan1 Attempt# 1, Last error code 1244 Sending "BAD-y" Authenticating 0017E464CF1E wm_alan1 Attempt# 2, Last error code 1167 Sending "9876" Authenticating 0017E464CF1E wm_alan1 Attempt# 3, Last error code 1167 etc That is we see the error code of 1244=NativeErrorNotAuthenticated once, and then the peer device disappears (1167=NativeErrorDeviceNotConnected). I suppose that's a security feature -- its stops an attacker from trying again and again with different passcodes. Anyway the result of that is that is it not worth repeating the callback after the device disappears. The code now enforces this. With set to true, if the result of the previous attempt was ‘success’ or ‘device not connected’ then any new PIN set in the callback won’t be used and thus the callback won’t be called again for that authentication attempt. A successful authentication process can thus be detected by checking if e.PreviousNativeErrorCode == NativeErrorSuccess && e.AttemptNumber != 0 The instance will continue receiving authentication requests until it is disposed or garbage collected, so keep a reference to it whilst it should be active and call when you’re finished. - If one wants to respond to PIN requests for one device with a known PIN then use the simple form which is initialized with an address and PIN. BluetoothWin32Authentication authenticator = new BluetoothWin32Authentication(remoteEP.Address, m_pin); // when the peer is expected to require pairing, perhaps do some work. authenticator.Dispose(); If one wants to see the PIN request, perhaps to be able to check the type of the peer by its address then use the form here which requests callbacks. (Note that this code assumes that 'Legacy' PIN-based pairing is being used; setting the Pin property will presumably have no effect if the authentication method being used is one of the v2.1 SSP forms). Using pairer As New BluetoothWin32Authentication(AddressOf Win32AuthCallbackHandler) Console.WriteLine("Hit Return to stop authenticating") Console.ReadLine() End Using ... Sub Win32AuthCallbackHandler(ByVal sender As Object, ByVal e As InTheHand.Net.Bluetooth.BluetoothWin32AuthenticationEventArgs) ' Note we assume here that 'Legacy' pairing is being used, ' and thus we only set the Pin property! Dim address As String = e.Device.DeviceAddress.ToString() Console.WriteLine("Received an authentication request from address " + address) ' compare the first 8 hex numbers, this is just a special case because in the ' used scenario the model of the devices can be identified by the first 8 hex ' numbers, the last 4 numbers being the device specific part. If address.Substring(0, 8).Equals("0099880D") OrElse _ address.Substring(0, 8).Equals("0099880E") Then ' send authentication response e.Pin = "5276" ElseIf (address.Substring(0, 8).Equals("00997788")) Then ' send authentication response e.Pin = "ásdfghjkl" End If End Sub Windows’ ERROR_SUCCESS Windows’ ERROR_NOT_AUTHENTICATED Windows’ ERROR_DEVICE_NOT_CONNECTED Initializes a new instance of the class. - Initializes a new instance of the class, to respond to a specific address with a specific PIN string. - The instance will continue receiving authentication requests until it is disposed or garbage collected, so keep a reference to it whilst it should be active, and call when you’re finished. - The address of the device to authenticate, as a . The PIN string to use for authentication, as a . Initializes a new instance of the class, to call a specified handler when any device requires authentication. - See the example below. The callback mode can be configured to do a callback after the ‘send PIN’action, this allows one to see if it was successful etc. An example sequence where the PIN was incorrect is as follows. Authenticate one device -- with wrong passcode here the first two times. Passcode respectively: 'BAD-x', 'BAD-y', '9876' Making PC discoverable Hit Return to complete Authenticating 0017E464CF1E wm_alan1 Attempt# 0, Last error code 0 Sending "BAD-x" Authenticating 0017E464CF1E wm_alan1 Attempt# 1, Last error code 1244 Sending "BAD-y" Authenticating 0017E464CF1E wm_alan1 Attempt# 2, Last error code 1167 Sending "9876" Authenticating 0017E464CF1E wm_alan1 Attempt# 3, Last error code 1167 etc That is we see the error code of 1244=NativeErrorNotAuthenticated once, and then the peer device disappears (1167=NativeErrorDeviceNotConnected). I suppose that's a security feature -- its stops an attacker from trying again and again with different passcodes. Anyway the result of that is that is it not worth repeating the callback after the device disappears. The code now enforces this. With set to true, if the result of the previous attempt was ‘success’ or ‘device not connected’ then any new PIN set in the callback won’t be used and thus the callback won’t be called again for that authentication attempt. A successful authentication process can thus be detected by setting CallbackWithResult=true and checking in the callback if e.PreviousNativeErrorCode == NativeErrorSuccess && e.AttemptNumber != 0 The instance will continue receiving authentication requests until it is disposed or garbage collected, so keep a reference to it whilst it should be active, and call when you’re finished. - A reference to a handler function that can respond to authentication requests. - Using pairer As New BluetoothWin32Authentication(AddressOf Win32AuthCallbackHandler) Console.WriteLine("Hit Return to stop authenticating") Console.ReadLine() End Using ... Sub Win32AuthCallbackHandler(ByVal sender As Object, ByVal e As InTheHand.Net.Bluetooth.BluetoothWin32AuthenticationEventArgs) Dim address As String = e.Device.DeviceAddress.ToString() Console.WriteLine("Received an authentication request from address " + address) ' compare the first 8 hex numbers, this is just a special case because in the ' used scenario the model of the devices can be identified by the first 8 hex ' numbers, the last 4 numbers being the device specific part. If address.Substring(0, 8).Equals("0099880D") OrElse _ address.Substring(0, 8).Equals("0099880E") Then ' send authentication response e.Pin = "5276" ElseIf (address.Substring(0, 8).Equals("00997788")) Then ' send authentication response e.Pin = "ásdfghjkl" End If End Sub Calls the authentication callback handler. - An instance of containing the details of the authentication callback. Release the unmanaged resources used by the . Release the unmanaged resources used by the , and optionally disposes of the managed resources. Provides data for an authentication event. - For usage information, see the class documentation at it includes an example, also see the documentation on each of this class’s properties. Initialize an instance of . Initialize an instance of . - The device information to store in the event args. Gets the device requiring an authentication response as a . Gets a enumeration value that specifies the 'Man in the Middle' protection required for authentication. Gets a enumeration value that defines the input/output capabilities of the Bluetooth device. Gets a enumeration value that defines the authentication method utilized by the Bluetooth device. - The method to be used depends on the and the on both machines. See for how to respond to each of the authentication methods. Gets whether the is and it is of subtype "JustWorks". - Gets whether the is and it is of subtype "JustWorks". If true then a simple Yes/No answer from the user is adequate, Or if false then the (or ) value should be displayed to the user(s) so that he/she/they can verify that the values displayed on both devices are the same. Is null if is not . Get the Numeric or Passcode value being used by the SSP pairing event. - Is a six digit number from 000000 to 999999, or if not present. - Will be present in the , , and authentication methods only. Is a six digit number from 000000 to 999999. Gets the formatted in its correct six decimal digits format. - A representing formatted in its six decimal digits format, or if is . Gets or sets the PIN string to be used to authenticate the specified device. - Is only used in the pairing method. On an authentication event, a PIN response is sent if the value returned from the handler is not . Get or set whether we will respond positively, negatively or ignore the SSP pairing event. Get or set what Numeric or Passcode value or whether no value will be used in responding to the SSP pairing event. - Is a number from 000000 to 999999, or null if not to be included in the response. Creates a positive response to the pairing event also providing optional security values. - An byte array of length 16 bytes, or null. A 128-bit cryptographic key used for two-way authentication. An byte array of length 16 bytes, or null. A randomly generated number used for one-way authentication. If this number is not provided by the device initiating the OOB session, this value is 0. Gets or sets whether the callback is called again after the PIN response is sent. - This is useful to see the error code returned by sending the PIN response. It can thus also be used to see the successful result of sending the PIN response. See the documentation on the class. Gets how many attempts at sending a PIN have been tried. When there’s a new PIN request, the first time the callback is called this property will have value zero. If the PIN is rejected and was set, then the callback will be recalled and this property will have value one, etc. The Windows error code returned by the last PIN response attempt. - A bad PIN/passcode value appears to result in a error code with value 1244, which is . If one tries to respond to that failure with another passcode, then error 1167 results. So it seems that only one attempt is possible. The Windows error code returned by the last PIN response attempt, as an unsigned value. - See . - Gets whether it is not possible to send another PIN response. For instance, in testing it appears that after one response the device becomes non-contactable, any PIN response returning error code . A format string to display the Passkey or comparison Number as six decimal digits. The BLUETOOTH_AUTHENTICATION_CALLBACK_PARAMS structure contains specific configuration information about the Bluetooth device responding to an authentication request. A BLUETOOTH_DEVICE_INFO structure that contains information about a Bluetooth device. A BLUETOOTH_AUTHENTICATION_METHOD enumeration that defines the authentication method utilized by the Bluetooth device. A BLUETOOTH_IO_CAPABILITY enumeration that defines the input/output capabilities of the Bluetooth device. A AUTHENTICATION_REQUIREMENTS specifies the 'Man in the Middle' protection required for authentication. A ULONG value used for Numeric Comparison authentication. or A ULONG value used as the passkey used for authentication. The BLUETOOTH_PIN_INFO structure contains information used for authentication via PIN. The BLUETOOTH_OOB_DATA_INFO structure contains data used to authenticate prior to establishing an Out-of-Band device pairing. The base class for classes containing Radio In- and Out-of-Range events. - Supported only by the Microsoft stack on desktop Windows. Produced by class . Gets the device to which the event applies. The data for Radio Out-of-Range event. - Supported only by the Microsoft stack on desktop Windows. Produced by class . Gets a string representation of the event. A string (e.g. contains the device address and name). The data for Radio Out-of-Range event. - Supported only by the Microsoft stack on desktop Windows. Produced by class . The current state of the device according to the Bluetooth stack. The previous state of the device according to the Bluetooth stack. The flags that are set in the current state and weren't in the previous state (calculated). The flags that are not set in the current state but were in the previous state (calculated). Gets a string representation of the event. A string (e.g. contains the device address, name and the current and previous flags). Provides access to the Bluetooth events from the Microsoft stack on desktop Windows. - Supported only by the Microsoft stack on desktop Windows. The Microsoft Bluetooth stack on Window raises events for various Bluetooth actions. We expose that feature via this class. Currently it raises two types of event: in-range and out-of-range using classes: and . Both have properties Device which return a BluetoothDeviceInfo. Then the in-range event also includes a set of flags, which in Windows XP are: Address, Cod, Name, Paired, Personal, and Connected; more events are available in Windows 7. These events are provided on the class via properties: and , and also etc. To see the events get an instance of this class via its method . Then one should register for the events on that instance and keep a reference to it. Note that just being in range is not enough for devices to know that the other is present. Without running device discovery or a connection attempt the two devices will not see each other. Note however that Windows XP also does not raise events when running device discovery (inquiry), this is fixed in Windows 7 (probably Vista). See 32feet blog: Device Discovery improvements on MSFT+Win32 for more information. For example when connecting and disconnecting on Windows XP to another device that is not paired we see: 12:23:48.9582648: InRange 000A3A6865BB 'joe', now 'Address, Cod, Name, Connected' was 'Address, Cod, Name'. 12:24:16.8009456: InRange 000A3A6865BB 'joe', now 'Address, Cod, Name' was 'Address, Cod, Name, Connected'.}} For example when connecting and then disconnecting on Windows 7 to another v2.1 device that is paired with we see: 20:53:25.5605469: InRange 00190E02C916 'alanlt2ws', now 'Address, Cod, Name, Paired, Personal, Connected, SspSupported, SspPaired, Rssi, Eir' was 'Address, Cod, Name, Paired, Personal, SspSupported, SspPaired, Rssi, Eir'. 20:53:27.7949219: InRange 00190E02C916 'fred', now 'Address, Cod, Name, Paired, Personal, SspSupported, SspPaired, Rssi, Eir' was 'Address, Cod, Name, Paired, Personal, Connected, SspSupported, SspPaired, Rssi, Eir'.}} Initialise an instance of the class. - Consider using the method instead of calling this constructor. Initialise an instance of the class for the specified radio. - The radio to listen for events from. Must be non-null and a MSFT+Win32 stack radio. - Note that since the Microsoft stack supports only one radio (controller) there is lilely no benefit in calling this constructor as opposed to the other constructor or method . Gets a possible shared instance of this class. - If more that one piece of code is using this class then there is no need for each to have a private instance. This method allows them to access a shared instance. When first called it creates a new instance and keeps a weak-reference to it. Subsequent callers will then get the same instance. The instance is kept alive only as long as at least one caller keeps a reference to it. If no references are kept then the instance will be deleted and a new instance will be created when this method is next called. - An instance of this class. Raises the event. - A that contains the event data. “This message is sent when any of the following attributes of a remote Bluetooth device has changed: the device has been discovered, the class of device, name, connected state, or device remembered state. This message is also sent when these attributes are set or cleared.” Raises the event. - A that contains the event data. “This message is sent when a previously discovered device has not been found after the completion of the last inquiry.” Releases the resources used by the instance. Releases the unmanaged resources used by the instance and optionally releases the managed resources. “” “This message is sent when any of the following attributes of a remote Bluetooth device has changed: the device has been discovered, the class of device, name, connected state, or device remembered state. This message is also sent when these attributes are set or cleared.” “This message is sent when a previously discovered device has not been found after the completion of the last inquiry. This message will not be sent for remembered devices. The BTH_ADDRESS structure is the address of the device that was not found.” “This message should be ignored by the application. If the application must receive PIN requests, the BluetoothRegisterForAuthentication function should be used.” “This message is sent when an L2CAP channel between the local radio and a remote Bluetooth device has been established or terminated. For L2CAP channels that are multiplexers, such as RFCOMM, this message is only sent when the underlying channel is established, not when each multiplexed channel, such as an RFCOMM channel, is established or terminated.” “This message is sent when a remote Bluetooth device connects or disconnects at the ACL level.” Buffer associated with GUID_BLUETOOTH_L2CAP_EVENT Remote radio address which the L2CAP event is associated with The PSM that is either being connected to or disconnected from If != 0, then the channel has just been established. If == 0, then the channel has been destroyed. Notifications for a destroyed channel will only be sent for channels successfully established. If != 0, then the local host iniated the l2cap connection. If == 0, then the remote host initated the connection. This field is only valid if connect is != 0. Buffer associated with GUID_BLUETOOTH_HCI_EVENT Remote radio address which the HCI event is associated with HCI_CONNNECTION_TYPE_XXX value If != 0, then the underlying connection to the remote radio has just been estrablished. If == 0, then the underlying conneciton has just been destroyed. A request to change the current configuration (dock or undock) has been canceled. The current configuration has changed, due to a dock or undock. A custom event has occurred. Windows NT 4.0 and Windows 95:  This value is not supported. A device or piece of media has been inserted and is now available. Permission is requested to remove a device or piece of media. Any application can deny this request and cancel the removal. A request to remove a device or piece of media has been canceled. A device or piece of media has been removed. A device or piece of media is about to be removed. Cannot be denied. A device-specific event has occurred. A device has been added to or removed from the system. Windows NT 4.0 and Windows Me/98/95:  This value is not supported. Permission is requested to change the current configuration (dock or undock). The meaning of this message is user-defined. oem-defined device type devnode number /// l network resource device interface class file system handle Describes the device and service capabilities of a device. - Is returned by the properties BluetoothDeviceInfo.ClassOfDevice and BluetoothRadio.ClassOfDevice. Initialize a new instance of class . - An example raw value is 0x00020104, which stands for device: DesktopComputer, service: Network. - A containing the raw Class of Device value. Initialize a new instance of class . - A value. A value. Returns the device type. Returns the major device type. Returns supported service types. Gets the numerical value. Gets the numerical value, suitable for CLS Compliance. Returns the hash code for this instance. A hash code for the current object. Returns the numerical value represented in a hexadecimal. - A containing the numerical value represented in a hexadecimal e.g. "720104", "5A020C". Returns a value indicating whether this instance is equal to a specified object. An object value to compare with the current instance. true if is an instance of and equals the value of this instance; otherwise, false. Returns a value indicating whether this instance is equal to a specified value. An value to compare with the current instance. true if has the same value as this instance; otherwise, false. Class of Device flags as assigned in the Bluetooth specifications. Is returned by the property ClassOfDevice.Device. Defined in Bluetooth Specifications . Miscellaneous — [Ref #2: Used where a more specific Major Device Class code is not suited (but only as specified in this document). Devices that do not have a major class code assigned can use the all-1 code () until 'classified'] Major class: Computer (desktop,notebook, PDA, organizers, .... ). Major class: Computer • Minor class: Desktop workstation. Major class: Computer • Minor class: Server-class computer. Major class: Computer • Minor class: Laptop. Major class: Computer • Minor class: Handheld PC/PDA (clam shell). Major class: Computer • Minor class: Palm sized PC/PDA. Major class: Computer • Minor class: Wearable computer (Watch sized). Major class: Computer • Minor class: Tablet. Major class: Phone (cellular, cordless, payphone, modem, ...). Major class: Phone • Minor class: Cellular. Major class: Phone • Minor class: Cordlss. Major class: Phone • Minor class: Smart phone. Major class: Phone • Minor class: Wired modem or voice gateway. Major class: Phone • Minor class: Common ISDN Access. Major class: LAN /Network Access point. Major class: Audio/Video (headset,speaker,stereo, video display, vcr..... Major class: Peripheral (mouse, joystick, keyboards, ..... ). Major class: Imaging (printing, scanner, camera, display, ...). Major class: Wearable. Major class: Toy. Major class: Medical. Uncategorized, specific device code not specified — see Provides data for the event. Initialise a new instance. - The result, may be empty but not null. Any user state object. Initialise a new instance. - The resultant error. Any user state object. Gets the list of discovered Bluetooth devices. Specifies the current status of the Bluetooth hardware. Status cannot be determined. XXXX “The stack is not present.” CE5 Bluetooth radio not present. “The adapter is not present.” CE5 Bluetooth radio is in the process of starting up. “The adapter might be installed. The stack is currently on the way up. Call again later.” CE5 Bluetooth radio is active. “The adapter is installed and the stack is running.” CE5 Bluetooth radio is in the process of shutting down. “The adapter is installed, but the stack is not running.” CE5 Bluetooth radio is in an error state. “The adapter might be installed. The stack is on the way down. Call again later.” CE5 HCI_Version — Assigned Numbers — Host Controller Interface Bluetooth Core Specification 1.0b Bluetooth Core Specification 1.1 Bluetooth Core Specification 1.2 Bluetooth Core Specification 2.0 + EDR Bluetooth Core Specification 2.1 + EDR Bluetooth Core Specification 3.0 + HS Bluetooth Core Specification 4.0 Unknown version ℄ probably the stack API does not provide the value. LMP VerNr — Assigned Numbers — Link Manager Protocol Bluetooth Core Specification 1.0b Bluetooth Core Specification 1.1 Bluetooth Core Specification 1.2 Bluetooth Core Specification 2.0 + EDR Bluetooth Core Specification 2.1 + EDR Bluetooth Core Specification 3.0 + HS Bluetooth Core Specification 4.0 Unknown version ℄ probably the stack API does not provide the value. Flags to describe Link Policy. Disables all LAN Manager (LM) modes. Enables the master slave switch. Enables Hold mode. Enables Sniff Mode. Enables Park Mode. Created from v2.1 specification. There are no supported features. [0] [8] [16] [25] [32] [33] [35] [36] [37] v4.0 [38] v4.0 [39] [40] [41] v2.1 [42] v2.1 [48] v2.1 [49] [51] v2.1 [52] v2.1 [53] v2.1 [54] v2.1 [56] v2.1 [57] v2.1 (Changed name from 'InquiryResponseTxPowerLevel' in v2.1 to 'InquiryTxPowerLevel' in v3.0). [58] v3.0 [63] Present since v2.0 at least. Manufacturer codes. Defined in Bluetooth Specifications . Determine all the possible modes of operation of the Bluetooth radio. - See BluetoothRadio.Mode for what is supported on what platforms. For instance setting the mode is not supported on Widcomm+Win32. On Widcomm WM/CE setting PowerOff actually sets 'CONNECT_ALLOW_NONE', and not actually disabled/off. Also when the stack is disabled, setting connectable/discoverable does not manage to turn the radio on. - BluetoothRadio.Mode Bluetooth is disabled on the device. Bluetooth is connectable but your device cannot be discovered by other devices. Bluetooth is activated and fully discoverable. Determine the status of the radio, whether the radio is individually powered-up/down, connectable, and/or discoverable. Unknown. Remote devices can discover the radio. - If the radio is it is undefined how and are reported. Different stacks behave differently. Remote devices can connect to the radio. - If the radio is it is undefined how and are reported. Different stacks behave differently. The radio is powered-down and thus cannot connect to remote devices. - Not all stacks report whether the radio is powered-up or down. Thus there are cases where neither and will be set. Similarly not all stacks allow the program to control powering down the radio. If the radio is it is undefined whether and are reported. Different stacks behave differently. - The radio is powered-up and thus can connect to remote devices. - Not all stacks report whether the radio is powered-up or down. Thus there are cases where neither and will be set. Similarly not all stacks allow the program to control powering down the radio. - Stores the LMP etc versions. Initialises a new instance. - The LMP Version. The LMP Subversion as a . The LMP Supported Features. The Manufacturer. Get the LMP Subversion value. Get the LMP Version. Get the LMP Subversion. - This is of CLR type for CLS compliance. The Bluetooth value is of course of type . Get the LMP Supported Features. Get the Manufacturer. Class of Service flags as assigned in the Bluetooth specifications. - Is returned by the property ClassOfDevice.Service. Defined in Bluetooth Specifications . No service class bits set. A Service Attribute Id identifies each attribute within an SDP service record. - The content of the record for a particular service class is defined in the profile’s specification along with the IDs it uses. The IDs for the common standard services have beed defined here, as e.g. , , etc, see namespace . The Service Discovery profile itself defines IDs, some that can be used in any record , and others , and . Note that except for the attributes in the “Universal” category the IDs are not unique, for instance the ID is 0x0200 for both and from and respectively. Retrieves the name of the SDP Attribute ID with the given value in the specified Attribute ID class sets. Implementing -like behaviour. Retrieves the name of the SDP Attribute ID with the given value in the specified Attribute ID class sets. - Each particular service (ObexPushProfile, SerialPortProfile) etc defines its own SDP record content and the Attribute IDs are defined locally in each, and thus with values overlapping with other service specifications. Therefore for each profile we must define the set of Attribute IDs used, this is done by creating a class for each with the IDs defined as const member fields. - The Attribute Id as an The set of classes defining Attribute IDs for the service classed contained in the record containing this attribute id. - A string containing the name of the Attribute ID whose numerical value is , or a null reference (Nothing in Visual Basic) if no such constant is found. Retrieves the name of the SDP Attribute ID with the given value and using one of the languages from the supplied LanguageBaseItem in the specified AttributeID class sets. - Each particular service (ObexPushProfile, SerialPortProfile) etc defines its own SDP record content and the Attribute IDs are defined locally in each, and thus with values overlapping with other service specifications. Therefore for each profile we must define the set of Attribute IDs used, this is done by creating a class for each with the IDs defined as const member fields. - The Attribute Id as an The set of classes defining Attribute IDs for the service classed contained in the record containing this attribute id. The list of applying to the current record. They are used when an attribute is marked as a multi-language one and thus need the base offset removed from the specified numerical value. The applicable if the matched attribute is a multi-language one. ( in Visual Basic), if no attribute was matched or it was not a multi-language one. - A string containing the name of the Attribute ID whose numerical value is , or a null reference (Nothing in Visual Basic) if no such constant is found. Retrieves the name of the SDP Attribute ID with the given value and using one of the languages from the supplied LanguageBaseItem in the specified AttributeID class sets Indicates that the field to which it is applied represents an SDP Attribute that can exist in multiple language instances and thus has a language base offset applied to its numerical ID when added to a record. Initializes a new instance of the class. Configures what type of element will be added by the for the attribute. - Used with the property. No PDL attribute will be added. A standard L2CAP element will be added. A standard RFCOMM element will be added. A standard GOEP (OBEX) element will be added. Represents the type of the element in the SDP record binary format, and is stored as the higher 5 bits of the header byte. There is an identifier for each major type: String vs UUID vs unsigned integer. There are various sizes of UUID and integer type for instance, the resultant types are listed in enum . Represents the size of the SDP element in the record binary format, and is stored as the lower 3 bits of the header byte. Represents the types that an SDP element can hold. (Is a logical combination of the field which defines the major type and the size field in the binary format; and the size field being made up of the field and any additional length bytes. Note, the values here are not the numerical bitwise combination of the and fields as they appear in the encoded protocol. It was simpler to assign arbitrary values here as firstly we wanted zero to be the 'Unknown' value, which conflicts with Nil's bitwise value; but also because the TextString, sequence and Url types can have various SizeIndex values and thus they wouldn’t be easily representable by one value here). Represents a member of the SDP , Attribute which provides for multi-language strings in a record. “The attribute is a list in which each member contains a language identifier, a character encoding identifier, and a base attribute ID for each of the natural languages used in the service record.” The primary language is specified to have base attribute ID 0x0100. The Id for the UTF-8 encoding. Initialize a new instance of the class. - The Natural Language field of the entry. Some example values are 0x656E which is "en", and 0x6672 which is "fr". The IETF Charset identifier for this language. e.g. 3 for US-ASCII and 106 for UTF-8, see The base Attribute Id for this language in the record. e.g. 0x100 for the Primary language. Initialize a new instance of the class. - The Natural Language field of the entry. Some example values are 0x656E which is "en", and 0x6672 which is "fr". The IETF Charset identifier for this language. e.g. 3 for US-ASCII and 106 for UTF-8, see The base Attribute Id for this language in the record. e.g. 0x100 for the Primary language. Initialize a new instance of the class. - Initialize a new instance of the class. - The Natural Language field of the entry. Some example values are 0x656E which is "en", and 0x6672 which is "fr". The IETF Charset identifier for this language. e.g. 3 for US-ASCII and 106 for UTF-8, see The base Attribute Id for this language in the record. e.g. 0x100 for the Primary language. Initialize a new instance of the class. - The Natural Language field of the entry. Some example values are 0x656E which is "en", and 0x6672 which is "fr". The IETF Charset identifier for this language. e.g. 3 for US-ASCII and 106 for UTF-8, see The base Attribute Id for this language in the record. e.g. 0x100 for the Primary language. Initialize a new instance of the class. - The Natural Language field of the entry. Some example values are "en", and "fr". The IETF Charset identifier for this language. e.g. 3 for US-ASCII and 106 for UTF-8, see The base Attribute Id for this language in the record. e.g. 0x100 for the Primary language. Initialize a new instance of the class. - The Natural Language field of the entry. Some example values are "en", and "fr". The IETF Charset identifier for this language. e.g. 3 for US-ASCII and 106 for UTF-8, see The base Attribute Id for this language in the record. e.g. 0x100 for the Primary language. Gets the list of items in the service record. - A holding the data from the attribute. - An array of . An array length zero is returned if the service record contains no such attribute. - is not of type . The element sequence contains incorrectly formatted or invalid content, for example it contains the wrong element data types, or doesn't contain the elements in groups of three as required. Create a data element for the attribute from the list of - An array of . - A holding the element, to be added to a generally the . Create a instance for a primary language of English and a string encoding of UTF-8. The instance. Gets the value of the Natural Language field of the entry. Some example value may be "en", and "fr". Gets the value of the Natural Language field of the entry, as a . Some example value may be 0x656e for "en", and 0x6672 for "fr". Gets the value of the Natural Language field of the entry, as a . Some example value may be 0x656e for "en", and 0x6672 for "fr". Gets the base Attribute Id for this language. Get the IETF Charset identifier for this language. - Example values are 3 for US-ASCII and 106 for UTF-8. See the full list at - Get the IETF Charset identifier for this language, as an Int16. - See . - Gets an appropriate for this language base item. - The appropriate for this language base item. - We support the following set of mappings from encoding id to .NET Encoding name. IdEncoding 3us-ascii 4iso-8859-1 5iso-8859-2 6iso-8859-3 7iso-8859-4 8iso-8859-5 9iso-8859-6 10iso-8859-7 11iso-8859-8 12iso-8859-9 13iso-8859-10 106 (0x006a)UTF-8 109iso-8859-13 110iso-8859-14 111iso-8859-15 112iso-8859-16 1013 (0x03f5)unicodeFFFE (UTF-16BE) 1014utf-16 (UTF-16LE) 1015utf-16 (UTF-16, we assume UTF16-LE) 2252 to 2258 (0x08cc to 0x08d2)windows-1252 to Windows-1258 Note that not all platforms support all these Encodings, for instance on my Windows XP SP2 box iso-8859-10/-14/-16 are not supported. On NETCF on Windows Mobile 5 only five of the ISO-8859 encodings are supported. Regardless I've seen no SDP records that use ISO-8859 encodings so this is not a problem, most records actually use UTF-8. - The IETF encoding id for this language base item is currently unknown. If valid, add it to the s_IetfCharsetIdToDotNetEncodingNameTable table, providing a mapping to its Windows code page name. Gets a list of enum-like classes containing SDP Service Attribute Id definitions for a particular Service Class. - See method . Initializes a new instance of the class. Get a list of enum-like classes containing Service Attribute Id definitions for the type of the Service Class contained in the given Service Record. - A whose element will be retrieved, and its Service Class Id will used for the lookup. - An array of each of which is a enum-like class which defines the set of Service Attribute IDs used by a particular Service Class e.g. ObjectPushProfile. An empty array will be returned if none of the Service Classes are known, or the record contains no attribute, or it is invalid. Currently only the first Service Class Id is looked-up. - is null. Get the enum-like class containing the Service Attribute Id definitions for the type of the Service Class contained in the given (type ) data element. - A of 'UUID' type containing the Service Class to search for. - A object representing the enum-like class holding the Attribute Id definitions, or null if the Service Class is unknown or the element is not of type. - is null. Get the enum-like class containing the Service Attribute Id definitions for the type of the Service Class specified. - Get the enum-like class containing the Service Attribute Id definitions for the type of the Service Class specified by UUID. - The Service Class to search for, as a . - A object representing the enum-like class holding the Attribute Id definitions, or null if the Service Class is unknown. Holds an attribute from an SDP service record. - Access its SDP Data Element through the property and read the data value through the methods and properties on the returned . Initializes a new instance of the class. - The Attribute Id as a . The value as a . Initializes a new instance of the class. - The Attribute Id as a . The value as a . Get the Attribute Id for this attribute. - Id is a unsigned 32-bit integer but we use return it is a signed 32-bit integer for CLS Compliance reasons. It should not thus be used for ordering etc, for example 0xFFFF will sort before 0x0001 which is backwards. Get the Attribute Id as a number, e.g. for comparison. - Property should be used as an identifier, but not as a number. That#x2019;s because the range is unsigned 32-bit integer but we use return it is a signed 32-bit integer. Thus an example list will sort as { 0xFFFF, 0x8001, 0x0001, 0x0302 } when it should sort as { 0x0001, 0x0302, 0x8001,0xFFFF } Get the value of this attributes as a Holds an SDP data element. - A Service Element hold the data in a SDP Service Record. It can hold various types of data, being like the ‘variant’ type in some environments. Each in a holds its content in a Service Element. The types currently defined in the Service Discovery specification include unsigned and signed integers of various sizes (8-bit, 16-bit etc), UUIDs in the full 128-bit form or in the 16 and 32-bit forms, TextString, Url etc. An element can itself also contain a list of element, either as a ‘sequence’ or an ‘alternative’, and thus an attribute can contain a tree of values, e.g. as used by the attribute. The type that an element is holding can be accessed with the and properties which are of type and respectively, the former being the ‘major’ type e.g. , and the latter the ‘minor’ type e.g. . The element's value can be accessed in various ways, either directly in its internal form through its property. It has return type so the value will have to be cast before use, see the UInt16 example below. There are also a number of type-specific methods, e.g. , , etc. Each will throw an if the element is not of a suitable type. The complete set is: Access method, or .NET Type for direct access Nil Uint8 Uint16 Uint32 Uint64Currently unsupported. Uint128Currently unsupported. Int8 Int16 Int32 Int64Currently unsupported. Int128Currently unsupported. Uuid16Via , or as Uuid32Via , or as Uuid128Via TextStringWith or etc. The underlying value can be an array of bytes, or as a the will set an array of bytes, whereas a manually created record will likely contain a . Boolean ElementSequenceWith or ElementSequence-"- UrlVia , can be stored interally as or as an array of bytes Note that there are no access methods for the numeric type for instance so the property will have to be used e.g. // ElementType is UInt16 ushort x = (ushort)element.Value; or // ElementType is UInt16 Dim x As UShort = CUShort(element.Value); Additional type-specific methods can be added as required, in fact the full set of 19+ could be added, it just requires implementation and test… Initializes a new instance of the class. - Initializes a new instance of the class. - The type of the object passed in the parameter must suit the type of the element. For instance if the element type is then the object passed in must be a , if the element type is then the object must either be a or the string encoded as an array of , and if the element type is then the object passed in must be a , etc. For the full list of types see the class level documentation (). For numerical element types the factory method will accept any integer type and attempt to convert it to the required type before creating the , for example for element type it will accept an parameter and convert it to a internally. - The type of the element as an ElementType. The value for the new element, must suit the type of the element. See the remarks for more information. - ServiceElement e e = new ServiceElement(ElementType.TextString, "Hello world"); e = new ServiceElement(ElementType.TextString, new byte[] { (byte)'h', (byte)'i', }); e = new ServiceElement(ElementType.Uuid16, (UInt16)0x1101); int i = 10; int j = -1; // Error, Int32 not suitable for element type UInt8. ServiceElement e0 = new ServiceElement(ElementType.UInt8, i); // Success, Byte value 10 stored. ServiceElement e1 = ServiceElement.CreateNumericalServiceElement(ElementType.UInt8, i); // Error, -1 not in range of type Byte. ServiceElement e2 = ServiceElement.CreateNumericalServiceElement(ElementType.UInt8, j); Initializes a new instance of the class. - The type of the element as an ElementType. Should be either ElementSequence/ElementAlternative types. A list of elements. Initializes a new instance of the class. - The type of the element as an ElementType. Should be either ElementSequence/ElementAlternative types. A list of elements. Obsolete, use instead. Initializes a new instance of the class. Create an instance of but internally converting the numeric value to the required type. - As noted in the constructor documentation () the type of the value supplied must exactly match the element's natural type, the contructor will return an error if that is not the case. This method will instead attempt to convert the value to the required type. It uses the interface to do the conversion, for instance if the element type is Uint16 then it will cast the input value to and call on it. If the value is not convertible to the element type then an will be thrown see below. For instance, passing in an C# int / Visual Basic Integer to the constructor will fail for element types etc, however by using this method it will succeed if the value is in the correct range. For example int i = 10; int j = -1; // Error, Int32 not suitable for element type UInt8. ServiceElement e0 = new ServiceElement(ElementType.UInt8, i); // Success, Byte value 10 stored. ServiceElement e1 = ServiceElement.CreateNumericalServiceElement(ElementType.UInt8, i); // Error, -1 not in range of type Byte. ServiceElement e2 = ServiceElement.CreateNumericalServiceElement(ElementType.UInt8, j); The last example failing with: System.ArgumentOutOfRangeException: Value '-1' of type 'System.Int32' not valid for element type UInt16. ---> System.OverflowException: Value was either too large or too small for a UInt16. at System.Convert.ToUInt16(Int32 value) at System.Int32.System.IConvertible.ToUInt16(IFormatProvider provider) at InTheHand.Net.Bluetooth.ServiceElement.ConvertNumericalValue(ElementType elementType, Object value) --- End of inner exception stack trace --- at InTheHand.Net.Bluetooth.ServiceElement.ConvertNumericalValue(ElementType elementType, Object value) at InTheHand.Net.Bluetooth.ServiceElement.CreateNumericalServiceElement(ElementType elementType, Object value) at MiscFeatureTestCs.Main(String[] args) - The type of the element as an ElementType. Should be one of the UnsignedInteger/TwosComplementInteger types. The value for the new element, should be a numerical type. - The new element. - The is not a numerical type. The value wasn’t convertible to the required type, e.g. if -1 is passed for element type UInt8, as shown above. Gets the type of the element as an . Gets the SDP Element Type Descriptor of the element as an . Gets the value of the element as the .NET type it is stored as. In most cases the type-specific property should be used instead, e.g , , , etc. Gets the value as a list of . - The list of elements as an list. - The service element is not of type ElementType. or . Gets the value as a array of . - The list of elements as an array. - The service element is not of type ElementType. or . Gets the value as a . - The Url value as a . - It turns out that we can't trust vendors to add only valid URLs to their records, for instance the iPhone has an attribute with value "www.apple.com" which isn't a URL as it has no scheme part (http://) etc. Thus a Url value in an element can be stored in a number of formats. If created by the parser then it will be stored as a or as an array of if property ServiceRecordParser.LazyUrlCreation is set. If created locally it can be those types or also . This method will try to convert from those formats to . If the URL is invalid e.g. has bad characters or is missing the scheme part etc then an error will occur. One can instead access the element's property and expect one of the three types. When created by the parser it will be of type unless is set. - The service element is not of type ElementType.. Gets the value as a . - The UUID value as a . - The service element is not of type ElementType.. Get the value of the , where it is encoded using the given encoding form. - The object to be used to decode the string value if it has been read as a raw byte array. - A holding the value of the from the service element. - The service element is not of type . Get the value of the , when it is encoded as specified by the given IETF Charset identifer. - Note that a strict decoding of the string is carried out (except on the NETCF where it is not supported). Thus if the value is not in the specified encoding, or has been encoded incorrectly, then an error will occur. - A holding the value of the from the service element. - The service element is not of type . If the value in the service element is not a valid string in the given encoding. Get the value of the , when it is encoded as UTF-8. - Note: a strict decoding is used. Thus if the value is not in UTF-8 encoding or has been encoded incorrectly an error will occur. - A holding the value of the from the service element. - If the value in the service element is not a valid string in the given encoding. On NETCF, an is thrown; not that is the base class of the exception. The service element is not of type . Holds an SDP service record. - A Service Record is the top-level container in the Service Discovery protocol/database. It contains a list of Service Attributes each identified by a numerical identifier (its ), and with its data held in a . has methods to access the various types of data it contains. The content of the record for a particular service class is defined in the profile’s specification along with the IDs it uses. The IDs for the common standard services have beed defined here, as e.g. , , etc. The Service Discovery profile itself defines IDs, some that can be used in any record , and others , and . Note that except for the attributes in the “Universal” category the IDs are not unique, for instance the ID is 0x0200 for both and from and respectively. provides the normal collection-type methods properties e.g. , , , and . So, to access a particular attribute’s content get the using one of those methods and then read the data from the . See the example below.   The SDP specification defines the content of TextString element type very loosely and they are thus very difficult to handle when reading from a record. The encoding of the string content is not set in the specification, and thus implementors are free to use any encoding they fancy, for instance ASCII, UTF-8, UTF-16, Windows-1252, etc — all of which have been seen in record from real devices. It would have been much more sensible to mandate UTF-8 as the other part of the Bluetooth protocol suite do e.g. the PIN is always stored as a UTF-8 encoded string. Not only that but some of the attributes defined in the SDP specification can be included in more than one ‘natural language’ version, and the definition of the language and the string’s encoding is not included in the element, but is instead defined in a separate element and the ID of the string attribute modified. Yikes! This makes it near impossible to decode the bytes in a string element at parse time and create the string object then. Therefore the parser creates an element containing the raw bytes from the string which hopefully the user will know how to decode, passing the required encoding information to one of methods on the element i.e. , which takes a multi-language-base item from the same record (see e.g. ), which takes a .NET object, or , or on the record which again takes a multi-language-base item.   A Service Record can be created from the source byte array by using the method or the on . A record can also be created from a list of passed to the constructor .   From the SDP specification: 2.2 ServiceRecord “… a list of service attributes.” 2.3 ServiceAttribute“… two components: an attribute id and an attribute value.” 2.4 Attribute ID“… a 16-bit unsigned integer”, “…represented as a data element.” 2.5 Attribute Value“… a variable length field whose meaning is determined by the attribute ID…”, “…represented by a data element.” 3.1 Data Element“… a typed data representation. It consists of two fields: a header field and a data field. The header field, in turn, is composed of two parts: a type descriptor and a size descriptor. ” 3.2 Data Element Type Descriptor “… a 5-bit type descriptor.” 3.3 Data Element Size Descriptor “… The data element size descriptor is represented as a 3-bit size index followed by 0, 8, 16, or 32 bits.” - ServiceRecord record = ... ServiceAttribute attr = record.GetAttributeById(UniversalAttributeId.ServiceRecordHandle); ServiceElement element = attr.Value; if(element.ElementType != ElementType.UInt32) { throw new FooException("Invalid record content for ServiceRecordHandle"); } UInt32 handle = (UInt32)element.Value; or Dim bppRecord As ServiceRecord = ... Dim attr As ServiceAttribute = bppRecord.GetAttributeById(BasicPrintingProfileAttributeId.PrinterName) Dim element As ServiceElement = attr.Value; ' Spec say it is in UTF-8 Dim printerName As String = element.GetValueAsStringUtf8() Initializes a new instance of the class containing no s. Initializes a new instance of the class. ---- Initializes a new instance of the class with the specified set of s. - The list of to add to the record, as an of . Initializes a new instance of the class with the specified set of s. - The list of to add to the record, as an array of . Create a by parsing the given array of . - This uses the with its default settings. See for more information. In particular for the errors that can result, two of which are listed here. - A byte array containing the encoded Service Record. - The new parsed from the byte array. - The record contains invalid content. The record contains an element type not supported by the parser. - Gets the count of attributes in the record. Gets the attribute at the specified index. - The zero-based index of the attribute to get. - A holding the attribute at the specified index. - index is less than 0. -or- index is equal to or greater than Count. Gets the attribute at the specified index. - The zero-based index of the attribute to get. - A holding the attribute at the specified index. Is never . - index is less than 0. -or- index is equal to or greater than Count. Determines whether a service attribute with the specified ID, and optional natural language, is in the List. - Determines whether a service attribute with the specified ID is in the List. - The id of the service attribute to locate, as a . - true if item is found in the record; otherwise, false. Returns the attribute with the given ID. - Returns the attribute with the given ID. - The Attribute Id as a . - A holding the attribute with the specified ID. Is never . - There is no attribute with the given Id in the record. Throws in NETCFv1 Get a list of the numerical IDs of the Attributes in the record as an of . - This method will likely be only rarely used: instead one would generally want either to read a specific attribute using , or read every attribute by using 's IEnumerable ability e.g. For Each curAttr As ServiceAttribute In record If curAttr.Id = UniversalAttributeId.ProtocolDescriptorList Then ... Next Note, for NETCFv1 this returns an instance of the non-Generic list . - (Provide a pure example since NDocs makes big mess of displaying Generic types). In C#: IList<ServiceAttributeId> ids = record.GetAttributeIds(); In VB.NET: Dim ids As IList(Of ServiceAttributeId) = record.GetAttributeIds() Or without Generics in .NET 1.1 (NETCFv1) in VB.NET: Dim ids As IList = record.GetAttributeIds() Determines whether a TextString service attribute with the specified ID and natural language is in the List. - The id of the service attribute to locate, as a . Which multi-language version of the string attribute to locate. - true if item is found in the record; otherwise, false. Returns the attribute with the given ID and natural language. - The id of the service attribute to locate, as a . Which multi-language version of the string attribute to locate. - A holding the attribute with the specified ID and language. Is never . - There is no attribute with the given Id with the given language base in the record. Create the attribute id resulting for adding the language base attribute id. - The result . - added to the would create an id that cannot be represented as an Attribute Id. Gets a containing the value of the service attribute with the specified ID, using the specified natural language. - As noted in the documentation on this class, string are defined in an odd manner, and the multi-language strings defined in the base SDP specification are defined in a very very odd manner. The natural language and the string’s encoding are not included in the element, but instead are defined in a separate element, and the ID of the string attribute is modified. This pair is present for each natural language. This method is provided to simplify accessing those strings, given the Language attribute it should use it to find and decode the string. If the primary Language attribute is to be used, then use the method that takes only the id parameter. - The id of the service attribute to locate, as a . Which multi-language version of the string attribute to locate. - There is no attribute with the given Id in the record. Throws in NETCFv1 The service element is not of type . If the value in the service element is not a valid string in the encoding specified in the given . - C#: LanguageBaseItem primaryLang = record.GetPrimaryLanguageBaseItem(); if (primaryLang == null) { Console.WriteLine("Primary multi-language not present, would have to guess the string's encoding."); return; } try { String sn = record.GetMultiLanguageStringAttributeById(UniversalAttributeId.ServiceName, primaryLang); Console.WriteLine("ServiceName: " + sn); } catch (KeyNotFoundException) { Console.WriteLine("The record has no ServiceName Attribute."); } Gets a containing the value of the service attribute with the specified ID, using the primary natural language. - As noted in the documentation on this class, string are defined in an odd manner, and the multi-language strings defined in the base SDP specification are defined in a very very odd manner. The natural language and the string’s encoding are not included in the element, but instead are defined in a separate element, and the ID of the string attribute is modified. This pair is present for each natural language. This method is provided to simplify accessing those strings, it will find the primary Language attribute and use it to find and decode the string. And if there is no primary Language attribute, which is the case in many of the records one sees on mobile phones, it will attempt the operation assuming the string is encoded in UTF-8 (or ASCII). - The id of the service attribute to locate, as a . - There is no attribute with the given Id in the record. Throws in NETCFv1 The service element is not of type . If the value in the service element is not a valid string in the encoding specified in the given . - C#: try { String sn = record.GetMultiLanguageStringAttributeById(UniversalAttributeId.ServiceName); Console.WriteLine("ServiceName: " + sn); } catch (KeyNotFoundException) { Console.WriteLine("The record has no ServiceName Attribute."); } Gets the list of LanguageBaseAttributeId items in the service record. - See also . - An array of . An array of length zero is returned if the service record contains no such attribute. - Gets the primary LanguageBaseAttributeId item in the service record. - For instance, can be used with methods , and etc. See example code in the first. - A , or null if the service record contains no such attribute, or no primary language item (one with Base Id 0x0100) is included. - Gets an enumerator that can be used to navigate through the record's list of s. - An of type . - In C#: foreach (ServiceAttribute curAttr in record) { if (curAttr.Id == UniversalAttributeId.ProtocolDescriptorList) { ... } In Visual Basic: For Each curAttr As ServiceAttribute In record If curAttr.Id = UniversalAttributeId.ProtocolDescriptorList Then ... Next Gets an enumerator that can be used to navigate through the record's list of s. Get the raw byte array from which the record was parsed. - A can be created either by manually building new s holding new s, or it can be created by parsing an array of bytes read from another machine by e.g. . In that case this method returns that source byte array. To creates a Service Record byte array from the contained s use or . - An array of , or if the record was not created by parsing a raw record. - Return the byte array representing the service record. - The byte array content is created dynamically from the instance using the class. - The result as an array of . - Provides a simple way to build a , including ServiceClassIds and ServiceNames attributes etc. - The service’s Class Id can be set with the //etc methods, the protocol stack set with the property (default RFCOMM), and the Service Name set with the property. Other properties and methods exist for controlling the more advanced attributes. Adding the standard text-string attributes (ServiceName etc) is normally quite difficult due to the very baroque manner of specifying these strings’ character encoding and natural language. The builder handles all the complexity internally; the strings are written in UTF-8 encoding and marked as 'English' language. - ServiceRecordBuilder bldr = new ServiceRecordBuilder(); bldr.AddServiceClass(BluetoothService.SerialPort); bldr.ServiceName = "Alan's SPP service"; // ServiceRecord rcd = bldr.ServiceRecord; ServiceRecordBuilder bldr = new ServiceRecordBuilder(); bldr.ProtocolType = BluetoothProtocolDescriptorType.GeneralObex; bldr.AddServiceClass(BluetoothService.ObexFileTransfer); bldr.ServiceName = "Alan's FTP service"; // ServiceRecord rcd = bldr.ServiceRecord; Create a new instance of the class. Gets the instance constructed by the specified instance. - A that contains the URI constructed by the . - The created by the properties is invalid. For instance, if duplicates attributes are disallowed but duplicates are present. The list to check for duplicates. true if checking a previously stored list of attributes, and false if checking a immediate addition of an attribute. Thus throws InvalidOperationException and ArgumentException respectively. Get or set a value for the attribute. - When present, a corresponding attribute will be added too. Get or set a value for the attribute. - When present, a corresponding attribute will be added too. Get or set a value for the attribute. - When present, a corresponding attribute will be added too. Get or set which type of element will be added for the attribute. - An instance of the enumeration. - Supported type are the following: None No PDL attribute will be added. Rfcomm A standard RFCOMM element will be added. Goep A standard GOEP (OBEX) element will be added. L2Cap A standard L2CAP element will be added. The default is . Add a Service Class Id. - Multiple class ids can be added, and they will be written to the attribute in the order in which they were set. - A containing a UUID for the advertised service. Add a Service Class Id. - Multiple class ids can be added, and they will be written to the attribute in the order in which they were set. - A containing a short-form UUID for the advertised service. Add a Service Class Id. - Multiple class ids can be added, and they will be written to the attribute in the order in which they were set. - A containing a short-form UUID for the advertised service. Add a Service Class Id. - Multiple class ids can be added, and they will be written to the attribute in the order in which they were set. - A containing a short-form UUID for the advertised service. Add a element. - The Service Class Id of the Bluetooth profile, as a The major version number, as a . The minor version number, as a . Add a set of custom attribute. - A set of attributes as an returning instances. Add a set of custom attribute. - A set of attributes as an returning instances. Add a set of custom attribute. - A set of attributes as an array of . Add a custom attribute. - Add a custom attribute from a given - An attribute as a instance. Add a custom attribute of simple type. - If the is a numerical type then this is equivalent to using otherwise the value is used directly in creating the . - The Attribute Id as a . The type of the element as an . The value for the new element. Add a custom attribute of simple type. - If the is a numerical type then this is equivalent to using otherwise the value is used directly in creating the . - The Attribute Id as a . The type of the element as an . The value for the new element. Converts a Java JSR 82 Bluetooth server URL into a instance. - The authenticate and encrypt and any related parameters are completely disregarded. When using with you must take care to set the required security requirements on it directly. This method is intended to read the Service Record (SDP) related items only; in particular the Service Class ID UUID and Service Name parameters. It supports only the btspp and btObex schemes and only for server-side use only. For instance btspp://localhost:3B9FA89520078C303355AAA694238F08;name=FooBar and btgoep://localhost:3B9FA89520078C303355AAA694238F08 There is no suppport for e.g. btl2cap://localhost:3B9FA89520078C303355AAA694238F08;name=Aserv as the library supports only RFCOMM connections currently. - A server-side JSR 82 URL in one of the supported forms. - A initialised with the supported components of the supplied JSR 82 URL. Creates a Service Record byte array from the given object. Creates a Service Record byte array from the given object. - Creates a Service Record byte array from the given object, into the specified byte array. - See the other overload - An instance of containing the record to be created. An array of for the record to be written to. - The record bytes are longer that the supplied byte array buffer. - The length of the record in the array of . Creates a Service Record byte array from the given object. - The only oddity (as with parsing) is with the TextString type. The can either hold the string already encoded to its array of bytes or an . In the latter case we will always simply encode the string to an array of bytes using encoding . Currently any UUIDs in the record are written out in the form supplied, we should probably write a ‘short-form’ equivalent if its a ‘Bluetooth-based’ UUID e.g. Uuid128 as Uuid16. - An instance of containing the record to be created. - An array of containing the resultant record bytes. The length of the array is the length of the record bytes. Create the element in the buffer starting at offset, and return its totalLength. The element to create. The byte array to write the encoded element to. The place to start writing in . The total length of the encoded element written to the buffer Some useful methods for working with a SDP including creating and accessing the for an RFCOMM service. Reads the RFCOMM Channel Number element from the service record. - The to search for the element. - The holding the Channel Number. or if at the attribute is missing or contains invalid elements. Reads the L2CAP Channel Number element from the service record. - The to search for the element. - The holding the Channel Number. or if at the attribute is missing or contains invalid elements. Reads the RFCOMM Channel Number value from the service record, or returns -1 if the element is not present. - The to search for the element. - The Channel Number as an unsigned byte cast to an Int32, or -1 if at the attribute is missing or contains invalid elements. Reads the L2CAP Channel Number value from the service record, or returns -1 if the element is not present. - The to search for the element. - The PSM number as an uint16 cast to an Int32, or -1 if at the attribute is missing or contains invalid elements. Sets the RFCOMM Channel Number value in the service record. - The in which to set the RFCOMM Channel number. The Channel number to set in the record. - The attribute is missing or contains invalid elements. Sets the RFCOMM Channel Number value in the service record. - Note: We use an for the parameter as its natural type in not usable in CLS Compliant interfaces. - The in which to set the L2CAP PSM value. The PSM value to set in the record. Note that although the parameter is of type the value must actually be in the range of a , see the remarks for more information. - The attribute is missing or contains invalid elements. The PSM must fit in a 16-bit unsigned integer. Creates the data element for the attribute in an L2CAP service - The new . - Thus is the following structure: ElementSequence ElementSequence Uuid16 = L2CAP UInt16 = 0 -- The L2CAP PSM Number. Creates the data element for the attribute in an RFCOMM service - The new . - Thus is the following structure: ElementSequence ElementSequence Uuid16 = L2CAP ElementSequence Uuid16 = RFCOMM UInt8 = 0 -- The RFCOMM Channel Number. Creates the data element for the attribute in an GOEP (i.e. OBEX) service - The new . - Thus is the following structure: ElementSequence ElementSequence Uuid16 = L2CAP ElementSequence Uuid16 = RFCOMM UInt8 = 0 -- The RFCOMM Channel Number. ElementSequence Uuid16 = GOEP Creates the data element for the attribute in an L2CAP service, with upper layer entries. - The new . - Thus is the following structure at the first layer: ElementSequence ElementSequence Uuid16 = L2CAP UInt16 = 0 -- The L2CAP PSM Number. One can add layers above that; remember that all layers are formed of an ElementSequence. See the example below. - var netProtoList = new ServiceElement(ElementType.ElementSequence, ServiceElement.CreateNumericalServiceElement(ElementType.UInt16, 0x0800), ServiceElement.CreateNumericalServiceElement(ElementType.UInt16, 0x0806) ); var layer1 = new ServiceElement(ElementType.ElementSequence, new ServiceElement(ElementType.Uuid16, Uuid16_BnepProto), ServiceElement.CreateNumericalServiceElement(ElementType.UInt16, 0x0100), //v1.0 netProtoList ); ServiceElement element = ServiceRecordHelper.CreateL2CapProtocolDescriptorListWithUpperLayers( layer1); - The list of upper layer elements, one per layer. As an array. Parses an array of bytes into the contained SDP . - See the methods for more information. - Gets or set whether the parser will attempt to skip any unknown element type rather than producing an error. - An element type is added instead with ElementType. and ElementTypeDescriptor.. Gets or sets whether any URL elements will be converted to instances at parse time, or left as raw byte arrays. - This is useful when the URL element is badly formatted and thus the parser will reject the record, setting this property to true will allow the parse to complete without attempting to decode the URL value. When true the value is stored as a array of bytes, when false it is stored as a ; however in earlier versions it was stored as , and since there was often invalid content on devices (e.g. iPhone) this often failed. Parses an array of bytes into its contained . - See for more information. - A byte array containing the encoded Service Record. The new parsed from the byte array. - Parses an array of bytes into its contained . - If the record contains any element type not supported by the parser it will throw . The only element types defined by SDP in v2.0 that are not currently implemented are 64- and 128-bit integers. Of course any types defined in a later version will also throw this. This behaviour can be changed with the property. - A byte array containing a Service Record. The position in the data buffer at which to begin parsing the Service Record. The length of the Service Record in the byte array. The Service Record parse from the byte array. - The record contains invalid content. The record contains an element type not supported by the parser. - Split a sequence of records into the component records. - The Bluetooth SDP operation ServiceSearchAttribute returns its result as a “data element sequence where each element in turn is a data element sequence representing an attribute list.” This method split that sequence into the individual attribute lists. On CE/Windows Mobile the result of a record lookup is in this form so etc use this method to split the result into is constituent records. - A byte array holding the “data element sequence where each element in turn is a data element sequence representing an attribute list.” - An array of byte arrays where each holds a SDP record (a “data element sequence representing an attribute list.”). If the input was zero length or empty then a zero length array is returned. - is . For use when the content of the element is in an array i.e. the stack parses the element structure and returns the values in byte arrays. - Whether the stack uses network order for UnsignedInteger and TwosComplementInteger elements (as used in the SDP format) or instead that the numerical values are in host order in the byte array. Whether the stack uses network order for Uuid elements (as used in the SDP format) or instead that the numerical values are in host order in the byte array. The byte array containing the SDP value. (?Always zero). The length of the byte array. (Always equals ). The Element Type. (Not used). The size of the value. (?Always zero). - Split a header byte into its and parts. The returned is not checked to be a known value. - The byte from the header. The value from the header byte. The value from a header byte. - Extract the value from a header byte. The returned is not checked to be a known value. - The byte from the header. - The value as a . - Extract the field from a header byte. - The byte from the header. - The value as a . - Bit offset of the ElementTypeDescriptor field in a header byte. The header byte has two parts: five bits of ElementTypeDescriptor and three bits of Size Index. Mask for the SizeIndex field in a header byte. The header byte has two parts: five bits of ElementTypeDescriptor and three bits of Size Index, upper and lower respectively. Utilities method working on SDP s, for instance to produce a 'dump' of the record's contents. - This class produces output like the following: AttrId: 0x0000 -- ServiceRecordHandle UInt32: 0x0 AttrId: 0x0001 -- ServiceClassIdList ElementSequence Uuid16: 0x1000 -- ServiceDiscoveryServer AttrId: 0x0004 -- ProtocolDescriptorList ElementSequence ElementSequence Uuid16: 0x100 -- L2CapProtocol UInt16: 0x1 ElementSequence Uuid16: 0x1 -- SdpProtocol ( ( L2Cap, PSM=Sdp ), ( Sdp ) ) AttrId: 0x0005 -- BrowseGroupList ElementSequence Uuid16: 0x1002 -- PublicBrowseGroup AttrId: 0x0006 -- LanguageBaseAttributeIdList ElementSequence UInt16: 0x656E UInt16: 0x6A UInt16: 0x100 AttrId: 0x0100 -- ServiceName TextString: [en] 'Service Discovery' AttrId: 0x0101 -- ServiceDescription TextString: [en] 'Publishes services to remote devices' AttrId: 0x0102 -- ProviderName TextString: [en] 'Microsoft' AttrId: 0x0200 -- VersionNumberList ElementSequence UInt16: 0x100 AttrId: 0x0201 -- ServiceDatabaseState UInt32: 0x1 The Service Class Id names and Attribute Id names are looked up using /etc and respectively. Produces a raw 'dump' of the given record, not including attribute names etc. - Gets a string containing a raw 'dump' of the given record, not including attribute names etc. - A to be dumped. A containing the 'dump' text. Produce a raw 'dump' of the given record, not including attribute names etc, to the given . A where the 'dump' text is to be written. A to be dumped. Produces a 'dump' of the given record, including attribute names etc. -- Gets a containing a 'dump' of the given record, including attribute names etc. - A to be dumped. An optional array of specifing a set of Ids for the attributes contained in this record. See the overload for more information. - A containing the 'dump' text. - Produce a 'dump' of the given record, including attribute names etc to the given . - The system has built-in a set of mappings from Service Class to its Attribute IDs. This is supplied by the class, and contains the Attribute IDs defined in the base SDP specification as well as in Bluetooth Profiles specification e.g. ObjectPushProfile, Headset, Panu, etc. If however the record being decoded is a custom one then a set of extra Attribute Id definitions can be supplied in the parameter. The Attribute IDs for a particular Service Class should be defined in a static class and the set of such classes should be passed as their object. e.g. static class FooAttributeId { public const ServiceAttributeId BarName = (ServiceAttributeId)0x0300; } … ServiceRecordUtilities.Dump(writer, myRecord, typeof(FooAttributeId)); … - A where the 'dump' text is to be written. A to be dumped. An optional array of specifing a set of Ids for the attributes contained in this record. See the Attempt to get the name of the protocol, and optionally it's enum id if we handle it specially. - The input. The protocol's name if known, or its Guid.ToString if not. We handle some explicitly, and otherwise we see if there's a matching value in BluetoothService that has its name suffixed "Protocol". - The id as a . We handle some explicitly, otherwise we see if its a UUID16 and convert it automatically, finally if neither we return zero. Defines additional Bluetooth socket option levels for the and methods. Bluetooth RFComm protocol (bt-rfcomm) Logical Link Control and Adaptation Protocol (bt-l2cap) Service Discovery Protocol (bt-sdp) Defines configuration option names for the class. On connected socket, triggers authentication. On not connected socket, forces authentication on connection. For incoming connection this means that connection is rejected if authentication cannot be performed. The optval and optlen parameters are ignored; however, Winsock implementation on Windows CE requires optlen to be at least 4 and optval to point to at least an integer datum. Toggles authentication under Windows XP. optlen=sizeof(ULONG), optval = &(ULONG)TRUE/FALSE On a connected socket, this command turns encryption on or off. On an unconnected socket, this forces encryption to be on or off on connection. For an incoming connection, this means that the connection is rejected if the encryption cannot be turned on. This sets or revokes PIN code to use with a connection or socket. This sets or revokes link key to use with a connection or peer device. Returns link key associated with peer Bluetooth device. Get or set the default MTU on Windows XP. optlen=sizeof(ULONG), optval = &mtu This sets default MTU (maximum transmission unit) for connection negotiation. While allowed for connected socket, it has no effect if the negotiation has already completed. Setting it on listening socket will propagate the value for all incoming connections. Returns MTU (maximum transmission unit). For connected socket, this is negotiated value, for server (accepting) socket it is MTU proposed for negotiation on connection request. Get or set the maximum MTU on Windows XP. optlen=sizeof(ULONG), optval = &max. mtu This sets maximum MTU for connection negotiation. While allowed for connected socket, it has no effect if the negotiation has already completed. Setting it on listening socket will propagate the value for all incoming connections. Returns maximum MTU acceptable MTU value for a connection on this socket. Because negotiation has already happened, has little meaning for connected socket. Get or set the minimum MTU on Windows XP. optlen=sizeof(ULONG), optval = &min. mtu This sets minimum MTU for connection negotiation. While allowed for connected socket, it has no effect if the negotiation has already completed. Setting it on listening socket will propagate the value for all incoming connections. Returns minimum MTU acceptable MTU value for a connection on this socket. Because negotiation has already happened, has little meaning for connected socket. This sets XON limit. Setting it on listening socket will propagate the value for all incoming connections. Returns XON limit for a connection. XON limit is only used for peers that do not support credit-based flow control (mandatory in the Bluetooth Core Specification version 1.1). When amount of incoming data received, but not read by an application for a given connection grows past this limit, a flow control command is sent to the peer requiring suspension of transmission. This sets XOFF limit. Setting it on listening socket will propagate the value for all incoming connections. Returns XOFF limit for a connection. XOFF limit is only used for peers that do not support credit-based flow control (mandatory in the Bluetooth Core Specification 1.1). If flow has been suspended because of buffer run-up, when amount of incoming data received, but not read by an application for a given connection falls below this limit, a flow control command is sent to the peer allowing continuation of transmission. Specifies maximum amount of data that can be buffered inside RFCOMM (this is amount of data before call to send blocks). Returns maximum amount of data that can be buffered inside RFCOMM (this is amount of data before call to send blocks). Specifies maximum amount of data that can be buffered for a connection. This buffer size is used to compute number of credits granted to peer device when credit-based flow control is implemented. This specifies the maximum amount of data that can be buffered. Returns maximum amount of data that can be buffered for a connection. This buffer size is used to compute number of credits granted to peer device when credit-based flow control is implemented. This specifies the maximum amount of data that can be buffered. Retrieves last v24 and break signals set through MSC command from peer device. Retrieves last line status signals set through RLS command from peer device. Sends MSC command. V24 and breaks are as specified in RFCOMM Specification. Only modem signals and breaks can be controlled, RFCOMM reserved fields such as flow control are ignored and should be set to 0. Sends RLS command. Argument is as specified in RFCOMM Specification. Gets flow control type on the connected socket. Sets the page timeout for the card. The socket does not have to be connected. Gets the current page timeout. The socket does not have to be connected. Sets the scan mode for the card. The socket does not have to be connected. Gets the current scan mode. The socket does not have to be connected. Sets the class of the device. The socket does not have to be connected. Retrieve the Class of Device. Get the version information from the Bluetooth adapter. Get the version of the remote adapter. Retrieves the authentication settings. The socket does not have to be connected. Sets the authentication policy of the device. Reads the remote name of the device. The socket does not have to be connected. Retrieves the link policy of the device. Sets the link policy for an existing baseband connection. The socket must be connected. Places the ACL connection to the specified peer device in HOLD mode. The device must be connected. Places the ACL connection to the specified peer device in SNIFF mode. The device must be connected. Forces the ACL connection to the peer device to leave SNIFF mode. The device must be connected. Places the ACL connection to the peer device in PARK mode. The device must be connected. Forces the ACL connection to the peer device to leave PARK mode. The device must be connected. Gets the current mode of the connection. The mode can either be sniff, park, or hold. The socket must be connected. Describes the character sets supported by the device. The enumeration describes the following character sets, which are used by the and classes. The ASCII character set. The western European graphic character set. The eastern European graphic character set. The southern European graphic character set. The northern European graphic character set. The Cyrillic graphic character set. The Arabic graphic character set. The Greek graphic character set. The Hebrew graphic character set. The Turkish graphic character set. The Unicode character set. Describes an enumeration of possible device types, such as Fax. Unspecified device type. A Plug and Play interface. A Pocket PC or similar. A personal computer. A printer. A modem. A fax. A local area network access. Contains extended hint bytes. A telephonic device. A personal computer file server. Device supports IrCOMM. Device supports Object Exchange. Defines additional IrDA socket option levels for the and methods. Use along with the socket options defined by . The socket option level for use with IrDA sockets along with the options defined in . Use along with the socket options defined by . Socket option constants to set IrDA specific connection modes, and get/set IrDA specific features. Socket option constants to set IrDA specific connection modes, and get/set IrDA specific features: for instance to set IrLMP mode, or get the maximum send size. Pass to /etc and /etc, along with optionLevel IrDASocketOptionLevel.; see the examples below. New in v1.5.51015 For instance, where cli is an instance of . In VB.NET, to set IrLMP mode (IrLptMode). cli.Client.SetSocketOption(IrDASocketOptionLevel.Irlmp, _ IrDASocketOptionName.IrLptMode, _ 1) 'representing true; can use True itself in FXv2. In C#, to retrieve the maximum send size. int maxSendSize = (int)cli.Client.GetSocketOption( IrDASocketOptionLevel.Irlmp, IrDASocketOptionName.SendPduLength); Gets the list of discovered devices. Is used internally by IrDAClient.DiscoverDevices. In native terms takes a DEVICE_LIST struct. Sets an entry in the local IAS (Information Access Service) database. In native terms takes a IAS_SET struct. Queries an entry in the peer's IAS (Information Access Service) database. In native terms takes a IAS_QUERY struct. Retrieve the maximum send size when using IrLMP directly (). IrLMP requires sent data to fit in one frame. Integer Restricts the link to one application-level (IrLMP) connection; for use when low latency is required. Returns an error on all tested platforms. Returns an error on all tested platforms. Boolean Sets IrLMP mode, disabling TinyTP. Used for instance when printing with IrLPT. On Windows NT platforms at least, is ignored on server-side sockets. Boolean Sets IrCOMM 9-Wire/Cooked mode. Used for instance when connecting to the modem in a mobile phone (service name IrDA:IrCOMM). In operation, received IrCOMM control information is discarded and null information is sent. Boolean Reportedly sets non-IrDA Sharp ASK mode on the Windows CE platform. Presence unverified. Specifies additional addressing schemes that an instance of the class can use. Bluetooth address. 32 IrDA address used on some Windows CE platforms (Has a different value to AddressFamily.IrDA). 22 Provides client connections for Bluetooth RFCOMM network services. This class currently only supports devices which use the Microsoft and Widcomm Bluetooth stacks, devices which use the other stacks will not work. When connecting normally an endpoint with an Address and a Service Class Id is specified, then the system will automatically lookup the SDP record on the remote device for that service class and connect to the port number (RFCOMM Channel Number) specified there. If instead a port value is provided in the endpoint then the SDP lookup will be skipped and the system will connect to the specified port directly. Note: Do not attempt to connect with service BluetoothService.RFCommProtocol this class always uses RFCOMM, instead the Service Class Id of the particular service to which you want to connect must be specified, perhaps BluetoothService.SerialPort, BluetoothService.ObexObjectPush, or the unique UUID/ that you are using in your custom server application. Creates a new instance of . Initializes a new instance of the class and binds it to the specified local endpoint. The to which you bind the Bluetooth Socket. Only necessary on multi-radio system where you want to select the local radio to use. Get or set the Device Discovery Inquiry Access Code. - This is supported only the Microsoft stack on WindowsMobile/etc. It is not supported on any other platforms. The default value is GIAC (0x9E8B33). See also constant LIAC (0x9E8B00). The valid range is 0x9E8B00 through 0x9E8B3f. - An containing the Access Code to be used for Inquiry. Amount of time allowed to perform the query. On Windows CE the actual value used is expressed in units of 1.28 seconds, so will be the nearest match for the value supplied. The default value is 10 seconds. The maximum is 60 seconds. Discovers accessible Bluetooth devices, both remembered and in-range, and returns their names and addresses. - This is equivalent to calling (255, true, true, true) - An array of BluetoothDeviceInfo objects describing the devices discovered. Discovers accessible Bluetooth devices, both remembered and in-range, and returns their names and addresses. - This is equivalent to calling (maxDevices, true, true, true) - The number of in-range devices to find before the inquiry may be stopped early. The result can contain more than this number of devices. - An array of BluetoothDeviceInfo objects describing the devices discovered. Discovers accessible Bluetooth devices, optionally remembered and in-range, and returns their names and addresses. - The number of in-range devices to find before the inquiry may be stopped early. The result can contain more than this number of devices. True to return previously authenticated/paired devices. True to return remembered devices. True to return previously unknown devices. - An array of BluetoothDeviceInfo objects describing the devices discovered. Discovers accessible Bluetooth devices, optionally remembered and in-range or just in-range, and returns their names and addresses. - The parameter is not supported on the Microsoft stack on WinXP as the stack there returns the remembered and Device-Inquiry-results already merged, it is however supported on Windows 7. It is supported on WM/CE and on Widcomm (both platforms). Note when that flag is set the other related flag values are ignored. To remove devices from the list of remembered/authenticated devices use BluetoothSecurity.RemoveDevice - The number of in-range devices to find before the inquiry may be stopped early. The result can contain more than this number of devices. True to return previously authenticated/paired devices. True to return remembered devices. True to return previously unknown devices. True to return only the devices that are in range, and in discoverable mode. See the remarks section. - An array of BluetoothDeviceInfo objects describing the devices discovered. Discovers Bluetooth devices that are in range and are in ‘discoverable mode’ - This is equivalent to calling (255, false, false, false, true) - An array of BluetoothDeviceInfo objects describing the devices discovered. An asynchronous version of - See . See . See . See . See . An optional asynchronous callback, to be called when the discovery is complete. A user-provided object that distinguishes this particular asynchronous discovery request from other requests. - An that represents the asynchronous discovery, which could still be pending. Ends an asynchronous Service Record lookup query. - An returned by . - See . Gets the amount of data that has been received from the network and is available to be read. The number of bytes of data received from the network and available to be read. The has been closed. Gets or sets the underlying . - The underlying network . - The property is only supported on Microsoft Bluetooth stack platforms. Connects a client to a specified endpoint. - A that represents the server on the remote device. - Normally an endpoint with an Address and a Service Class Id is specified, then the system will automatically lookup the SDP record on the remote device for that service class and connect to the port number (RFCOMM Channel Number) specified there. If instead a port value is provided in the endpoint then the SDP lookup will be skipped and the system will connect to the specified port directly. Note: Do not attempt to connect with service BluetoothService.RFCommProtocol. See the class remarks for more information. Connects the client to a remote Bluetooth host using the specified Bluetooth address and service identifier. - The system will automatically lookup the SDP record on the remote device for that service class and connect to the port number (RFCOMM Channel Number) specified there. Note: Do not attempt to connect with service BluetoothService.RFCommProtocol. See the class remarks for more information. - The of the remote host. The Service Class Id of the service on the remote host. The standard Bluetooth Service Classes are provided on class . Begins an asynchronous request for a remote host connection. The remote host is specified by a and a service identifier (Guid). - See the method for information on the usage of the values in the endpoint. - The of the remote host. The Service Class Id of the service on the remote host. The standard Bluetooth Service Classes are provided on class An delegate that references the method to invoke when the operation is complete. A user-defined object that contains information about the connect operation. This object is passed to the delegate when the operation is complete. - An that represents the asynchronous connect, which could still be pending. Begins an asynchronous request for a remote host connection. The remote server is specified by a . - A that represents the server on the remote device. See the method for information on the usage of the values in the endpoint. An delegate that references the method to invoke when the operation is complete. A user-defined object that contains information about the connect operation. This object is passed to the delegate when the operation is complete. - See the method for information on the usage of the values in the endpoint. - An that represents the asynchronous connect, which could still be pending. Asynchronously accepts an incoming connection attempt. An object returned by a call to / . Gets a value indicating whether the underlying for a is connected to a remote host. true if the socket was connected to a remote resource as of the most recent operation; otherwise, false. Closes the and the underlying connection. - The two XxxxxClient classes produced by Microsoft (TcpClient, and IrDAClient in the NETCF) have had various documented behaviours and various actual behaviours for close/dispose/finalize on the various platforms. :-( The current TcpClient implementation on is that Close/Dispose closes the connection by closing the underlying socket and/or NetworkStream, and finalization doesn't close either. This is the behaviour we use for the here (for , ). (The documentation in MSDN for is still wrong by-the-way, see Microsoft feedback #158480). Gets the underlying stream of data. The underlying . returns a that you can use to send and receive data. The class inherits from the class, which provides a rich collection of methods and properties used to facilitate network communications. You must call the / method first, or the method will throw an . After you have obtained the , call the method to send data to the remote host. Call the method to receive data arriving from the remote host. Both of these methods block until the specified operation is performed. You can avoid blocking on a read operation by checking the property. A true value means that data has arrived from the remote host and is available for reading. In this case, is guaranteed to complete immediately. If the remote host has shutdown its connection, will immediately return with zero bytes. The is not connected to a remote host. The has been closed. Gets or sets a value that specifies whether the client will delay closing in an attempt to send all pending data. - See Socket.LingerState. In Widcomm, linger false (disabled) is not supported. - A that specifies how to linger while closing a socket. Sets whether an authenticated connection is required. Supported mostly on the Microsoft stack (desktop and WM/CE). For disconnected sockets, specifies that authentication is required in order for a connect or accept operation to complete successfully. Setting this option actively initiates authentication during connection establishment, if the two Bluetooth devices were not previously authenticated. The user interface for passkey exchange, if necessary, is provided by the operating system outside the application context. For outgoing connections that require authentication, the connect operation fails (on Win32, with WSAEACCES) if authentication is not successful. In response, the application may prompt the user to authenticate the two Bluetooth devices before connection. For incoming connections, the connection is rejected if authentication cannot be established and fails (on Win32, returning a WSAEHOSTDOWN error). MSDN. Desktop: , WM: Sets whether an encrypted connection is required. - Supported mostly on the Microsoft stack (desktop and WM/CE). On unconnected sockets, enforces encryption to establish a connection. Encryption is only available for authenticated connections. For incoming connections, a connection for which encryption cannot be established is automatically rejected (and on Win32, returns WSAEHOSTDOWN as the error). For outgoing connections, the Connect function fails (on Win32, with WSAEACCES) if encryption cannot be established. In response, the application may prompt the user to authenticate the two Bluetooth devices before connection. For Windows Mobile/CE: On a connected socket, this command will toggle encryption for all sessions sharing the same Baseband connection. You should use it ONLY if you know what you are doing (for example, yours is the only application); otherwise, the link presumed more secure by another application may become unencrypted. MSDN. Desktop: , WM: Returns link key associated with peer Bluetooth device. Returns the Link Policy of the current connection. Sets the PIN associated with the remote device. PIN which must be composed of 1 to 16 ASCII characters. Is not supported on all platforms. For instance see the Widcomm documentation Assigning null (Nothing in VB) or an empty String will revoke the PIN. In version 2.3 could only be called when connected. Set or change the PIN to be used with a specific remote device. Address of Bluetooth device. PIN string consisting of 1 to 16 ASCII characters. Is not supported on all platforms. For instance see the Widcomm documentation Assigning null (Nothing in VB) or an empty String will revoke the PIN. Get the remote endpoint. - The with which the is communicating. - Note it can't be guaranteed that the and parts of the returned endpoint are valid; and this will affect the output. In particular, on MSFT, the for a client connection seems to have no and a garbage , so we would display garbage there in . An in-bound/server connection however does have a valid Port. (There the endpoints are returned from the native socket). On the other hand on Widcomm, Bluetopia and on BlueSoleil the opposite is the case: for a client the Port is known but it isn't for a server, and the is blank in both cases. Gets the name of the remote device. Gets the name of the specified remote device. Address of remote device. Friendly name of specified device. Gets the name of a device by a specified socket. A . Returns a string value of the computer or device name. Closes the and the underlying connection. - Provides information about an available device obtained by the client during device discovery. Initializes an instance of the class for the device with the given address. - The . Forces the system to refresh the device information. - See for one reason why this method is necessary. Updates the device name used to display the device, affects the local computer cache. On Windows CE this only affects devices which are already paired. Gets the device identifier. Gets a name of a device. - Note, that due the way in which Bluetooth device discovery works, the existence and address of a device is known first, but a separate query has to be carried out to find whether the device also has a name. This means that if a device is discovered afresh then this property might return only a text version of the device’s address and not its name, one can also see this in the Windows’ Bluetooth device dialogs where the device appears first with its address and the name is later updated. To see the name, wait for some time and access this property again having called in the meantime. Returns the Class of Device of the remote device. - Some CE 4.2 devices such as original PPC2003 devices don't have the native API on which this property depends — it was added as part of a hotfix. The property will always return zero in such a case. On WM/CE we also attempt to get the CoD value as part of the discovery process; this is of course only works for devices in-range. Returns the signal strength for the Bluetooth connection with the peer device. Supports only on some platforms. - Valid values for this property are -128 to 128. It returns Int32.MinValue on failure. - Thus there are multiple reasons which this property can return the error value (i.e. Int32.MinValue). On an unsupported platform, e.g. MSFT+Win32, or MSFT+CE/WM on an older version. See below. The remote device is not turned-on or in range. See below. On Widcomm, there is no connection to the remote device. See below. Platform support: Does not work on Win32 with the Microsoft Bluetooth stack. That platform provide no support for RSSI, please contact Microsoft to complain. Works on Windows Mobile 5.0, Windows Embedded CE 6.0, or later versions. Works on Widcomm, both platforms. We will not try to connect, see below. Finally, to get an RSSI value Bluetooth requires an open connection to the peer device. On Widcomm we will not attempt to connect, so the caller must ensure that there's a connection -- perhaps it could call just before accessing this property. On CE/WM if there is no active connection, then we will attempt to create one. This of course can be slow, and will be slow if the remote device is not in range. (Bluetooth 2.1 supports getting the RSSI value at discovery time which might provide the solution for many cases. However only the MSFT+Win32 stack specifically supports v2.1, and of course it doesn't support RSSI at all!) Note that the Bluetooth specification doesn't require that the radio hardware provides any great precision in its RSSI readings. The spec says for instance, in v2.1 Volume 2 Part E ("HCI") Section 7.5.4: “Note: how accurate the dB values will be depends on the Bluetooth hardware. The only requirements for the hardware are that the Bluetooth device is able to tell whether the RSSI is inside, above or below the Golden Device Power Range.” Returns a list of services which are already installed for use on the calling machine. This property returns the services already configured for use. Those are the ones that are checked in the “Services” tab of the device’s property sheet in the Bluetooth Control panel. I presume the behaviour is similar on CE. Will only return available services for paired devices. It of course will also only returns standard system services which Windows understands. (On desktop Windows this method calls the OS function BluetoothEnumerateInstalledServices). To see all the services that a device advertises use the method. Enables or disables services for a Bluetooth device. The service GUID on the remote device. Service state - TRUE to enable the service, FALSE to disable it. When called on Windows CE, the device will require a soft-reset to enabled the settings. The system maintains a mapping of service guids to supported drivers for Bluetooth-enabled devices. Enabling a service installs the corresponding device driver. Disabling a service removes the corresponding device driver. If a non-supported service is enabled, a driver will not be installed. This overload is silent on error; the other overload raises an exception if required (). - Thrown if this method is called on Windows CE platforms. Enables or disables services for a Bluetooth device. The service GUID on the remote device. Service state - TRUE to enable the service, FALSE to disable it. Whether the method should raise an exception when When called on Windows CE, the device will require a soft-reset to enabled the settings. The system maintains a mapping of service guids to supported drivers for Bluetooth-enabled devices. Enabling a service installs the corresponding device driver. Disabling a service removes the corresponding device driver. If a non-supported service is enabled, a driver will not be installed. - The call failed. Run an SDP query on the device’s Service Discovery Database. - For instance to see whether the device has an an Serial Port service search for UUID , or too find all the services that use RFCOMM use , or all the services use . If the device isn’t accessible a with 10108 (0x277C) occurs. - The UUID to search for, as a . - The parsed record as an . - Dim bdi As BluetoothDeviceInfo = ... Dim records As ServiceRecord() = bdi.GetServiceRecords(BluetoothService.RFCommProtocol) ' Dump each to console For Each curRecord As ServiceRecord In records ServiceRecordUtilities.Dump(Console.Out, curRecord) Next - The query failed. Begins an asynchronous Service Record lookup query. - See . An optional asynchronous callback, to be called when the query is complete. A user-provided object that distinguishes this particular asynchronous Service Record lookup query from other requests. - An that represents the asynchronous Service Record lookup query, which could still be pending. Ends an asynchronous Service Record lookup query. - An object that was obtained when the asynchronous operation was started. - The parsed record as an . Run an SDP query on the device’s Service Discovery Database, returning the raw byte rather than a parsed record. - If the device isn’t accessible a with 10108 (0x277C) occurs. - The UUID to search for, as a . - An array of array of . - The query failed. Gets the radio version and manufacturer information for the device. Needs a connection to the device. - Includes information such as the LMP versions, supported features and the manufacturer of the radio/Bluetooth Controller. If the device is not connected this information cannot be obtained; an error will occur if there is no connection. The values will be cached until is called. This feature is currently supported only on the Microsoft Bluetooth stack on both desktop Windows and Windows Mobile. However Windows XP does not provide this information. Implementation is possible on some of the other Bluetooth stacks and will depend on demand/support for the user community. - An error occurred, desktop Windows returns error code 1167 ERROR_DEVICE_NOT_CONNECTED and Windows Mobile returns error code 1168 ERROR_NOT_FOUND. Windows XP which does not support this functionality returns error code 2 ERROR_FILE_NOT_FOUND. Not yet implemented. This stack does not support getting this information. - The radio version etc information as a instance. Specifies whether the device is connected. Not supported under Windows CE and will always return false. Specifies whether the device is a remembered device. Not all remembered devices are authenticated. - Now supported under Windows CE — will return the same as . Specifies whether the device is authenticated, paired, or bonded. All authenticated devices are remembered. Is now supported on both CE and XP. Date and Time this device was last seen by the system. - Is set by the Inquiry (Device Discovery) process on the stacks where we handle Inquiry directly — that is every platform except the Microsoft stack on Win32 (MSFT+Win32), so is supported under MSFT+WM, Widcomm, Bluetopia, etc, etc. This value is supported on Windows 7 with the Microsoft stack. It it not supported on earlier Win32 versions as the native API has a bug. The value provided is always simply the current time, e.g. after a discovery for every device returned this value has the time of the discovery operation. Tracked by workitem 10280. - An instance of containing the time in UTC, or DateTime. if there's no value. Date and Time this device was last used by the system. - Not supported on most stacks: Widcomm, Bluetopia, MSFT+WM and will return DateTime.MinValue Is supported on Windows 7 with the Microsoft stack. Is not supported on earlier Win32 versions — there it just always returns the current time, see . - An instance of containing the time in UTC, or DateTime. if there's no value. Displays information about the device. Compares two instances for equality. - The to compare with the current instance. - true if is a and equal to the current instance; otherwise, false. E.g. used internally by WPF. Returns the hash code for this instance. A hash code for the current object. Listens for connections from Bluetooth RFCOMM network clients. The class provides simple methods that listen for and accept incoming connection requests. New connections are returned as instances (on Microsoft Bluetooth stack platforms alone a new instance can be returned for new connections). In the normal case a the listener is initialised with a holding the Service Class Id on which it is to accept connections, the listener will automatically create a SDP Service Record containg that Service Class Id and the port number (RFCOMM Service Channel Number) that it has started listening on. The standard usage is thus as follows. Class MyConsts Shared ReadOnly MyServiceUuid As Guid _ = New Guid("{00112233-4455-6677-8899-aabbccddeeff}") End Class ... Dim lsnr As New BluetoothListener(MyConsts.MyServiceUuid) lsnr.Start() ' Now accept new connections, perhaps using the thread pool to handle each Dim conn As New BluetoothClient = lsnr.AcceptBluetoothClient() Dim peerStream As Stream = conn.GetStream() ... One can also pass the BluetoothListener a Service Name (v2.4), a custom Service Record (Service Discovery Protocol record), and/or set Class of Service bit(s). To create a custom Service Record use . There are overloads of the constructor which take a parameter instead of a as the Service Class Id, the Class Id value should be specified in that case in the endpoint. If the port value is specified in the endpoint, then the listener will attempt to bind to that port locally. The address in the endpoint is largely ignored as no current stack supports more than one local radio. As of version 3.4 we catch an exception if it occurs on the new port set-up and it is stored. That error will be returned to any subsequent Accept; that is we assume that the error affects the listener completely and so make no attempt to start a new port and all subsequent Accept complete with the original error. In the Bluetopia case previously the 'one port at a time' error was unhandled and occurred on a background thread and therefore killed the application. Now it is caught and returned to the next Accept. Even better the first Accept successfully returns back to the caller. So BluetoothListener is now usable to that extent: one connection can be accepted. After that it needs to be discarded and a new server created. Initializes a new instance of the class. ---- Initializes a new instance of the class to listen on the specified service identifier. The Bluetooth service to listen for. An SDP record is published on successful to advertise the server. A generic record is created, containing the essential ServiceClassIdList and ProtocolDescriptorList attributes. The specified service identifier is inserted into the former, and the RFCOMM Channel number that the server is listening on is inserted into the latter. See the Bluetooth SDP specification for details on the use and format of SDP records. If a SDP record with more elements is required, then use one of the other constructors that takes an SDP record e.g. , or when passing it as a byte array . The format of the generic record used here is shown there also. Call the method to begin listening for incoming connection attempts. Initializes a new instance of the class that listens for incoming connection attempts on the specified local Bluetooth address and service identifier. A that represents the local Bluetooth radio address. The Bluetooth service on which to listen for incoming connection attempts. An SDP record is published on successful to advertise the server. A generic record is created, containing the essential ServiceClassIdList and ProtocolDescriptorList attributes. The specified service identifier is inserted into the former, and the RFCOMM Channel number that the server is listening on is inserted into the latter. See the Bluetooth SDP specification for details on the use and format of SDP records. If a SDP record with more elements is required, then use one of the other constructors that takes an SDP record e.g. , or when passing it as a byte array, e.g. . The format of the generic record used here is shown there also. Call the method to begin listening for incoming connection attempts. Initializes a new instance of the class with the specified local endpoint. - A that represents the local endpoint to which to bind the listener. See the documentation for more information on the usage of this argument. - An SDP record is published on successful to advertise the server. A generic record is created, containing the essential ServiceClassIdList and ProtocolDescriptorList attributes. The specified service identifier is inserted into the former, and the RFCOMM Channel number that the server is listening on is inserted into the latter. See the Bluetooth SDP specification for details on the use and format of SDP records. If a SDP record with more elements is required, then use one of the other constructors that takes an SDP record e.g. , or when passing it as a byte array . The format of the generic record used here is shown there also. Call the method to begin listening for incoming connection attempts. Initializes a new instance of the class to listen on the specified service identifier, publishing the specified SDP record. The Bluetooth service to listen for. Prepared SDP Record to publish. The index in the byte array where the RFCOMM Channel Number that the server is listening on is to be placed. However the supplied record is now parsed into an instance, and the channel offset is not used. The constructors taking the SDP record explicitly (as a byte array) should only be used if a specialized SDP record is required. For instance when using one of the standard profiles. Otherwise use one of the other constructors e.g. which create a generic SDP Record from the specified service identifier. Instead of passing a byte array containing a hand-built record, the record can also be built using the and classes, and passed to the respective constuctor, e.g. Any useful SDP record will include a ProtocolDescriptor element containing the RFCOMM Channel number that the server is listening on, and a ServiceClassId element containing the service UUIDs. The record supplied in the parameter should contain those elements. On successful , the RFCOMM Channel number that the protocol stack has assigned to the server is retrieved, and copied into the service record before it is published. The indicates the location of the respective byte in the byte array. An example SDP record is as follows. This is actually the format of the generic record used in the other constructors. For another example see the code in the ObexListener class. // The asterisks note where the Service UUID and the Channel number are // to be filled in. byte[] record = new byte[] { //Element Sequence: 0x35,0x27, //UInt16: 0x0001 -- ServiceClassIdList 0x09,0x00,0x01, //Element Sequence: 0x35,0x11, // UUID128: 00000000-0000-0000-0000-000000000000 -- * Service UUID 0x1c, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, // //UInt16: 0x0004 -- ProtocolDescriptorList 0x09,0x00,0x04, //Element Sequence: 0x35,0x0c, // Element Sequence: 0x35,0x03, // UUID16: 0x0100 -- L2CAP 0x19,0x01,0x00, // Element Sequence: 0x35,0x05, // UUID16: 0x0003 -- RFCOMM 0x19,0x00,0x03, // UInt8: 0x00 -- * Channel Number 0x08,0x00 }; For that record the channelOffset is 40. Initializes a new instance of the class that listens for incoming connection attempts on the specified local Bluetooth address and service identifier, publishing the specified SDP record. A that represents the local Bluetooth radio address. The Bluetooth service to listen for. Prepared SDP Record to publish The index in the byte array where the RFCOMM Channel Number that the server is listening on is to be placed. However the supplied record is now parsed into an instance, and the channel offset is not used. The constructors taking the SDP record explicitly (as a byte array) should only be used if a specialized SDP record is required. For instance when using one of the standard profiles. Otherwise use one of the other constructors e.g. which create a generic SDP Record from the specified service identifier. Instead of passing a byte array containing a hand-built record, the record can also be built using the and classes, and passed to the respective constuctor, e.g. Any useful SDP record will include a ProtocolDescriptor element containing the RFCOMM Channel number that the server is listening on, and a ServiceClassId element containing the service UUIDs. The record supplied in the parameter should contain those elements. On successful , the RFCOMM Channel number that the protocol stack has assigned to the server is retrieved, and copied into the service record before it is published. The indicates the location of the respective byte in the byte array. An example SDP record is as follows. This is actually the format of the generic record used in the other constructors. For another example see the code in the ObexListener class. // The asterisks note where the Service UUID and the Channel number are // to be filled in. byte[] record = new byte[] { //Element Sequence: 0x35,0x27, //UInt16: 0x0001 -- ServiceClassIdList 0x09,0x00,0x01, //Element Sequence: 0x35,0x11, // UUID128: 00000000-0000-0000-0000-000000000000 -- * Service UUID 0x1c, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, // //UInt16: 0x0004 -- ProtocolDescriptorList 0x09,0x00,0x04, //Element Sequence: 0x35,0x0c, // Element Sequence: 0x35,0x03, // UUID16: 0x0100 -- L2CAP 0x19,0x01,0x00, // Element Sequence: 0x35,0x05, // UUID16: 0x0003 -- RFCOMM 0x19,0x00,0x03, // UInt8: 0x00 -- * Channel Number 0x08,0x00 }; For that record the channelOffset is 40. Initializes a new instance of the class with the specified local endpoint, publishing the specified SDP record. - A that represents the local endpoint to which to bind the listener. See the documentation for more information on the usage of this argument. Prepared SDP Record to publish The index in the byte array where the RFCOMM Channel Number that the server is listening on is to be placed. However the supplied record is now parsed into an instance, and the channel offset is not used. - The constructors taking the SDP record explicitly (as a byte array) should only be used if a specialized SDP record is required. For instance when using one of the standard profiles. Otherwise use one of the other constructors e.g. which create a generic SDP Record from the specified service identifier. Instead of passing a byte array containing a hand-built record, the record can also be built using the and classes, and passed to the respective constuctor, e.g. Any useful SDP record will include a ProtocolDescriptor element containing the RFCOMM Channel number that the server is listening on, and a ServiceClassId element containing the service UUIDs. The record supplied in the parameter should contain those elements. On successful , the RFCOMM Channel number that the protocol stack has assigned to the server is retrieved, and copied into the service record before it is published. The indicates the location of the respective byte in the byte array. An example SDP record is as follows. This is actually the format of the generic record used in the other constructors. For another example see the code in the ObexListener class. // The asterisks note where the Service UUID and the Channel number are // to be filled in. byte[] record = new byte[] { //Element Sequence: 0x35,0x27, //UInt16: 0x0001 -- ServiceClassIdList 0x09,0x00,0x01, //Element Sequence: 0x35,0x11, // UUID128: 00000000-0000-0000-0000-000000000000 -- * Service UUID 0x1c, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, // //UInt16: 0x0004 -- ProtocolDescriptorList 0x09,0x00,0x04, //Element Sequence: 0x35,0x0c, // Element Sequence: 0x35,0x03, // UUID16: 0x0100 -- L2CAP 0x19,0x01,0x00, // Element Sequence: 0x35,0x05, // UUID16: 0x0003 -- RFCOMM 0x19,0x00,0x03, // UInt8: 0x00 -- * Channel Number 0x08,0x00 }; For that record the channelOffset is 40. Initializes a new instance of the class to listen on the specified service identifier, publishing the specified SDP record. - The Bluetooth service to listen for. Prepared SDP Record to publish. - The constructors taking the SDP record explicitly should only be used if a specialized SDP record is required. For instance when using one of the standard profiles. Otherwise use one of the other constructors e.g. which create a generic SDP Record from the specified service identifier. Any useful SDP record will include a ProtocolDescriptor element containing the RFCOMM Channel number that the server is listening on, and a ServiceClassId element containing the service UUIDs. The record supplied in the parameter should contain those elements. On successful , the RFCOMM Channel number that the protocol stack has assigned to the server is retrieved, and copied into the service record before it is published. An example SDP record is as follows. This is actually the format of the generic record used in the other constructors. For another example see the code in the ObexListener class. private static ServiceRecord CreateBasicRfcommRecord(Guid serviceClassUuid) { ServiceElement pdl = ServiceRecordHelper.CreateRfcommProtocolDescriptorList(); ServiceElement classList = new ServiceElement(ElementType.ElementSequence, new ServiceElement(ElementType.Uuid128, serviceClassUuid)); ServiceRecord record = new ServiceRecord( new ServiceAttribute( InTheHand.Net.Bluetooth.AttributeIds.UniversalAttributeId.ServiceClassIdList, classList), new ServiceAttribute( InTheHand.Net.Bluetooth.AttributeIds.UniversalAttributeId.ProtocolDescriptorList, pdl)); return record; } Initializes a new instance of the class that listens for incoming connection attempts on the specified local Bluetooth address and service identifier, publishing the specified SDP record. - A that represents the local Bluetooth radio address. The Bluetooth service to listen for. Prepared SDP Record to publish - The constructors taking the SDP record explicitly should only be used if a specialized SDP record is required. For instance when using one of the standard profiles. Otherwise use one of the other constructors e.g. which create a generic SDP Record from the specified service identifier. Any useful SDP record will include a ProtocolDescriptor element containing the RFCOMM Channel number that the server is listening on, and a ServiceClassId element containing the service UUIDs. The record supplied in the parameter should contain those elements. On successful , the RFCOMM Channel number that the protocol stack has assigned to the server is retrieved, and copied into the service record before it is published. An example SDP record is as follows. This is actually the format of the generic record used in the other constructors. For another example see the code in the ObexListener class. private static ServiceRecord CreateBasicRfcommRecord(Guid serviceClassUuid) { ServiceElement pdl = ServiceRecordHelper.CreateRfcommProtocolDescriptorList(); ServiceElement classList = new ServiceElement(ElementType.ElementSequence, new ServiceElement(ElementType.Uuid128, serviceClassUuid)); ServiceRecord record = new ServiceRecord( new ServiceAttribute( InTheHand.Net.Bluetooth.AttributeIds.UniversalAttributeId.ServiceClassIdList, classList), new ServiceAttribute( InTheHand.Net.Bluetooth.AttributeIds.UniversalAttributeId.ProtocolDescriptorList, pdl)); return record; } Initializes a new instance of the class with the specified local endpoint, publishing the specified SDP record. - A that represents the local endpoint to which to bind the listener. See the documentation for more information on the usage of this argument. Prepared SDP Record to publish - The constructors taking the SDP record explicitly (as a byte array) should only be used if a specialized SDP record is required. For instance when using one of the standard profiles. Otherwise use one of the other constructors e.g. which create a generic SDP Record from the specified service identifier. Any useful SDP record will include a ProtocolDescriptor element containing the RFCOMM Channel number that the server is listening on, and a ServiceClassId element containing the service UUIDs. The record supplied in the parameter should contain those elements. On successful , the RFCOMM Channel number that the protocol stack has assigned to the server is retrieved, and copied into the service record before it is published. An example SDP record is as follows. This is actually the format of the generic record used in the other constructors. For another example see the code in the ObexListener class. private static ServiceRecord CreateBasicRfcommRecord(Guid serviceClassUuid) { ServiceElement pdl = ServiceRecordHelper.CreateRfcommProtocolDescriptorList(); ServiceElement classList = new ServiceElement(ElementType.ElementSequence, new ServiceElement(ElementType.Uuid128, serviceClassUuid)); ServiceRecord record = new ServiceRecord( new ServiceAttribute( InTheHand.Net.Bluetooth.AttributeIds.UniversalAttributeId.ServiceClassIdList, classList), new ServiceAttribute( InTheHand.Net.Bluetooth.AttributeIds.UniversalAttributeId.ProtocolDescriptorList, pdl)); return record; } Gets the local endpoint. - The that the listener is using for communications. - The property of the endpoint will contain the port number (RFCOMM Channel Number) that the listener is listening on. On some platforms, the is similarly set, or is if not known. The endpoint’s is never set. Get or set the Service Class flags that this service adds to the host device’s Class Of Device field. - The Class of Device value contains a Device part which describes the primary service that the device provides, and a Service part which is a set of flags indicating all the service types that the device supports, e.g. , , etc. This property supports setting those flags; bits set in this value will be added to the host device’s CoD Service Class bits when the listener is active. For Win32 see MSDN — BTH_SET_SERVICE Structure Supported on Win32, but not supported on WindowsMobile/WinCE as there's no native API for it. The WindowCE section of MSDN mentions the Registry value COD at key HKEY_LOCAL_MACHINE\Software\Microsoft\Bluetooth\sys. However my (Jam) has value 0x920100 there but advertises a CoD of 0x100114, so its not clear how the values relate to each other. Get or set the ServiceName the server will use in its SDP Record. - A string representing the value to be used for the Service Name SDP Attribute. Will be if not specfied. - The listener is already started. - or - A custom Service Record was given at initialization time. In that case the ServiceName attribute should be added to that record. Gets the underlying network . - The underlying network . - The property is only supported on Microsoft Bluetooth stack platforms. creates a to listen for incoming client connection requests. Classes deriving from can use this property to get this . Use the underlying returned by the property if you require access beyond that which provides. Note property only returns the used to listen for incoming client connection requests. Use the method to accept a pending connection request and obtain a for sending and receiving data. You can also use the method to accept a pending connection request and obtain a for sending and receiving data. Starts listening for incoming connection requests. Starts listening for incoming connection requests with a maximum number of pending connection. The maximum length of the pending connections queue. Stops the socket from monitoring connections. Begins an asynchronous operation to accept an incoming connection attempt. - The method is only supported on Microsoft Bluetooth stack platforms. - An delegate that references the method to invoke when the operation is complete. A user-defined object containing information about the accept operation. This object is passed to the callback delegate when the operation is complete. - An that represents the asynchronous accept, which could still be pending. - The has been closed. Asynchronously accepts an incoming connection attempt and creates a new to handle remote host communication. An returned by a call to the method. A . Begins an asynchronous operation to accept an incoming connection attempt. - An delegate that references the method to invoke when the operation is complete. A user-defined object containing information about the accept operation. This object is passed to the callback delegate when the operation is complete. - An that represents the asynchronous accept, which could still be pending. Asynchronously accepts an incoming connection attempt and creates a new to handle remote host communication. An returned by a call to the method. A . Creates a new socket for a connection. - The method is only supported on Microsoft Bluetooth stack platforms. AcceptSocket is a blocking method that returns a that you can use to send and receive data. If you want to avoid blocking, use the method to determine if connection requests are available in the incoming connection queue. The returned is initialized with the address and channel number of the remote device. You can use any of the Send and Receive methods available in the class to communicate with the remote device. When you are finished using the , be sure to call its method. If your application is relatively simple, consider using the method rather than the AcceptSocket method. provides you with simple methods for sending and receiving data over a network in blocking synchronous mode. A used to send and receive data. Listener is stopped. Creates a client object for a connection when the specified service or endpoint is detected by the listener component. AcceptTcpClient is a blocking method that returns a that you can use to send and receive data. Use the method to determine if connection requests are available in the incoming connection queue if you want to avoid blocking. Use the method to obtain the underlying of the returned . The will provide you with methods for sending and receiving with the remote host. When you are through with the , be sure to call its method. If you want greater flexibility than a offers, consider using . A component. Listener is stopped. Determines if there is a connection pending. true if there is a connection pending; otherwise, false. Returns the SDP Service Record for this service. Returns if the listener is not ed (and an record wasn’t supplied at initialization). Gets or sets the authentication state of the current connect or behaviour to use when connection is established. For disconnected sockets, specifies that authentication is required in order for a connect or accept operation to complete successfully. Setting this option actively initiates authentication during connection establishment, if the two Bluetooth devices were not previously authenticated. The user interface for passkey exchange, if necessary, is provided by the operating system outside the application context. For outgoing connections that require authentication, the connect operation fails with WSAEACCES if authentication is not successful. In response, the application may prompt the user to authenticate the two Bluetooth devices before connection. For incoming connections, the connection is rejected if authentication cannot be established and returns a WSAEHOSTDOWN error. On unconnected sockets, enforces encryption to establish a connection. Encryption is only available for authenticated connections. For incoming connections, a connection for which encryption cannot be established is automatically rejected and returns WSAEHOSTDOWN as the error. For outgoing connections, the connect function fails with WSAEACCES if encryption cannot be established. In response, the application may prompt the user to authenticate the two Bluetooth devices before connection. Set or change the PIN to be used with a specific remote device. Address of Bluetooth device. PIN string consisting of 1 to 16 ASCII characters. Assigning null (Nothing in VB) or an empty String will revoke the PIN. Specifies additional protocols that the class supports. These constants are defined by the Bluetooth SIG - Service Discovery Protocol (bt-sdp) Bluetooth RFComm protocol (bt-rfcomm) Logical Link Control and Adaptation Protocol (bt-l2cap) Makes connections to services on peer IrDA devices. - Makes connections to services on peer IrDA devices. It allows discovery of all devices in range, then a connection can be made to the required service on the chosen peer. Or, given just the service name a connection will be made to an arbitrary peer. This is most useful when it is expected that there will be only one device in range—as is often the case. It can be used with both the full and Compact frameworks, and can be used as a replacement for the latter's built-in version simply by changing the referenced namespace and assembly. It also has features extra to those in the CF's version. For instance, following the pattern of in framework version 2, it provides access to the underlying via a Client property. This is particularly useful as it allows setting socket options, for instance IrCOMM Cooked mode with option . There a number of well-known services, a few are listed here. Service description Service Name, Protocol type OBEX file transfer OBEX:IrXfer, (TinyTP) OBEX general OBEX, (TinyTP) Printing IrLPT, IrLMP mode IrCOMM e.g. to modems IrDA:IrCOMM, IrCOMM 9-Wire/Cooked mode The modes required by the last two are set by socket option, as noted for IrCOMM above. Of course the library also includes specific OBEX protocol support, both client and server, see etc. - Example code to connect to a IrCOMM service would be as follows. Public Shared Sub Main() Dim cli As New IrDAClient ' Set IrCOMM Cooked/9-wire mode. cli.Client.SetSocketOption(IrDASocketOptionLevel.IrLmp, _ IrDASocketOptionName.NineWireMode, _ 1) ' equivalent to 'True' ' Connect cli.Connect("IrDA:IrCOMM") ' Connected, now send and receive e.g. by using the ' NetworkStream returned by cli.GetStream ... End Sub - Initializes a new instance of the class, and optionally connects to a peer device. ---- Initializes a new instance of the class. It then allows discovery of all devices in range using , then a connection can be made to the required service on the chosen peer using . Or, given just the service name a connection will be made to an arbitrary peer, using . This is most useful when it is expected that there will be only one device in range — as is often the case. Initializes a new instance of the class and connects to the specified service name. - This is equivalent to calling the default constructor followed by . As noted the connection will be made to an arbitrary peer. This is most useful when it is expected that there will be only one device in range — as is often the case. If a connection is to be made to a particular remote peer, then use the overload. Infrared connections are made by specifying a Service Name, which can be any value provided the participating devices refer the same name. See for the errors that can occur. - A containing the service name to connect to. Initializes a new instance of the class and connects to the specified endpoint. This is equivalent to calling the default constructor followed by . The endpoint specifies both the peer device and service name to connect to. If only one device is expected to be in range, or an arbitrary peer device is suitable, then one can use instead. An initialised with the address of the peer device and the service name to connect to. Gets or set a value that indicates whether a connection has been made. The number of bytes of data received from the network and available to be read. Gets or sets the underlying . This is particularly useful as it allows setting socket options, for instance IrCOMM Cooked mode, ie . Example code to connect to a IrCOMM service would be as follows, note the use of the Client property. Public Shared Sub Main() Dim cli As New IrDAClient ' Set IrCOMM Cooked/9-wire mode. cli.Client.SetSocketOption( _ IrDASocketOptionLevel.IrLmp, _ IrDASocketOptionName.NineWireMode, _ 1) ' representing true ' Connect cli.Connect("IrDA:IrCOMM") ' Connected, now send and receive e.g. by using the ' NetworkStream returned by cli.GetStream ... End Sub Gets a value indicating whether the underlying for an is connected to a remote host. Obtains information about available devices. - Returns a maximum of 8 devices, for more flexibility use the other overloads. - The discovered devices as an array of . Obtains information about a specified number of devices. - The maximum number of devices to get information about. - The discovered devices as an array of . Obtains information about available devices using a socket. - The maximum number of devices to get information about. A to be uses to run the discovery process. It should have been created for the IrDA protocol - The discovered devices as an array of . Gets the name of the peer device using the specified socket. A connected IrDA Socket. The name of the remote device. - This finds the name of the device to which the socket is connection, an exception will occur if the socket is not connected. - s is null (Nothing in Visual Basic). The remote device is not present in the list of discovered devices. The socket is not connected. Gets the name of the peer device participating in the communication. - This finds the name of the device to which the client is connection, an exception will occur if the socket is not connected. - If the remote device is not found in the discovery cache. The socket is not connected. Forms a connection to the specified peer service. -- Forms a connection to the specified endpoint. The endpoint specifies both the peer device and service name to connect to. If only one device is expected to be in range, or an arbitrary peer device is suitable, then one can use instead. An initialised with the address of the peer device and the service name to connect to. Forms a connection to the specified service on an arbitrary peer. As noted the connection will be made to an arbitrary peer. This is most useful when it is expected that there will be only one device in range — as is often the case. If a connection is to be made to a particular remote peer, then use . The Service Name to connect to eg "OBEX". In the very uncommon case where a connection is to be made to a specific LSAP-SEL (port number), then use the form "LSAP-SELn", where n is an integer. - No peer IrDA device was found. The exception has message “No device”. A connection could not be formed. See the exception message or (or on NETCF) for what error occurred. Begins an asynchronous request for a remote host connection. - Begins an asynchronous request for a remote host connection. The remote host is specified by an endpoint. - An initialised with the address of the peer device and the service name to connect to. An AsyncCallback delegate that references the method to invoke when the operation is complete. A user-defined object that contains information about the connect operation. This object is passed to the requestCallback delegate when the operation is complete. - An that represents the asynchronous connect, which could still be pending. Begins an asynchronous request for a remote host connection. The remote host is specified by a service name (string). - The service name of the remote host. An AsyncCallback delegate that references the method to invoke when the operation is complete. A user-defined object that contains information about the connect operation. This object is passed to the requestCallback delegate when the operation is complete. - An that represents the asynchronous connect, which could still be pending. - See for the errors that can occur. Asynchronously accepts an incoming connection attempt. An object returned by a call to / . Closes the and the underlying connection. - The two XxxxxClient classes produced by Microsoft (TcpClient, and IrDAClient in the NETCF) have various documented behaviours and various actual behaviours for close/dispose/finalize on the various platforms. :-( The current TcpClient implementation is that Close/Dispose closes the connection by closing the underlying socket and/or NetworkStream, and finalization doesn't close either. This is the behaviour we use for the here (for , ). (The documentation in MSDN for is still wrong by-the-way, see Microsoft feedback #158480). Returns the used to send and receive data. - The underlying NetworkStream. - GetStream returns a NetworkStream that you can use to send and receive data. The NetworkStream class inherits from the class, which provides a rich collection of methods and properties used to facilitate network communications. You must call the method, or one of its overloads, first, or the GetStream method will throw an InvalidOperationException. After you have obtained the NetworkStream, call the method to send data to the remote host. Call the method to receive data arriving from the remote host. Both of these methods block until the specified operation is performed. You can avoid blocking on a read operation by checking the property. A true value means that data has arrived from the remote host and is available for reading. In this case, Read is guaranteed to complete immediately. If the remote host has shutdown its connection, Read will immediately return with zero bytes. Closing the NetworkStream closes the connection. Similarly Closing, Disposing, or the finalization of the IrDAClient Disposes the NetworkStream. This is new behaviour post 2.0.60828.0. If you receive a SocketException, use SocketException.ErrorCode to obtain the specific error code. After you have obtained this code, you can refer to the Windows Sockets version 2 API error code documentation in MSDN for a detailed description of the error. - The is not connected to a remote host. The IrDAClient has been closed. Releases the unmanaged resources used by the and optionally releases the managed resources. true to release both managed and unmanaged resources; false to release only unmanaged resources. Closes the and the underlying connection. - Provides information about remote devices connected by infrared communications. Returns the address of the remote device. Provided solely for compatibility with System.Net.IrDA - consider using instead. Gets the name of the device. Gets the character set used by the server, such as ASCII. Gets the type of the device, such as a computer. Compares two instances for equality. - The to compare with the current instance. - true if is a and equal to the current instance; otherwise, false. Returns the hash code for this instance. A hash code for the current object. Places a socket in a listening state to monitor infrared connections from a specified service or network address. This class monitors a service by specifying a service name or a network address. The listener does not listen until you call one of the methods. Initializes a new instance of the class. The network address to monitor for making a connection. Initializes a new instance of the class. The name of the service to listen for. Gets the underlying network . Gets a value that indicates whether the is actively listening for client connections. Gets an representing the local device. Starts listening for incoming connection requests. Starts listening for incoming connection requests with a maximum number of pending connection. The maximum length of the pending connections queue. Stops the socket from monitoring connections. Creates a new socket for a connection. A socket. Creates a client object for a connection when the specified service or endpoint is detected by the listener component. An object. Begins an asynchronous operation to accept an incoming connection attempt. - An delegate that references the method to invoke when the operation is complete. A user-defined object containing information about the accept operation. This object is passed to the callback delegate when the operation is complete. - An that references the asynchronous creation of the . - The has been closed. Asynchronously accepts an incoming connection attempt and creates a new to handle remote host communication. An returned by a call to the method. A . Begins an asynchronous operation to accept an incoming connection attempt. - An delegate that references the method to invoke when the operation is complete. A user-defined object containing information about the accept operation. This object is passed to the callback delegate when the operation is complete. - An that represents the asynchronous accept, which could still be pending. Asynchronously accepts an incoming connection attempt and creates a new to handle remote host communication. An returned by a call to the method. An . Determines if a connection is pending. true if there is a connection pending; otherwise, false. Provides client connections to a remote Bluetooth L2CAP service. - For RFCOMM connections use . The normal usage is o create an instance, connect with or , and if successful one then calls to send and receive data. See the method for more information on specifying the remote service to connect to. Creates a new instance of . Closes the and the underlying connection. - Closes the and the underlying connection. - Connects to a remote Bluetooth L2CAP service using the specified remote endpoint. - The must have the set, and either the or properties set. The port is the L2CAP PSM number, and if set a connection will be made to that PSM and the Service Class Id ignored. Note that only certain PSM values are valid. See for more information. - The to which you intend to connect. See the remarks for usage. Begins an asynchronous request for a remote host connection. - See for more information. - The to which you intend to connect. See or , for more information. An delegate that references the method to invoke when the operation is complete. A user-defined object that contains information about the connect operation. This object is passed to the delegate when the operation is complete. - An object that references the asynchronous connection, which may still be pending. Asynchronously accepts an incoming connection attempt. - An object returned by a call to or , Returns the used to send and receive data. - Note it is NOT a . That type handles SOCK_STREAM connections, whereas L2CAP uses SOCK_SEQPACKET. Different Stream subclasses may be returned by different platforms. - The used to send and receive data. Get the remote endpoint. - The with which the is communicating. Get the MTU................ int Listens for connections from L2CAP Bluetooth network clients. - The class provides simple methods that listen for and accept incoming connection requests. New connections are returned as instances. In the normal case a the listener is initialised with a holding the Service Class Id on which it is to accept connections, the listener will automatically create a SDP Service Record containg that Service Class Id and the port number (L2CAP Protocol Service Multiplexer) that it has started listening on. The standard usage is thus as follows. Class MyConsts Shared ReadOnly MyServiceUuid As Guid _ = New Guid("{00112233-4455-6677-8899-aabbccddeeff}") End Class ... Dim lsnr As New L2CapListener(MyConsts.MyServiceUuid) lsnr.Start() ' Now accept new connections, perhaps using the thread pool to handle each Dim conn As New L2CapClient = lsnr.AcceptClient() Dim peerStream As Stream = conn.GetStream() ... One can also pass the L2CapListener a Service Name, or a custom Service Record (Service Discovery Protocol record). To create a custom Service Record use . There are overloads of the constructor which take a parameter instead of a as the Service Class Id, the Class Id value should be specified in that case in the endpoint. If the port value is specified in the endpoint, then the listener will attempt to bind to that L2CAP PSM locally. The address in the endpoint is largely ignored as no current stack supports more than one local radio. The L2CAP protocol accepts only certain PSM values. The value is a 16-bit integer, and the low byte must be odd and the high byte must be even. So e.g. 0x0001 is valid, but 0x0002 and 0x0101 are invalid. The range below 0x1001 is reserved for standards allocations. See the L2CAP Specification for more information, L2CAP section 4.2 (and SDP section 5.1.5) in the version 2.1 specification. Initializes a new instance of the class that listens on the specified service identifier. - The Bluetooth service to listen on. Either one of the values on , or your custom UUID stored in a . See the documentation for more information on the usage of this argument. Initializes a new instance of the class with the specified local endpoint. - The simpler constructor taking just a System.Guid is used in most cases instead of this one. - A that represents the local endpoint to which to bind the listener. Either one of the values on , or your custom UUID stored in a . See the documentation for more information on the usage of this argument. Starts listening for incoming connection requests. Starts listening for incoming connection requests with a maximum number of pending connection. - The maximum length of the pending connections queue. Closes the listener. Gets the local endpoint. - The that the listener is using for communications. - The property of the endpoint will contain the port number (L2CAP PSM) that the listener is listening on. On some platforms, the is similarly set, or is BluetoothAddress.None if not known. The endpoint’s is never set. Begins an asynchronous operation to accept an incoming connection attempt. - An AsyncCallback delegate that references the method to invoke when the operation is complete. A user-defined object containing information about the accept operation. This object is passed to the callback delegate when the operation is complete. - An that represents the asynchronous accept, which could still be pending. Asynchronously accepts an incoming connection attempt and creates a new to handle remote host communication. - An returned by a call to the method. - A . Accepts a pending connection request. - AcceptClient is a blocking method that returns a that you can use to send and receive data. Use the method to determine if connection requests are available in the incoming connection queue if you want to avoid blocking. Use the method to obtain the underlying of the returned . The will provide you with methods for sending and receiving with the remote host. When you are through with the , be sure to call its method. - A used to send and receive data. - Listener is stopped. Determines if there is a connection pending. - true if there is a connection pending; otherwise, false. Get or set the ServiceName the server will use in its SDP Record. - A string representing the value to be used for the Service Name SDP Attribute. Will be if not specfied. - The listener is already started. - or - A custom Service Record was given at initialization time. In that case the ServiceName attribute should be added to that record. Returns the SDP Service Record for this service. - Returns if the listener is not ed (and an record wasn’t supplied at initialization). Provide a System.Net.Sockets.Socket-like interace to another connection type e.g. a - See class for an implementation that adapts etc to the Socket-like interface. That is required as on Widcomm/Broadcom does not support getting a from the property. Motivated by upgrading of to be usable on Widcomm. An adapter that provides a System.Net.Sockets.Socket-like interface to etc. - Required as on Widcomm/Broadcom does not support getting a from the property. Motivated by upgrading of to be usable on Widcomm. Also adapts , and . Defines the type of an IAS attribute. Identifies an integer attribute value. Identifies a binary, or octet, attribute value. Identifies a string attribute value. Standard IrDA service names. Well-known Service Name “IrDA:IrCOMM” Well-known Service Name “IrLPT” Well-known Service Name “OBEX” Specifies the media type information for an object. Specifies the type of image data in an object. Specifies that the image data is in Graphics Interchange Format (GIF). Specifies that the image data is in Joint Photographic Experts Group (JPEG) format. Specifies the type of text data in an object. Specifies that the data is in HTML format. Specifies that the data is in plain text format. Specifies that the data is in vCalendar format. Specifies that the data is in vCard format. Specifies that the data is in vMsg format. Specifies that the data is in vNote format. Specifies that the data is in XML format. Specifies the type of Object Exchange specific data. Used to retrieve supported object types. Used to retrieve folder listing with OBEX FTP. Used to retrieve an object profile. Get the results of the operation from the specified function and set the operation as completed, or if getting the results fails then set the corresponding error completion. - The pattern that comes to mind when calling is the incorrect: try { var result = SomeStatementsAndFunctionCallsToGetTheResult(...); ar.SetAsCompleted(result, false); } catch (Exception ex) { ar.SetAsCompleted(ex, false); } That is wrong because if the user callback fails with an exception then we'll catch it and try to call SetAsCompleted a second time! We need to instead call SetAsCompleted outside of the try block. This method provides that pattern. - A delegate containing the function to call to get the result. It should throw an exception in error cases. Used with AsyncResultNoResult.SetAsCompleted and AsyncResult<TResult>.SetAsCompleted. Equivalent to true for the #x201C;completedSynchronously” parameter. Equivalent to false for the #x201C;completedSynchronously” parameter. Forces the callback to run on a thread-pool thread. Represents a Bluetooth device address. The BluetoothAddress class contains the address of a bluetooth device. Initializes a new instance of the class with the specified address. representation of the address. Initializes a new instance of the class with the specified address. - Note: The address should be supplied in little-endian order on the current Windows platform (which is little-endian). For forward compatibility it would be safer to use the method, which will be correct for all platforms. Or consider or . - Address as 6 byte array. address passed was . address passed was not a 6 byte array. Create a from an Array of where the array is in standard order. - Different protocol stacks have different ways of storing a Bluetooth Address. Some use an array of bytes e.g. "byte[6]", which means that the first byte of the address comes first in memory (which we’ll call big-endian format). Others e.g. the Microsoft stack use a long integer (e.g. uint64) which means that the *last* byte of the address come comes first in memory (which we’ll call little-endian format) This method creates an address for the first form. See for the second form. - An Array of with the Bluetooth Address ordered as described above. - The resultant . - Create a from an Array of where the array is in reverse order. - Different protocol stacks have different ways of storing a Bluetooth Address. Some use an array of bytes e.g. "byte[6]", which means that the first byte of the address comes first in memory (which we’ll call big-endian format). Others e.g. the Microsoft stack use a long integer (e.g. uint64) which means that the *last* byte of the address come comes first in memory (which we’ll call little-endian format) This method creates an address for the second form. See for the first form. - An Array of with the Bluetooth Address ordered as described above. - The resultant . - Converts the string representation of an address to it's equivalent. A return value indicates whether the operation succeeded. A string containing an address to convert. When this method returns, contains the equivalent to the address contained in s, if the conversion succeeded, or null (Nothing in Visual Basic) if the conversion failed. The conversion fails if the s parameter is null or is not of the correct format. true if s is a valid Bluetooth address; otherwise, false. Converts the string representation of a Bluetooth address to a new instance. A string containing an address to convert. New instance. Address must be specified in hex format optionally separated by the colon or period character e.g. 000000000000, 00:00:00:00:00:00 or 00.00.00.00.00.00. bluetoothString is null. bluetoothString is not a valid Bluetooth address. Significant address part. Non-significant address part. Returns the value as a byte array. - In previous versions this returned the internal array, it now returns a copy. Addresses should be immutable, particularly for the None const! - An array of byte Returns the value as a byte array, where the array is in reverse order. - See for discussion of different stack#x2019;s storage formats for Bluetooth Addresses. In previous versions this returned the internal array, it now returns a copy. Addresses should be immutable, particularly for the None const! - An array of byte of length six representing the Bluetooth address. Returns the value as a byte array, where the array is in standard order. - See for discussion of different stack#x2019;s storage formats for Bluetooth Addresses. In previous versions this returned the internal array, it now returns a copy. Addresses should be immutable, particularly for the None const! - An array of byte of length six representing the Bluetooth address. Returns the Bluetooth address as a long integer. - An . Compares two instances for equality. - The to compare with the current instance. - true if is a and equal to the current instance; otherwise, false. Returns the hash code for this instance. A hash code for the current object. Returns an indication whether the values of two specified objects are equal.New in v1.5 - A or . A or . - true if the values of the two instance are equal; otherwise, false. Returns an indication whether the values of two specified objects are not equal. - A or . A or . - true if the value of the two instance is different; otherwise, false. Converts the address to its equivalent string representation. The string representation of this instance. The default return format is without a separator character - use the overload for more formatting options. Returns a representation of the value of this instance, according to the provided format specifier. A single format specifier that indicates how to format the value of this address. The format parameter can be "N", "C", or "P". If format is null or the empty string (""), "N" is used. A representation of the value of this . SpecifierFormat of Return Value N12 digits: XXXXXXXXXXXX C12 digits separated by colons: XX:XX:XX:XX:XX:XX P12 digits separated by periods: XX.XX.XX.XX.XX.XX Provides a null Bluetooth address. Limited Inquiry Access Code. General Inquire Access Code. The default inquiry code which is used to discover all devices in range. Returns a representation of the value of this instance, according to the provided format specifier. - A single format specifier that indicates how to format the value of this Address. See for the possible format strings and their output. Ignored. - A representation of the value of this . - See for the possible format strings and their output. Creates a copy of the . Creates a copy including of the internal byte array. A copy of the . Represents a network endpoint as a Bluetooth address and a Service Class Id and/or a port number. - The BluetoothEndPoint class contains the host, service class id and port information needed by an application to connect to a service on a host. By combining the host's Bluetooth address and class id or port number, the BluetoothEndPoint class forms a connection point to a service. When used for instance when connecting with , if the port is specified then the connection is made to that port, otherwise a SDP lookup is done for a record with the class specified in the property. Initializes a new instance of the class with the specified address and service. The Bluetooth address of the device. A six byte array. The Bluetooth service to use. Initializes a new instance of the class with the specified address, service and port number. The Bluetooth address of the device. A six byte array. The Bluetooth service to use. Radio channel to use, -1 for any. - See the documentation for how the combination of Service and Port are used when connecting with BluetoothClient. Serializes endpoint information into a instance. A instance containing the socket address for the endpoint. Creates an endpoint from a socket address. The to use for the endpoint. An instance using the specified socket address. Compares two instances for equality. - The to compare with the current instance. - true if is a and equal to the current instance; otherwise, false. Returns the hash code for this instance. A hash code for the current object. Returns the string representation of the BluetoothEndPoint. We try to follow existing examples where possible; JSR-82 and similar use a URI of the form: bluetooth://xxxxxxxxxxxx:xx or: bluetooth://xxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx or in some serialport only situations: btspp:// So we follow that pattern here, but of course without the URI prefix. If the form with the URI is required then the prefix can simply be appended. If the port is non default then we use that, otherwise just the full guid. Some examples are: To the ObexObjectPush service: "04E2030405F6:0000110500001000800000805f9b34fb" To the SerialPort service: "04E2030405F6:0000110100001000800000805f9b34fb" With an Empty service GUID: "04E2030405F6:00000000000000000000000000000000" With port 9: "04E2030405F6:9" The string representation of the BluetoothEndPoint. Gets the address family of the Bluetooth address. Gets or sets the Bluetooth address of the endpoint. Gets or sets the Bluetooth service to use for the connection. Gets or sets the service channel number of the endpoint. Gets whether a is set. Creates a copy of the . Creates a copy including of the internal A copy of the . Specifies the minimum value that can be assigned to the Port property. Specifies the maximum value that can be assigned to the Port property. The minimum valid Server Channel Number, 1. Bluetooth's rfcomm.pdf: Part F:1 -- RFCOMM with TS 07.10 -- Serial Port Emulation Section 5.4: “The RFCOMM server channel number is a [five-bit field]. Server applications registering with an RFCOMM service interface are assigned a Server Channel number in the range 1…30. [0 and 31 should not be used since the corresponding DLCIs are reserved in TS 07.10]” The maximum valid Server Channel Number, 30. Represents an IrDA device address. Initializes a new instance of the class with the specified address. Address as 4 byte array. was null. was not a 4 byte array. Initializes a new instance of the class with the specified address. representation of the address. Returns the IrDA address as an integer. - An . Returns the internal byte array. - An array of . Converts the string representation of an address to it's equivalent. A return value indicates whether the operation succeeded. A string containing an address to convert. When this method returns, contains the equivalent to the address contained in s, if the conversion succeeded, or null (Nothing in Visual Basic) if the conversion failed. The conversion fails if the s parameter is null or is not of the correct format. true if s is a valid IrDA address; otherwise, false. Converts the string representation of an IrDA address to a new instance. A string containing an address to convert. New instance. Address must be specified in hex format optionally separated by the colon or period character e.g. 00000000, 00:00:00:00 or 00.00.00.00. irdaString is null. irdaString is not a valid IrDA address. Converts the address to its equivalent string representation. The string representation of this instance. Returns a representation of the value of this instance, according to the provided format specifier. A single format specifier that indicates how to format the value of this Guid. The format parameter can be "N", "C" or "P". If format is null or the empty string (""), "N" is used. A representation of the value of this . SpecifierFormat of Return Value N8 digits: XXXXXXXX C8 digits separated by colons: XX:XX:XX:XX P8 digits separated by periods: XX.XX.XX.XX Compares two instances for equality. - The to compare with the current instance. - true if is a and equal to the current instance; otherwise, false. Returns the hash code for this instance. A hash code for the current object. Returns an indication whether the values of two specified objects are equal. - A or . A or . - true if the values of the two instance are equal; otherwise, false. Returns an indication whether the values of two specified objects are not equal. - A or . A or . - true if the value of the two instance is different; otherwise, false. Provides a null IrDA address. Returns a representation of the value of this instance, according to the provided format specifier. A single format specifier that indicates how to format the value of this Guid. The format parameter can be "N", "C" or "P". If format is null or the empty string (""), "N" is used. Ignored. - A representation of the value of this . - See for the possible format strings and their output. Represents an end point for an infrared connection. Initializes a new instance of the class. The device identifier. The Service Name to connect to/listen on eg "OBEX". In the very uncommon case where a connection is to be made to / a server is to listen on a specific LSAP-SEL (port number), then use the form "LSAP-SELn", where n is an integer. Initializes a new instance of the class. The device address. The Service Name to connect to/listen on eg "OBEX". In the very uncommon case where a connection is to be made to / a server is to listen on a specific LSAP-SEL (port number), then use the form "LSAP-SELn", where n is an integer. Gets or sets an address for the device. Gets or sets an identifier for the device. The specified byte array is null (Nothing in Visual Basic). The specified byte array is not four bytes long. Gets or sets the name of the service. Gets the address family to which the endpoint belongs. Compares two instances for equality. - The to compare with the current instance. - true if is a and equal to the current instance; otherwise, false. Returns the hash code for this instance. A hash code for the current object. Returns the string representation of the IrDAEndPoint. The string is in format <DeviceAddress>:<ServiceName> An example is: "04E20304:OBEX" The string representation of the IrDAEndPoint. Provides a simple, programmatically controlled OBEX protocol listener. Initializes a new instance of the ObexListener class. - Initializes a new instance of the ObexListener class using the Bluetooth transport. Initializes a new instance of the ObexListener class specifiying the transport to use. - Specifies the transport protocol to use. Get or set whether the transport connection (e.g. Bluetooth) will require Authentication. - Only Bluetooth supports this, TCP/IP and IrDA do not. On Bluetooth this uses BluetoothListener.Authenticate. Get or set whether the transport connection (e.g. Bluetooth) will require Encryption. - Only Bluetooth supports this, TCP/IP and IrDA do not. On Bluetooth this uses BluetoothListener.Encrypt. Gets a value that indicates whether the has been started. Allows this instance to receive incoming requests. Causes this instance to stop receiving incoming requests. Shuts down the ObexListener. Waits for an incoming request and returns when one is received. - This method blocks waiting for a new connection. It will return when a new connection completes or / has been called. - Returns a or if / has been called. Provides access to the request and response objects used by the class. Gets the that represents a client's request for a resource Describes an incoming OBEX request to an object. Gets the length of the body data included in the request. New in v1.5.51015 A long value that contains the value from the request's Length header. This value is -1 if the content length is not known. The Length header expresses the length, in bytes, of the body data that accompanies the request. Gets the MIME type of the body data included in the request. A that contains the text of the request's Type header. Gets the collection of header name/value pairs sent in the request. A that contains the OBEX headers included in the request. For a complete list of request headers, see the enumeration. Get the device address and service to which the request is directed. - The instance returned will be of the subtype that matches the address family that the is listening on. For instance if the listener was created with . then the will be of type , and similarly for and . - Gets the method specified by the client. Only PUT is supported in this version. Gets a stream that contains the body data sent by the client. Gets the OBEX version used by the requesting client Gets the URL information (without the host and port) requested by the client. A that contains the raw URL for this request. Gets the device address and service from which the request originated. - The instance returned will be of the subtype that matches the address family that the is listening on. For instance if the listener was created with . then the will be of type , and similarly for and . - C# ObexListener lsnr = new ObexListener(ObexTransport.Bluetooth) ... ... ObexListenerRequest olr = ... BluetoothEndPoint remoteEp = (BluetoothEndPoint)olr.RemoteEndPoint; BluetoothAddress remoteAddr = remoteEp.Address; Visual Basic Dim lsnr As New ObexListener(ObexTransport.IrDA) ... ... Dim olr As ObexListenerRequest = ... Dim remoteEp As IrDAEndPoint = CType(olr.RemoteEndPoint, IrDAEndPoint); Dim remoteAddr As IrDAAddress = remoteEp.Address; - Gets the server address to which the request is directed. Gets the object requested by the client. A object that identifies the resource requested by the client. Writes the body of the request to the specified file path. The filename (including the path) to write to. Methods which can be carried out in an Object Exchange transaction. Sends an object to a receiving device. Requests a file from the remote device. Negotiate an Object Exchange connection with a remote device. Disconnect an existing Object Exchange session. Sends the last packet of an object to a receiving device. Change remote path on an Object Exchange server. Specifies the status codes returned for an Object Exchange (OBEX) operation. OBEX codes are directly related to their HTTP equivalents - see . Applied to another code to indicate this is the only response or final response in a series. Equivalent to HTTP status 100. Continue indicates that the client can continue with its request. Equivalent to HTTP status 200. OK indicates that the request succeeded and that the requested information is in the response. This is the most common status code to receive. Equivalent to HTTP status 201. Created indicates that the request resulted in a new resource created before the response was sent. Equivalent to HTTP status 202. Accepted indicates that the request has been accepted for further processing. Equivalent to HTTP status 203. NonAuthoritativeInformation indicates that the returned metainformation is from a cached copy instead of the origin server and therefore may be incorrect. Equivalent to HTTP status 204. NoContent indicates that the request has been successfully processed and that the response is intentionally blank. Equivalent to HTTP status 205. ResetContent indicates that the client should reset (not reload) the current resource. Equivalent to HTTP status 206. PartialContent indicates that the response is a partial response as requested by a GET request that includes a byte range. Equivalent to HTTP status 300. MultipleChoices indicates that the requested information has multiple representations. Equivalent to HTTP status 301. MovedPermanently indicates that the requested information has been moved to the URI specified in the Location header. The default action when this status is received is to follow the Location header associated with the response. Equivalent to HTTP status 302. Redirect indicates that the requested information is located at the URI specified in the Location header. The default action when this status is received is to follow the Location header associated with the response. When the original request method was POST, the redirected request will use the GET method. Equivalent to HTTP status 303. SeeOther automatically redirects the client to the URI specified in the Location header as the result of a POST. The request to the resource specified by the Location header will be made with a GET. Equivalent to HTTP status 304. NotModified indicates that the client's cached copy is up to date. The contents of the resource are not transferred. Equivalent to HTTP status 305. UseProxy indicates that the request should use the proxy server at the URI specified in the Location header. Equivalent to HTTP status 400. BadRequest indicates that the request could not be understood by the server. BadRequest is sent when no other error is applicable, or if the exact error is unknown or does not have its own error code. reports errors through ObexWebResponse.StatusCode, this status code is overloaded by it to report failure to connect to the server. Equivalent to HTTP status 401. Unauthorized indicates that the requested resource requires authentication. The WWW-Authenticate header contains the details of how to perform the authentication. Equivalent to HTTP status 402. PaymentRequired is reserved for future use. Equivalent to HTTP status 403. Forbidden indicates that the server refuses to fulfill the request. Equivalent to HTTP status 404. NotFound indicates that the requested resource does not exist on the server. Equivalent to HTTP status 405. MethodNotAllowed indicates that the request method (POST or GET) is not allowed on the requested resource. Equivalent to HTTP status 406. NotAcceptable indicates that the client has indicated with Accept headers that it will not accept any of the available representations of the resource. Equivalent to HTTP status 407. ProxyAuthenticationRequired indicates that the requested proxy requires authentication. The Proxy-authenticate header contains the details of how to perform the authentication. Equivalent to HTTP status 408. RequestTimeout indicates that the client did not send a request within the time the server was expecting the request. Equivalent to HTTP status 409. Conflict indicates that the request could not be carried out because of a conflict on the server. Equivalent to HTTP status 410. Gone indicates that the requested resource is no longer available. Equivalent to HTTP status 411. LengthRequired indicates that the required Content-length header is missing. Equivalent to HTTP status 412. PreconditionFailed indicates that a condition set for this request failed, and the request cannot be carried out. Conditions are set with conditional request headers like If-Match, If-None-Match, or If-Unmodified-Since. Equivalent to HTTP status 413. RequestEntityTooLarge indicates that the request is too large for the server to process. Equivalent to HTTP status 414. RequestUriTooLong indicates that the URI is too long. Equivalent to HTTP status 415. UnsupportedMediaType indicates that the request is an unsupported type. Equivalent to HTTP status 500. InternalServerError indicates that a generic error has occurred on the server. reports errors through ObexWebResponse.StatusCode, this status code is used by it to report failure to send the object. Equivalent to HTTP status 501. NotImplemented indicates that the server does not support the requested function. Equivalent to HTTP status 502. BadGateway indicates that an intermediate proxy server received a bad response from another proxy or the origin server. Equivalent to HTTP status 503. ServiceUnavailable indicates that the server is temporarily unavailable, usually due to high load or maintenance. Equivalent to HTTP status 504. GatewayTimeout indicates that an intermediate proxy server timed out while waiting for a response from another proxy or the origin server. Equivalent to HTTP status 505. HttpVersionNotSupported indicates that the requested HTTP version is not supported by the server. Supported network transports for Object Exchange. Infrared (IrDA) Bluetooth TCP/IP Provides an OBEX implementation of the class. - If you want to transfer an file or other object using the standard service as used by Windows' Wireless Link / Bluetooth File Transfer Wizard, Palm's Beam, Nokia's Send via Infrared, then use the OBEX protocol. The PUT operation is supported, and there is new support for GET, (see the documentation at the property). Changing folders is not supported, nor is getting a folder listing. In the previous version there were some issue with handling file names that include non-English characters, and connections to some device types failed. Also if the connection to the peer was lost then the request could hang reading forever. See the release note and bugs database for more information. - For Bluetooth one can use code like the following to send a file: (Note a failure is signalled by an exception). Dim addr As BluetoothAddress = BluetoothAddress.Parse("002233445566") Dim path As String = "HelloWorld.txt" ' Dim req As New ObexWebRequest(addr, path) req.ReadFile("Hello World.txt") Dim rsp As ObexWebResponse = CType(req.GetResponse(),ObexWebResponse) Console.WriteLine("Response Code: {0} (0x{0:X})", rsp.StatusCode) That constructor isn't available for other transports (TCP/IP, IrDA) so one has to create a Uri to provide the scheme, address, and path parameters. Thus use code like the following to send a file. ' The host part of the URI is the device address, e.g. IrDAAddress.ToString(), ' and the file part is the OBEX object name. Dim addr As BluetoothAddress = ... Dim addrStr As String = addr.ToString("N") Dim uri As New Uri("obex://" & addrStr & "/HelloWorld.txt") ' Dim req As New ObexWebRequest(uri) req.ReadFile("Hello World.txt") Dim rsp As ObexWebResponse = CType(req.GetResponse(),ObexWebResponse) Console.WriteLine("Response Code: {0} (0x{0:X})", rsp.StatusCode) Or, to send locally generated content use something like the following. Dim addr As BluetoothAddress = ... Dim path As String = "HelloWorld2.txt" ' Dim req As New ObexWebRequest(addr, path) Using content As Stream = req.GetRequestStream() ' Using a StreamWriter to write text to the stream... Using wtr As New StreamWriter(content) wtr.WriteLine("Hello World GetRequestStream") wtr.WriteLine("Hello World GetRequestStream 2") wtr.Flush() ' Set the Length header value req.ContentLength = content.Length End Using ' In this case closing the StreamWriter also closed the Stream, but ... End Using Dim rsp As ObexWebResponse = CType(req.GetResponse(),ObexWebResponse) Console.WriteLine("Response Code: {0} (0x{0:X})", rsp.StatusCode) See also the ObexPushApplication and ObexPushVB sample programs. Create a new Obex request with the specified . - Create a new Obex request with the specified . e.g. "obex://112233445566/HelloWorld.txt" Uri must use one of the following schemes - obex, obex-push, obex-ftp, obex-sync. The host name must be the device address in short hex, or dotted hex notation - not the default representation using the colon separator [Advanced usage] Create a new Obex request with the specified and the open connection to an OBEX server. - [Advanced usage] A url of the form “scheme:///filename”, “e.g. obex:///foo.txt”. That is the host part is blank, and the scheme and filename parts set as for the other constructor An instance of already connected to an OBEX server. Initialize an instance of this class given a scheme, a Bluetooth Device Address, and a remote path name. - The Uri scheme. One of obex, obex-push, obex-ftp, or obex-sync. The Bluetooth Device Address of the OBEX server. The path on the OBEX server. Initialize an instance of this class given a Bluetooth Device Address, and a remote path name. - This is equivalent to calling ObexWebRequest(String scheme, BluetoothAddress target, String path) with scheme “obex”. - The Bluetooth Device Address of the OBEX server. The path on the OBEX server. Specifies a collection of the name/value pairs that make up the OBEX headers. Gets or sets the method for the request. For Object Exchange the method code is mapped to the equivalent HTTP style method. For example "PUT", "GET" etc. "PUT" is the default value. There is new support for GET as of version 2.5. To use GET change the Method to "GET" and you must also use scheme "obex-ftp" in the URL instead of the usual "obex" -- unless you know that the default OBEX server you are connecting supports GET. For a PUT sample see the class documentation. For GET, see below. ' The host part of the URI is the device address, e.g. IrDAAddress.ToString(), ' and the file part is the OBEX object name. Dim addr As String = "112233445566" Dim uri As New Uri("obex-ftp://" & addr & "/HelloWorld.txt") Dim req As New ObexWebRequest(uri) req.Method = "GET" Dim rsp As ObexWebResponse = CType(req.GetResponse(), ObexWebResponse) Console.WriteLine("Response Code: {0} (0x{0:X})", rsp.StatusCode) Using content As Stream = rsp.GetResponseStream() ' Using a StreamReader to read text from the stream... Using rdr As New StreamReader(content) While True Dim line As String = rdr.ReadLine() If line Is Nothing Then Exit While Console.WriteLine(line) End While End Using End Using Gets or sets the value of the Type OBEX header. Gets or sets the Length OBEX header. This property is mandatory, if not set no data will be sent. If you use the helper method this value is automatically populated with the size of the file that was read. Not Supported - do not use, this will throw an exception. Gets or sets the time-out value for the method. - In versions 3.2 and earlier this property was ignored on Windows Mobile. It is now (untested!) supported there, but not with the Microsoft Bluetooth stack there as it doesn't support timeouts. A cunning solution is available let me know of your requirements... - The number of milliseconds to wait before the request times out. The default is 50,000 milliseconds (50 seconds). A value of -1 or 0 represents no time-out. Gets the original Uniform Resource Identifier (URI) of the request. For an ObexPush request the URI will use the "obex://" prefix, followed by the numerical device id in hex format. The path section of the URI represents the remote filename of the pushed object. Subfolders are not supported. Some devices may only support specific object types e.g. V-Card. Gets a object to use to write request data. - A to use to write request data. Reads the contents of the specified file to the request stream. The filename (including the path) from which to read. Provides an easy equivalent to manually writing the file contents to the request stream. Returns the OBEX server response. - An . - An error occurred, with the error that occured being stored in the property. If the error occurred in the connect phase then the property will have value , and in the operation phase on the desktop CLR it will have value A wrapper for Stream.Read that blocks until the requested number of bytes have been read, and throw an exception if the stream is closed before that occurs. A wrapper for Stream.Read that blocks until the requested number of bytes have been read or the end of the Stream has been reached. Returns the number of bytes read. Begins a request for a OBEX server response. - An delegate that references the method to invoke when the operation is complete. A user-defined object containing information about the operation. This object is passed to the callback delegate when the operation is complete. - An that represents the asynchronous operation, which could still be pending. Begins a request for a OBEX server response. - An object that was obtained when the asynchronous operation was started. - An . - An error occurred, with the error that occured being stored in the property. If the error occurred in the connect phase then the property will have value , and in the operation phase on the desktop CLR it will have value Used to create a new web request for obex uri scheme Provides an OBEX implementation of the class. Gets the headers associated with this response from the server. Gets the length of the content returned by the request. Gets the content type of the response. Returns a status code to indicate the outcome of the request. - Note, if a error occurs locally then the status code is returned. Therefore that error code could signal local or remote errors. Gets the stream used to read the body of the response from the server. - A containing the body of the response. Frees the resources held by the response. Writes the contents of the response to the specified file path. The filename (including the path) from which to read. Get the normal first line of Exception.ToString(), that is without the stack trace lines. - Get the normal first line of Exception.ToString(), that is including details of all inner exceptions, but without the stack trace lines. e.g. System.IO.IOException: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine. - The exception. - A string containing the first line of the Exception.ToString(). Contains helper functionality. Specifies that the URI is accessed through the Object Exchange (OBEX) protocol. Specifies that the URI is accessed through the Object Exchange (OBEX) Push protocol. Specifies that the URI is accessed through the Object Exchange (OBEX) FTP protocol. Specifies that the URI is accessed through the Object Exchange (OBEX) Sync protocol. NETCF doesn't have For use on NETCFv2 - Initializes a new instance of the class - The filename of the log file to write to. Unlike the .NET supplied class this filename is relative to the folder that the calling assembly is located in. Provides a form to select an available Bluetooth device. Initializes an instance of the class. Resets the properties of the to their default values. Specifies a common dialog box. A value that represents the window handle of the owner window for the common dialog box. true if the dialog box was successfully run; otherwise, false. If TRUE, invokes the Add New Device Wizard. Supported only on Windows XP/Vista with Microsoft stack. If TRUE, skips the Services page in the Add New Device Wizard. Supported only on Windows XP/Vista with Microsoft stack. Gets or sets the information text. Array of class of devices to find. Clear the collection to return all devices. Gets the selected Bluetooth device. If TRUE, authenticated devices are shown in the picker. If TRUE, remembered devices are shown in the picker. If TRUE, unknown devices are shown in the picker. If TRUE, forces authentication before returning. If TRUE, only devices which are currently discoverable are shown in the picker. Does not work on the Microsoft stack on desktop Windows. There, when true the dialog will not open and will return an error to the caller. Obsolete, use instead. If TRUE, only devices which are currently discoverable are shown in the picker. Obsolete, use instead. Set a function that will be called for each device that returns whether to include the device in the list or not. - The function to call for each device. The function should returns true if the device is to be included or false if not. Pass null to the property to clear the filter function. - The callback method is called for each device as it is being added to the dialog box. If the function returns false it won't be added, otherwise it will be added and displayed. The information about each device is provided as a instance which will contain all the information about the device that the discovery process knows and will also include any information from the remembered/authenticated/paired devices. Note that prior to Bluetooth v2.1 a separate query has to be carried out to find whether the device also has a name, so unless both devices are v2.1 or later then it's likely that the name won't be included in the first discovery. - '...... Dim dlg As New InTheHand.Windows.Forms.SelectBluetoothDeviceDialog() dlg.DeviceFilter = AddressOf FilterDevice Dim rslt As DialogResult = dlg.ShowDialog() '...... Shared Function FilterDevice(ByVal dev As BluetoothDeviceInfo) As Boolean Dim rslt As DialogResult = MessageBox.Show("Include this device " & dev.DeviceAddress.ToString & " " & dev.DeviceName, "FilterDevice", MessageBoxButtons.YesNo) Dim ret As Boolean = (DialogResult.Yes = rslt) Return ret End Function Managed code dialog for Windows CE systems. Clean up any resources being used. Required method for Designer support - do not modify the contents of this method with the code editor. NETCF Version of: Creates an array of new Process components and associates them with all the process resources on the local computer that share the specified process name. - e.g. "BTExplorer" - An array of type that represents the process resources running the specified application or file.