In infra-red communication, we know, the DeviceID of equipment is array of a Byte, where is the DeviceID what appearance of equipment of so blue tooth? I think this authority is very clear, be a string with “ : Of ” space 16 into make a number.
In infra-red communication, generally speaking is infra-red do not have the open, position that closes and so on, but blue tooth has open, shut, can discover 3 kinds of condition.
Infra-red install without safety, and blue tooth has safe setting, so we need to have pair to blue tooth equipment, and infra-red communication needs this.
The Socket that we examine.net has IrDA in address a group of things with common features, but without the address related blue tooth a group of things with common features, this is the issue that we need to solve.
3. Get equipment ID
1. Get the ID of this locality equipment
We examine the SDK documentation of Window CE 4.2, be informed the function that gets ID of this locality equipment is BthReadLocalAddr, in Btdrt.dll. The English in SDK documentation is textual be such: “This Function Retrieves The Bluetooth Address Of The Current Device. ” is good, it is good to knew this said:
Enclose this locality above all mandatory function:
[DllImport("Btdrt.dll" , setLastError=true) ]
Public Static Extern Int BthReadLocalAddr(byte[] PBa);
This locality DeviceID that this function gets also is array of a group of Byte, come out to show to people, we should turn into it String:
String Text1 = "" ;
Text1 = Text1 Pba[5].ToString("X2" ) " :" ;
Text1 = Text1 Pba [4].ToString("X2" ) " :" ;
Text1 = Text1 Pba [3].ToString("X2" ) " :" ;
Text1 = Text1 Pba [2].ToString("X2" ) " :" ;
Text1 = Text1 Pba [1].ToString("X2" ) " :" ;
Return (text1 Pba [0].ToString("X2" ));
2. Get the ID of long-range equipment
Speak of the ID that gets long-range equipment be being involved actually how to go discovering long-range equipment, so here also explained along with all the others. Discover equipment needs to use 3 Winsock API, it is WSALookupServiceBegin, WSALookupServiceNext and WSALookupServiceEnd respectively, these 3 API remove what action to be able to examine the SDK of Windows CE 4.2 after all, here did not explain in detail, talk about a few places that need an attention only.
The function original shape of WSALookupServiceBegin is such:
INT WSALookupServiceBegin(
LPWSAQUERYSET LpqsRestrictions,
DWORD DwControlFlags,
LPHANDLE LphLookup
) ;
We undertake packing with mandatory code:
[DllImport("ws2.dll" , entryPoint= "WSALookupServiceBegin" , setLastError=true) ]
Public Static Extern Int CeLookupServiceBegin(byte[] PQuerySet, lookupFlags DwFlags, ref Int LphLookup);
Can see, original LpqsRestrictions is a Struct, after the course is packed, Byte[] was become in mandatory code, we had been calculated this Struct should take up probably how many Byte, each member in Struct is in the position in Byte array is what kind of, assemble it is good to come out.
Previous 1 23 Next