User Manual

57
CATC MERLINS WAND 1.22 CHAPTER 5
User’s Manual Script Manager
sample.script
This script demonstrates several common Merlin’s Wand functions.
Main()
{
Trace("Registering a server channel...\n");
rfChannel = RFRegisterServerChannel();
Trace("Server channel: ", rfChannel, "\n\n");
# Add a profile if we got a server channel
if(rfChannel != "Failure")
{
result = SDPAddProfileServiceRecord(rfChannel,
"ObjectPush");
Trace("SDPAddProfileServiceRecord returned ", result,
"\n");
}
Trace("Performing inquiry...\n");
Devices = DoInquiry();
Trace(Devices, "\n");
class = GetDeviceClass();
Trace("Device class is: ", class, "\n");
# Set a new device class
SetDeviceClass(0x010203);
class = GetDeviceClass();
Trace("Device class is now: ", class, "\n");
# Get the names
index = 0;
while(device = Devices[index])
{
deviceName = GetRemoteDeviceName(device);
Trace("Device ", index, ": ", deviceName, "\n");
index = index + 1;
}
# Read the current accessible mode
Trace("Current accessible mode is: ",
HCIReadScanEnable(), "\n");
# Set the accessible mode
result = HCIWriteScanEnable("GENERAL_ACCESSIBLE");
Trace("HCIWriteScanEnable returned ", result, "\n");