Computer Access Technology BT004APA-X Bluetooth Protocal Analyzer and Test Generator User Manual WAND Manual 2 of 2
Computer Access Technology Corporation Bluetooth Protocal Analyzer and Test Generator WAND Manual 2 of 2
Contents
- 1. Main User Manual
- 2. WAND Manual 1 of 2
- 3. WAND Manual 2 of 2
WAND Manual 2 of 2






















![157CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsExampleresult = Connect(Devices[0]);if(result != "Success"){MessageBox("Failed to connect!");}Disconnect()Disconnect(Address)Return value• “Success”• “Failure”• “Timed out”CommentsCloses the ACL connection with the specified deviceExampleresult = Disconnect(Devices[0]);if(result != "Success"){MessageBox("Failed to disconnect!");}DoInquiry()DoInquiry(IAC, Timeout)Parameter Meaning Default Value CommentsAddress Bluetooth address of device to con-nect withParameter Meaning Default Value CommentsIAC Inquiry Access CodeGIAC “GIAC”, or a 32-bit integer valueTimeout Timeout in units of 1.2 seconds5](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-23.png)
![158CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsReturn valueArray of Bluetooth addresses that were found during the inquiry.CommentsCalling DoInquiry() will block for the duration specified by Timeout. The function returns an array of devices that were found during the inquiry. These can be addressed individually.The current version of Merlin's Wand hardware only supports GIAC inquiries.Example# Use default parametersDevices = DoInquiry();Trace("First device was: ", Devices[0]);GetDeviceClass()GetDeviceClass()Return value• Class of device• “Failure”CommentsReturns the current device class of Merlin’s WandExampleTrace("Merlin's Wand device class: ", GetDeviceClass());GetRemoteDeviceName()GetRemoteDeviceName(Address)Parameter Meaning Default Value CommentsN/AParameter Meaning Default Value CommentsAddress Bluetooth address of device in question](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-24.png)
![159CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsReturn value• Device name• “Not connected”• “Failure”CommentsQueries the specified device for its name.An ACL connection must be established before calling GetRemoteDevice-Name().ExampleTrace("Device ", Devices[0], "is named ", GetRemoteDeviceName(Devices[0]));MessageBox()MessageBox(Message, Caption)Return valueNone.CommentsBring up a simple message box function with one “OK” button. This is a good way to pause execution of the script or indicate errors.ExampleMessageBox("Failed to connect", "Connection Failure");SetDeviceClass()SetDeviceClass(Class)Parameter Meaning Default Value CommentsMessage Text to display in the mes-sage boxCaption Caption of the message box“Script Mes-sage”Parameter Meaning Default Value CommentsClass Device class for Merlin's WandDevice class is a 3-byte value](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-25.png)



![163CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsData (element 2) is the raw data received in the transaction. Valid only if result is “Success”.CommentsReads the specified amount of data from an open pipe.Exampleresult = ReadPipe("Data1", "Receive", 1024);if(result[0] == "Success"){Trace("Read ", result[1], "bytes:\n");Trace(result[2]);}WritePipe()WritePipe(PipeName, Data)Return value• “Success”• “Failure”• “Pipe not found”• “Pipe not open”• “Not supported”CommentsWrites data to the specified pipe. Note that only “Receive” pipes can be written to.Exampleresult = WritePipe("Data1", "This is a string written to a pipe");result = WritePipe("Data1", '3C7EFFFF7E3C');result = WritePipe("Data1", 0x01020304);Parameter Meaning Default Value CommentsPipeName Name of the data pipe to openData Data to write to the pipeThis can be a string, integer, list or raw data.](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-29.png)
![164CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsC.4 HCI CommandsHCIAcceptConnectionRequest()HCIAcceptConnectionRequest()Return value• “Success”CommentsSets the accept connection request variable to True.Examplestatus = HCIAcceptConnectionRequest();HCIAddSCOConnection()HCIAddSCOConnection(Address, Type)Return value• “Success”• “Not connected”• “Not supported”• “Failure”CommentsAttempts to establish an SCO connection with the specified device.An ACL connection must already be established with the device before calling HCIAddSCOConnection.Parameter Meaning Default Value CommentsN/AParameter Meaning Default Value CommentsAddress Bluetooth address of device to con-nect withType Type of SCO connection to establish[“HV3”] A list of one or more of the following strings:“DM1”, “HV1”, “HV3” or “DV”](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-30.png)
![165CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsExampleresult = HCIAddSCOConnection(Devices[0], ["DM1", "HV1"]);if(result != "Success"){MessageBox(result, "Failed to add SCO connection!");}HCIAuthenticationRequested()HCIAuthenticationRequested(Address)Return value• “Success”• “Failure”• “Failed: Device not found”• “Timed Out”• “Not connected”CommentsAttempts to authenticate an existing link with the specified device.Exampleresult = HCIAuthenticationRequested (Devices[0]);if(result != "Success"){MessageBox(result, "Failed to authenticate!");}HCICatcBerTest()HCICatcBerTest(Address, NumberOfPackets, BERPacketType, TestDataType, TestData, BERInterval)Parameter Meaning Default Value CommentsAddress Bluetooth address of device to authenticate withA connection must exist with this device for an authentication request to work.Parameter Meaning Default Value CommentsAddress Bluetooth address of the remote device](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-31.png)

![167CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsReturn value• “Success”• “Failure”• “Not connected”• “No SCO connection”CommentsThis command is used to change gain of connected speaker or microphone. In order to use this command, an SCO connection must exist.ExampleMain(){result = Connect('00803713BDF0');Trace("Connection result : ", result, "\n");if( result == "Success"){result = HCIAddSCOConnection( '00803713BDF0', ["HV1"]);Trace("SCO Connection result : ", result, "\n");if( result == "Success"){index = 0;while(index < 16){result = HCICatcChangeHeadsetGain("Speaker", index);Trace("Change speaker gain: ", result, "\n");result = HCICatcReadHeadsetGain("Speaker", index);Trace("Read speaker gain: ", result, "\n");index = index + 1;Sleep(2000);}index = 0;while(index < 16){result = HCICatcChangeHeadsetGain("Microphone", index);Trace("Change microphone gain: ", result, "\n");result = HCICatcReadHeadsetGain("Microphone");Trace("Read microphone gain : ", result, "\n");index = index + 1;Gain New gain of the deviceValues: 0 – 0xFParameter Meaning Default Value Comments](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-33.png)

![169CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting Commands• “Success”• “Failure”• “Not found”• “No SCO connection”Gain (element 1) is the one-byte value of the headset gain. Range is 0 to 15.CommentsThis command is used to read current gain of connected speaker or micro-phone. In order to use this command, an SCO connection must exist.ExampleSee the example for the HCICatcChangeHeadsetGain command.HCICatcReadRevisionInformation()HCICatcReadRevisionInformation()Return valuesReturns a list with two values: status and revision.Status (element 0) is one of the following:• “Success”• “Failure”Revision (element 1) is the Merlin’s Wand revision information.CommentsThis command returns the information about the current firmware.ExampleRevision = HCICatcReadRevisionInformation();if( Revision[0] == "Success")Trace("Merlin's Wand Revision Info : ", Revision[1], "\n");Parameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-35.png)



![173CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsExampleresult = HCIChangeConnectionPacketType('00803713BDF0', ["DM3","DM5"]);Trace("Change Connection Packet Type:\n");Trace(" Status ", result[0], "\n");HCIChangeLocalName()HCIChangeLocalName(Name)Return value• “Success”• “Failure”CommentsAttempts to change the name of the local device.Exampleresult = HCIChangeLocalName("Joe's Device");if(result != "Success"){MessageBox(result, "Failed to change name!");}HCIDeleteStoredLinkKey()HCIDeleteStoredLinkKey(Address, DeleteAll)Parameter Meaning Default Value CommentsName String that contains the new name for the local deviceParameter Meaning Default Value CommentsAddress Bluetooth address of device that will have its link key deleted](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-39.png)



![177CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsHCIMasterLinkKey()HCIMasterLinkKey(KeyFlag)Return valuesReturns a list with three values: status, HCI handle, and key flag.Status (element 0) is one of the following:• “Success”• “Failure”HCI handle (element 1) is the handle for the ACL connection.Key flag (element 2) is the key flag (either 0 or 1).CommentsThis command is used to force the master of the piconet to use temporary or semi-permanent link keys.Exampleresult = HCIMasterLinkKey(0);Trace("Merlin's Wand MasterLinkKey returned:", result[0], "\n");if(result[0] == "Success"){Trace(" Connection Handle : 0x", result[1], "\n");Trace(" Key Flag : 0x", result[2], "\n");}HCIParkMode()HCIParkMode(Address, BeaconMaxInterval, BeaconMinInterval)Parameter Meaning Default Value CommentsKeyFlag 0x0 use semi-permanent link keys0x1 use temporary link keysParameter Meaning Default Value CommentsAddress Bluetooth address of device in question](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-43.png)



![181CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsToken rate (element 4) is the four-byte token rate value in bytes per second.Peak bandwidth (element 5) is the four-byte peak bandwidth value in bytes per second.Latency (element 6) is the four-byte latency value in microseconds.Delay variation (element 7) is the four-byte delay variation value in micro-seconds.CommentsThis command is used to specify Quality of Service parameters for the con-nection.ExampleQoS = HCIQoSSetup('00803713BDF0', 2, 0, 0, 0x12345678, 0x23456789);Trace("Merlin's Wand Link QoS Setup returned: ", QoS[0], "\n");if (QoS[0] == "Success"){Trace(" Connection Handle : 0x", QoS[1], "\n");Trace(" Flags : 0x", QoS[2], "\n");Trace(" Service Type : 0x", QoS[3], "\n");Trace(" Token Rate : 0x", QoS[4], "\n");Trace(" Peak Bandwidth : 0x", QoS[5], "\n");Trace(" Latency : 0x", QoS[6], "\n");Trace(" Delay Variation : 0x", QoS[7], "\n\n");}HCIReadAuthenticationEnable()HCIReadAuthenticationEnable()Return valuesReturns a list with two values: status and authentication enable.Status (element 0) is one of the following:• “Success”• “Failure”Authentication enable (element 1) is the one-byte authentication enable value. (0=Authentication disabled; 1=Authentication enabled.)Parameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-47.png)
![182CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsCommentsThis command will read the value for AuthenticationEnable parameter.Exampleresult = HCIReadAuthenticationEnable();if(result[0] == "Success")Trace("Merlin's Wand Authentication Enabled : ", result[1], "\n");HCIReadBDADDR()HCIReadBDADDR()Return valuesReturns a list with two values: status and address.Status (element 0) is one of the following:• “Success”• “Failure”Address (element 1) is the address of the local device.CommentsThis command is used to read the value for the BD_ADDR parameter. The BD_ADDR is a 48-bit unique identifier for a Bluetooth device.ExampleLocalAddress = HCIReadBDADDR();if(LocalAddress [0] == "Success")Trace("Local BDADDR:", LocalAddress[1], "\n");HCIReadBufferSize()HCIReadBufferSize()Return valuesReturns a list with five values: status, ACL packet length, SCO packet length, ACL number of packets, and SCO number of packets.Parameter Meaning Default Value CommentsN/AParameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-48.png)
![183CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsStatus (element 0) is one of the following:• “Success”• “Failure”ACL packet length (element 1) is the two-byte value of the maximum length (in bytes) of the data portion of each HCI ACL data packet that the Host Controller is able to accept.SCO packet length (element 2) is the one-byte value of the maximum length (in bytes) of the data portion of each HCI SCO data packet that the Host Controller is able to accept.ACL number of packets (element 3) is the total number of HCI ACL data packets that can be stored in the data buffers of the Host Controller.SCO number of packets (element 4) is the total number of HCI SCO data packets that can be stored in the data buffers of the Host Controller.CommentsThis command is used to read the maximum size of the data portion of SCO and ACL data packets sent from the Host to Host Controller.ExampleTrace("Local Buffer parameters\n");result = HCIReadBufferSize();Trace(" HCIReadBufferSize() returned: ", result[0], "\n");if (result[0] == "Success"){Trace(" ACL Data Packet Length : 0x", result[1], "\n");Trace(" SCO Data Packet Length : 0x", result[2], "\n");Trace(" Total Num ACL Data Packets : 0x", result[3], "\n");Trace(" Total Num SCO Data Packets : 0x", result[4], "\n");}](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-49.png)
![184CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsHCIReadClockOffset()HCIReadClockOffset(Address)Return valuesReturns a list with two values: status and offset.Status (element 0) is one of the following:• “Success”• “Failure”• “Failed: Device not found”• “Not connected”Offset (element 1) is the two-byte value of the clock offset.CommentsReads the clock offset to remote devices.Exampleresult = HCIReadClockOffset();Trace("HCIReadClockOffset returned: ", result[0], "\n");if (result[0] == "Success"){Trace("Clock offset is: 0x", result[1], "\n");}HCIReadConnectionAcceptTimeout()HCIReadConnectionAcceptTimeout()Return valuesReturns a list with two values: status and timeout.Status (element 0) is one of the following:• “Success”• “Failure”Parameter Meaning Default Value CommentsAddress Bluetooth address of device to con-nect with.Parameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-50.png)
![185CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsTimeout (element 1) is the two-byte value of the timeout, interpreted as multiples of 0.625-msec intervals.CommentsReads the current timeout interval for connection. The timeout value defines the time duration from when the Host Controller sends a Connec-tion Request event until the Host Controller automatically rejects an incoming connection.Exampleresult = HCIReadConnectionAcceptTimeout();Trace("ReadConnectionAcceptTimeout returned: ", result[0], "\n");if (result[0] == "Success"){Trace("Timeout value is: 0x", result[1], "\n");}HCIReadCountryCode()HCIReadCountryCode()Return valuesReturns a list with two values: status and country code.Status (element 0) is one of the following:• “Success”• “Failure”Country code (element 1) is the one-byte country code value. (0=North America and Europe; 1=France.)CommentsReads the country code value. This value defines which range of frequency band of the ISM 2.4-GHz band is used by the device.Exampleresult = HCIReadCountryCode();Trace("HCIReadCountryCode returned: ", result[0], "\n");if (result[0] == "Success"){Parameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-51.png)
![186CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsTrace("Country code is: 0x", result[1], "\n");}HCIReadCurrentIACLAP()HCIReadCurrentIACLAP()Return valueReturns a list with two values: status and Current IAC LAP.Status (element 0) is one of the following:• “Success”• “Failure”Current IAC LAP (element 1) is the 3-byte value of the LAPs (Lower Address Part) that make up the current IAC (Inquiry Access Code).CommentsReads the number and values of the currently used IAC LAPs.Exampleresult = HCIReadCurrentIACLAP();if(result[0] == "Success"){Trace("Current number of used IAC LAPs is: ", result[1], "\n");if(result[1] > 0){Trace("Currently used IAC LAPs are:");for(i = 0; i < result[1]; i = i + 1){Trace(" 0x", result[2 + i]);}Trace("\n\n");}}Parameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-52.png)
![187CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsHCIReadEncryptionMode()HCIReadEncryptionMode()Return valuesReturns a list with two values: status and encryption mode.Status (element 0) is one of the following:• “Success”• “Failure”Encryption mode (element 1) is the one-byte encryption mode value. (0=Encryption disabled; 1=Encryption enabled for point-to-point packets only; 2=Encryption enabled for both point-to-point and broadcast packets.)CommentsReads the encryption mode value. This value controls whether the local device requires encryption to the remote device at connection setup.Exampleresult = HCIReadEncryptionMode();Trace("HCIReadEncryptionMode returned: ", result[0], "\n");if (result[0] == "Success"){Trace("Encryption mode is: 0x", result[1], "\n");}HCIReadLinkPolicySettings()HCIReadLinkPolicySettings(Address)Return valueReturns the following list of values: status and link policy settings.Status (element 0) is one of the following:• “Success”Parameter Meaning Default Value CommentsN/AParameter Meaning Default Value CommentsAddress Bluetooth address of device in question](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-53.png)
![188CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting Commands• “Failure”• “Failed: Device not found”• “Not connected”Link policy settings (element 1) is the two-byte value of the link policy set-tings.CommentsReads the value of the Link_Policy_Settings parameter for the device.ExampleDevice = '010203040506';result = HCIReadLinkPolicySettings(Device);Trace("HCIReadLinkPolicySettings returned: ", result[0], "\n");if (result[0] == "Success"){Trace("Link Policy Settings : ", result[1] ,"\n");}HCIReadLinkSupervisionTimeout()HCIReadLinkSupervisionTimeout(Address)Return valueReturns the following list of values: status and link supervision timeout.Status (element 0) is one of the following:• “Success”• “Failure”• “Failed: Device not found”• “Not connected”Link supervision timeout (element 1) is the timeout, interpreted as multi-ples of 0.625-msec intervals.CommentsReads the value for the Link_Supervision_Timeout parameter for the device. Parameter Meaning Default Value CommentsAddress Bluetooth address of device in question](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-54.png)
![189CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsExampleDevice = '010203040506';result = HCIReadLinkSupervisionTimeout(Device); Trace("HCIReadLinkSupervisionTimeout returned: ", result[0], "\n");if (result[0] == "Success"){Trace("Link Supervision Timeout is: ", result[1] ,"\n");}HCIReadLocalName()HCIReadLocalName()Return valuesReturns a list with two values: status and name.Status (element 0) is one of the following:• “Success”• “Failure”Name (element 1) is a string representing the device name.CommentsReads the “user-friendly” name of the local Bluetooth device.Exampleresult = HCIReadLocalName();Trace("HCIReadLocalName returned: ", result[0], "\n");if (result[0] == "Success"){Trace("Local device name is: ", result[1], "\n");}HCIReadLocalSupportedFeatures()HCIReadLocalSupportedFeatures()Parameter Meaning Default Value CommentsN/AParameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-55.png)
![190CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsReturn valuesReturns a list with two values: status and features.Status (element 0) is one of the following:• “Success”• “Failure”Features (element 1) is the eight-byte bit mask list of Link Manager Proto-col features.CommentsReads the LMP supported features for the local device.Exampleresult = HCIReadLocalSupportedFeatures();Trace("HCIReadLocalSupportedFeatures returned: ", result[0], "\n");if (result[0] == "Success"){Trace("Local supported features data is: ", result[1], "\n");}HCIReadLocalVersionInformation()HCIReadLocalVersionInformation()Return valuesReturns a list with six values: status, HCI version, HCI revision, LMP ver-sion, manufacturer name, and LMP subversion.Status (element 0) is one of the following:• “Success”• “Failure”HCI version (element 1) is the one-byte HCI version value. (0=1.0B, 1=1.1.)HCI revision (element 2) is the two-byte HCI revision value.LMP version (element 3) is the one-byte Link Manager Protocol version value.Parameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-56.png)
![191CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsManufacturer name (element 4) is the two-byte manufacturer name of the Bluetooth hardware.LMP subversion (element 5) is the two-byte Link Manager Protocol sub-version value.CommentsReads the version information for the local device.Exampleresult = HCIReadLocalVersionInformation();Trace("HCIReadLocalVersionInformation returned: ", result[0], "\n");if (result[0] == "Success"){Trace("HCI version is: 0x", result[1], "\n");Trace("HCI revision is: 0x", result[2], "\n");Trace("LMP version is: 0x", result[3], "\n");Trace("Manufacturer name is: 0x", result[4], "\n");Trace("LMP subversion is: 0x", result[5], "\n");}HCIReadLoopbackMode()HCIReadLoopbackMode()Return valuesReturns a list with two values: status and loopback mode.Status (element 0) is one of the following:• “Success”• “Failure”Loopback mode (element 1) is the one-byte loopback mode value. (0=No loopback mode; 1=Local loopback mode; 2=Remote loopback mode.)CommentsReads the loopback mode value. This value determines the path by which the Host Controller returns information to the Host.Exampleresult = HCIReadLoopbackMode();Trace("HCIReadLoopbackMode returned: ", result[0], "\n");Parameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-57.png)
![192CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting Commandsif (result[0] == "Success"){Trace("Loopback mode is: 0x", result[1], "\n");}HCIReadNumberOfSupportedIAC()HCIReadNumberOfSupportedIAC()Return valueReturns a list with two values: status and number of supported IAC.Status is one of the following:• “Success”• “Failure”Number of supported IAC is a 1-byte value that specifies the number of Inquiry Access Codes that the local Bluetooth device can listen for at one time.CommentsReads the number of supported IACs.Exampleresult = HCIReadNumberOfSupportedIAC ();Trace("HCIReadNumberOfSupportedIAC returned: ", result[0], "\n");if (result[0] == "Success"){Trace("The number of supported IAC is: ", result[1], "\n\n");}HCIReadPageScanMode()HCIReadPageScanMode()Parameter Meaning Default Value CommentsN/AParameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-58.png)
![193CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsReturn valuesReturns a list with two values: status and page scan mode.Status (element 0) is one of the following:• “Success”• “Failure”Page scan mode (element 1) is the one-byte page scan mode value. (0=Mandatory page scan mode; 1=Optional page scan mode I; 2=Optional page scan mode II; 3=Optional page scan mode III.)CommentsReads the page scan mode value. This value indicates the mode used for default page scan.Exampleresult = HCIReadPageScanMode();Trace("HCIReadPageScanMode returned: ", result[0], "\n");if (result[0] == "Success"){Trace("Page scan mode is: 0x", result[1], "\n");}HCIReadPageScanPeriodMode()HCIReadPageScanPeriodMode()Return valuesReturns a list with two values: status and page scan period mode.Status (element 0) is one of the following:• “Success”• “Failure”Page scan period mode (element 1) is the one-byte page scan period mode value. (0=P0; 1=P1; 2=P2.)CommentsReads the page scan period mode value. Each time an inquiry response message is sent, the Bluetooth device will start a timer, the value of which depends on the page scan period mode.Parameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-59.png)
![194CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsExampleresult = HCIReadPageScanPeriodMode();Trace("HCIReadPageScanPeriodMode returned: ", result[0], "\n");if (result[0] == "Success"){Trace("Page scan period mode is: 0x", result[1], "\n");}HCIReadPageTimeout()HCIReadPageTimeout()Return valuesReturns a list with two values: status and page timeout.Status (element 0) is one of the following:• “Success”• “Failure”Page timeout (element 1) is the two-byte page timeout value, in increments of 0.625-msec intervals.CommentsReads the page timeout value. This value defines the maximum time the local Link Manager will wait for a baseband page response from the remote device at a locally initiated connection attempt.Exampleresult = HCIReadPageTimeout();Trace("HCIReadPageTimeout returned: ", result[0], "\n");if (result[0] == "Success"){Trace("Page timeout is: 0x", result[1], "\n");}Parameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-60.png)
![195CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsHCIReadPINType()HCIReadPINType()Return valuesReturns a list with two values: status and PIN type.Status (element 0) is one of the following:• “Success”• “Failure”PIN type (element 1) is the one-byte PIN type. (0=Variable PIN; 1=Fixed PIN.)CommentsReads the PIN type, which determines whether the Host supports variable PIN codes or only a fixed PIN code.Exampleresult = HCIReadPINType();Trace("HCIReadPINType returned: ", result[0], "\n");if (result[0] == "Success"){Trace("PIN type is: 0x", result[1], "\n");}HCIReadRemoteSupportedFeatures()HCIReadRemoteSupportedFeatures(Address)Return valuesReturns a list with two values: status and features.Status (element 0) is one of the following:• “Success”• “Failure”Parameter Meaning Default Value CommentsN/AParameter Meaning Default Value CommentsAddress Bluetooth address of device to con-nect with.](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-61.png)
![196CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting Commands• “Failed: Device not found”• “Not connected”Features (element 1) is the eight-byte bit mask list of Link Manager Proto-col features.CommentsReads the LMP supported features for the specified device. An ACL con-nection with the device is required.ExampleDevice = '010203040506';result = HCIReadRemoteSupportedFeatures(Device);Trace("HCIReadRemoteSupportedFeatures returned: ", result[0], "\n");if (result[0] == "Success"){Trace("Remote supported features data is: 0x", result[1], "\n");}HCIReadRemoteVersionInformation()HCIReadRemoteVersionInformation(Address)Return valuesReturns a list with four values: status, LMP version, manufacturer name, and LMP subversion.Status (element 0) is one of the following:• “Success”• “Failure”• “Failed: Device not found”• “Not connected”LMP version (element 1) is the one-byte Link Manager Protocol version value.Manufacturer name (element 2) is the two-byte manufacturer name of the Bluetooth hardware.Parameter Meaning Default Value CommentsAddress Bluetooth address of device to con-nect with.](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-62.png)
![197CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsLMP subversion (element 3) is the two-byte Link Manager Protocol sub-version value.CommentsReads the version information for the specified device. An ACL connec-tion with the device is required.ExampleAddress = '010203040506';result = HCIReadRemoteVersionInformation(Address);Trace("HCIReadRemoteVersionInformation returned: ", result[0], "\n");if (result[0] == "Success"){Trace("LMP version is: 0x", result[1], "\n");Trace("Manufacturer name is: 0x", result[2], "\n");Trace("LMP subversion is: 0x", result[3], "\n");}HCIReadScanEnable()HCIReadScanEnable()Return value• “GENERAL_ACCESSIBLE”• “LIMITED_ACCESSIBLE”• “NOT_ACCESSIBLE”• “CONNECTABLE_ONLY”• “Failure”CommentsRetrieves the current accessible mode of Merlin’s Wand.ExampleTrace("Merlin's Wand accessible mode: ", HCIReadScanEnable());Parameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-63.png)
![198CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsHCIReadSCOFlowControlEnable()HCIReadSCOFlowControlEnable()Return valuesReturns a list with two values: status and SCO flow control enable.Status (element 0) is one of the following:• “Success”• “Failure”SCO flow control enable (element 1) is the one-byte SCO flow control value. (0=SCO flow control disabled; 1=SCO flow control enabled.)CommentsReads the SCO flow control enable value. This value determines whether the Host Controller will send Number Of Completed Packets events for SCO Connection Handles.Exampleresult = HCIReadSCOFlowControlEnable();Trace("HCIReadSCOFlowControlEnable returned: ", result[0], "\n");if (result[0] == "Success"){Trace("SCO flow control enable is: 0x", result[1], "\n");}HCIReadStoredLinkKey()HCIReadStoredLinkKey(Address, ReadAll)Parameter Meaning Default Value CommentsN/AParameter Meaning Default Value CommentsAddress Bluetooth address of device that will have its link key read](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-64.png)
![199CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsReturn valuesReturns a list with two values: status and data.Status (element 0) is one of the following:• “Success”• “Failure”Data (element 1) is a list containing zero or more pairs of the following two values:• BDADDR: the Bluetooth Address that the link key corresponds to• LinkKey: the link key for the specified addressCommentsAttempts to read the stored link key for the specified address or for all addresses, depending on the value of ReadAll.Exampleresult = HCIReadStoredLinkKey('6E8110AC0008', 1);Trace("HCIReadStoredLinkKey() returned: ", result[0], "\n\n");if (result[0] == "Success"){list = result[1];i = 0;while (list[(i*2)] != null){Trace("************************\n");Trace("BDADDR: ", list[(i*2)], "\n");Trace("Link Key: ", list[(i*2)+1], "\n");Trace("************************\n");i = i + 1;}}ReadAll Boolean value that indicates whether to read only the specified address's link key, or all link keys00 or 1Parameter Meaning Default Value Comments](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-65.png)
![200CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsHCIReadVoiceSetting()HCIReadVoiceSetting()Return valuesReturns a list with two values: status and voice setting.Status (element 0) is one of the following:• “Success”• “Failure”Voice setting (element 1) is the 10-bit voice setting value.CommentsReads the voice setting value. This value controls all settings for voice con-nections.Exampleresult = HCIReadVoiceSetting();Trace("HCIReadVoiceSetting returned: ", result[0], "\n");if (result[0] == "Success"){Trace("Voice setting is: 0x", result[1], "\n");}HCIRejectConnectionRequest()HCIRejectConnectionRequest()Return value• “Success”CommentsSets the accept connection request variable to False.Examplestatus = HCIRejectConnectionRequest();Trace("HCIRejectConnectionRequest returned: ", status, "\n\n");Parameter Meaning Default Value CommentsN/AParameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-66.png)
![201CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsHCIRemoveSCOConnection()HCIRemoveSCOConnection(Address)Return value• “Success”• “Not connected”• “Failure”CommentsRemoves an existing SCO connection associated with the specified device.Exampleresult = HCIRemoveSCOConnection(Devices[0]);HCIReset()HCIReset()Return value• “Success”• “Failure”• “Invalid parameter”• “Failed: Invalid Type”• “Failed: HCI initialization error”CommentsResets the Host Controller and Link Manager.Exampleresult = HCIReset();Parameter Meaning Default Value CommentsAddress Bluetooth address of device to con-nect withParameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-67.png)


![204CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsReturn value• “Success”• “Failure”• “Invalid parameter”CommentsInstructs the Host Controller to send only certain types of events to the Host.Examples# Clear All Filtersresult = HCISetEventFilter(0);Trace("Result of clearing all filters: ", result, "\n");# Inquiry Resultresult = HCISetEventFilter(1, 2, [0xA,0x1,0x24,0x12,0xFB,0xAA]);Trace("Result of Inquiry Result filter: ", result, "\n");# Connection Setupresult = HCISetEventFilter(2, 0, [0x1]);Trace("Result of Connection Setup filter: ", result, "\n");HCISniffMode()HCISniffMode(Address, MaxInterval, MinInterval, Attempt, Timeout)Condition Details of the filter to be set.Must be entered as a series of bytes within brack-ets, e.g., [0x1, 0x12, 0x0F]. Byte values must be entered in hex notation separated by commas.Parameter Meaning Default Value CommentsAddress Bluetooth address of device in questionMaxInterval Maximum number of 0.625-msec intervals between sniff periods.Range is 0x0001 to 0xFFFF (0.625 msec to 40.9 sec).Parameter Meaning Default Value Comments](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-70.png)





![210CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsReturn value• “Success”• “Failure”• “Failed: Device not found”• “Not connected”CommentsWrites the value for the Link_Supervision_Timeout parameter for the device. ExampleDevice = '010203040506';result = HCIWriteLinkSupervisionTimeout(Device, 0x7D00);Trace("HCIWriteLinkSupervisionTimeout result is: ", result[0], "\n\n");HCIWriteLoopbackMode()HCIWriteLoopbackMode(LoopbackMode)Return value• “Success”• “Failure”• “Invalid parameter”CommentsDetermines the path by which the Host Controller returns information to the Host.Exampleresult = HCIWriteLoopbackMode(2);Parameter Meaning Default Value CommentsLoopbackModeLoopback mode:0 = No loop-back mode;1 = Local loopback mode;2 = Remote loopback mode;3-255 = Reserved0](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-76.png)



![214CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsC.5 OBEX CommandsOBEXClientConnect()OBEXClientConnect(Address)Return value• “Success”• “Failure”• “Failed: Busy”• “Failed: Not connected”• “Failed: Packet too small”CommentsEstablishes an OBEX client connection with the specified device.Exampleresult = OBEXClientConnect(Devices[0]);if(result != "Success"){MessageBox("Failed to establish OBEX connection.");}OBEXClientDeinit()OBEXClientDeinit()Return value• “Failure”CommentsThis command is obsolete. It is provided for backward compatibility only. (The application is initialized as an OBEX client at startup and cannot be deinitialized.)Parameter Meaning Default Value CommentsAddress Bluetooth address of device to con-nect withParameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-80.png)






![221CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsC.6 RFCOMM CommandsRFCloseClientChannel()RFCloseClientChannel(Address, DLCI)Return value• “Success”• “Not connected”• “Failure”• “Timed out”CommentsCloses an RFCOMM channelExampleRFCloseClientChannel(Devices[0], DLCI);RFOpenClientChannel()RFOpenClientChannel(Address, ServerID)Return valueThe return value from RFOpenClientChannel is a list containing up to two elements. The first element is the status of the command and is one of the following strings:Parameter Meaning Default Value CommentsAddress Bluetooth address of device DLCI Data link con-nection identi-fierThe DLCI is returned by RFOpenClientChan-nel()Parameter Meaning Default Value CommentsAddress Bluetooth address of deviceServerID Service ID for RFCOMM channel](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-87.png)
![222CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting Commands• “Success”• “Failure”• “Timed out”• “Not connected”•“Restricted”If the return value is “Success”, the second element in the list is the DLCI of the established connection.CommentsAn ACL connection must already be established with the device.Exampleresult = RFOpenClientChannel(Devices[0], 1);if(result[0] == "Success"){Trace("Successfully connected with DLCI ", result[1], "\n");# Send some data over RFCOMM}RFRegisterServerChannel()RFRegisterServerChannel()Return value• Server channel ID• “Failure”CommentsExamplechannel = RFRegisterServerChannel();if(channel != "Failure"){Trace("Channel ID is ", channel);}Parameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-88.png)
![223CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsRFSendData()RFSendData(Address, DLCI, Data)Return value• “Success”• “Timed out”• “Not supported” (invalid data type)• “Not connected”CommentsAn RFCOMM connection must already be established with the device.ExampleRFSendData(Devices[0], DLCI, "ATDT 555-1212");RFSendData("CONNECTED_DEVICE", dlci, "AT+CKPD=200\r\n");RFSendDataFromPipe()RFSendDataFromPipe(Address, DLCI, PipeName)Parameter Meaning Default Value CommentsAddress Bluetooth address of device Can use “CONNECTED_DEVICE” to send data to a master RFCOMM connection. Note that this will work only if exactly one device is connected via RFCOMM.DLCI Data link con-nection identi-fierThe DLCI is returned by RFOpenClientChan-nel()Data Data to send Data can be a string, 32-bit integer value or a list containing either or both typesParameter Meaning Default Value CommentsAddress Bluetooth address of device Can use “CONNECTED_DEVICE” to send data to a master RFCOMM connectionDLCI Data link con-nection identi-fierThe DLCI is returned by RFOpenClientChan-nel()PipeName Name of the transmit data pipe to get data to sendThis pipe must exist.](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-89.png)
![224CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsReturn value• “Success”• “Timed out”• “Not supported” (invalid data type)• “Not connected”• “Pipe not found”• “Internal Error”CommentsAn RFCOMM connection must already be established with the device. The pipe specified must already be set up in the Data Transfer Manager. The pipe should not be open when RFSendDataFromPipe is called.ExampleRFSendDataFromPipe(Devices[0], dlci, "MyPipe");RFSendDataFromPipe("CONNECTED_DEVICE", dlci, "Pipe2");RFReceiveData()RFReceiveData(Address, DLCI, Timeout)Return valueReturns a list with three values: status, number of bytes, and data array.Status (element 0) is one of the following:• “Success”• “Not connected”• “Timed out”Number of bytes (element 1) is the number of bytes received.Data array (element 2) is the sequence of data bytes received.Parameter Meaning Default Value CommentsAddress Bluetooth address of deviceCan use "CONNECTED_DEVICE" to receive data from a master RFCOMM connectionDLCI Data link con-nection identi-fierThe DLCI is returned by RFOpenClientChan-nel()Timeout Time in ms to wait for an RFCOMM connection0 (Infinite wait)Use 0 as the timeout value to wait infinitely](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-90.png)
![225CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsCommentsReceives data from a device connected via RFCOMM. Waits Timeout mil-liseconds (or infinitely if 0 is specified) for the device to begin sending data to Merlin's Wand.Example#Get the data; stop when no data is received for 5 secsresult = RFReceiveData(Device, DLCI, 5000);while(result[0] == "Success"){Trace("Number of data bytes received: ", result[1], "\n");result = RFReceiveData(Device, DLCI, 5000);}RFWaitForConnection()RFWaitForConnection(ServerID, Timeout)Return valueReturns a list with three values: status, DLCI, and BluetoothDevice.Status (element 0) is one of the following:• “Success”• “Timed out”• “Failure”DLCI (element 1) is the data link connection identifier.BluetoothDevice (element 2) is the address of the connecting device.CommentsWaits Timeout milliseconds for a device to establish an RFCOMM connec-tion with Merlin’s Wand. This function will block the specified amount of time (or infinitely if 0 is specified) unless a connection is established. If an Parameter Meaning Default Value CommentsServerID Service ID for RFCOMM channelTimeout Time in ms to wait for an RFCOMM connection0 (Infinite wait)Use 0 as the timeout value to wait infinitely.](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-91.png)
![226CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsRFCOMM connection is already present when this function is called, it will immediately return “Success”.Example# Wait 3 seconds for RFCOMM connectionTrace("RFWaitForConnection\n");result = RFWaitForConnection(1, 3000);if( result[0] == "Success" ){Trace("Incoming RFCOMM connection DLCI: ", result[1], "\n");Trace("Connecting device address: ", result[2], "\n");}RFAcceptChannel()RFAcceptChannel(bAccept)Return value• “Success”CommentsExamplestatus = RFAcceptChannel(1);Trace("RFAcceptChannel returned: ", status, "\n\n");RFAcceptPortSettings()RFAcceptPortSettings(bAccept)Parameter Meaning Default Value CommentsbAccept Boolean value indicating whether to accept the channel or not00 or 1Parameter Meaning Default Value CommentsbAccept Boolean value indicating whether to accept the channel or not00 or 1](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-92.png)
![227CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsReturn value• “Success”CommentsExamplestatus = RFAcceptPortSettings(0);Trace("RFAcceptPortSettings returned: ", status, "\n\n");RFCreditFlowEnabled()RFCreditFlowEnabled(Address, DLCI)Return value•“Enabled”• “Disabled”• “Not Connected”CommentsChecks to see if credit flow is enabled on a particular RFCOMM connec-tion.Exampleresult = RFOpenClientChannel(Device, 1);DLCI = result[1];if(result[0] == "Success"){status = RFCreditFlowEnabled("CONNECTED_DEVICE", DLCI);Trace("RFCreditFlowEnabled returned: ", status, "\n\n");}Parameter Meaning Default Value CommentsAddress Bluetooth address of deviceCan use “CONNECTED_DEVICE” to check if credit flow is enabled on a master RFCOMM connection. Note that this will work only if exactly one device is connected via RFCOMM.DLCI Data link con-nection identi-fierThe DLCI is returned by RFOpenClientChan-nel()](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-93.png)

![229CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsReturn value• “Success”• “Failure”• “Not connected”• “Timed Out”CommentsSubmits a request to change the port settings on a particular RFCOMM connection.Exampleresult = RFOpenClientChannel(Device, 1);DLCI = result[1];if(result[0] == "Success"){status = RFRequestPortSettings("CONNECTED_DEVICE", DLCI, "57600", ["RF_DATA_BITS_8"], ["RF_FLOW_CTRL_NONE"], 11, 13);Trace("RFRequestPortSettings returned: ", status, "\n\n");}RFRequestPortStatus()RFRequestPortStatus(Address, DLCI)Return valueReturns a list with two values: status and portSettings.Status (element 0) is one of the following:• “Success”• “Failure”• “Not Connected”• “Timed Out”portSettings (element 1) is a list containing the following five values:Parameter Meaning Default Value CommentsAddress Bluetooth address of deviceCan use “CONNECTED_DEVICE” to request the port status on a master RFCOMM connec-tion. Note that this will work only if exactly one device is connected via RFCOMM.DLCI Data link con-nection identi-fierThe DLCI is returned by RFOpenClientChan-nel()](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-95.png)
![230CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting Commands• BaudRate (element 0) is a string containing the baud rate• DataFormat (element 1) is a string containing data bits, stop bits, and parity settings• FlowControl (element 2) is a string indicating port flow control options• Xon (element 3) is a string containing the XON character• Xoff (element 4) is a string containing the XOFF characterCommentsRequests the port settings on a particular RFCOMM connection.Exampleresult = RFOpenClientChannel(Device, 1);DLCI = result[1];if(result[0] == "Success"){res = RFRequestPortStatus(Device, DLCI);Trace("RFRequestPortStatus returned: ", res[0], "\n\n");if (res[0] == "Success"){settingsList = res[1];Trace("BaudRate: ", settingsList[0], "\n");Trace("DataFormat: ", settingsList[1], "\n");Trace("Xon: ", settingsList[3], "\n");Trace("Xoff: ", settingsList[4], "\n");}}RFSetLineStatus()RFSetLineStatus(Address, DLCI, LineStatus)Return value• “Success”Parameter Meaning Default Value CommentsAddress Bluetooth address of deviceCan use “CONNECTED_DEVICE” to set line status on a master RFCOMM connection. Note that this will work only if exactly one device is connected via RFCOMM.DLCI Data link con-nection identi-fierThe DLCI is returned by RFOpenClientChan-nel()LineStatus List of strings representing the Line StatusCan be “RF_LINE_ERROR”, “RF_OVERRUN”, “RF_PARITY”, “RF_FRAMING”](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-96.png)
![231CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting Commands• “Failure”• “Not Connected”• “Timed Out”CommentsSets the line status on a particular RFCOMM connection.Exampleresult = RFOpenClientChannel(Device, 1);DLCI = result[1];if(result[0] == "Success"){status = RFSetLineStatus("CONNECTED_DEVICE", DLCI, ["RF_LINE_ERROR", "RF_FRAMING"]);Trace("RFSetLineStatus returned: ", status, "\n\n");}RFSetModemStatus()RFSetModemStatus(Address, DLCI, ModemSignals, BreakLength)Return value• “Success”• “Failure”• “Not Connected”• “Timed Out”Parameter Meaning Default Value CommentsAddress Bluetooth address of deviceCan use “CONNECTED_DEVICE” to set modem status on a master RFCOMM connec-tion. Note that this will work only if exactly one device is connected via RFCOMM.DLCI Data link con-nection identi-fierThe DLCI is returned by RFOpenClientChan-nel()ModemSignals List of strings specifying sig-nal typesCan be “RF_FLOW”, “RF_RTC”, “RF_RTR”, “RF_IC”, “RF_DV”, “RF_DSR”, “RF_CTS”, “RF_RI”, “RF_CD”, “RF_DTR”, “RF_RTS”BreakLength Indicates the length of the break signal in 200 ms unitsMust be between 0 and 15 (inclusive). If 0, no break signal was sent.](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-97.png)
![232CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsCommentsSets the modem status on a particular RFCOMM connection.Exampleresult = RFOpenClientChannel(Device, 1);DLCI = result[1];if(result[0] == "Success"){status = RFSetModemStatus("CONNECTED_DEVICE", DLCI, ["RF_FLOW"], 3);Trace("RFSetModemStatus returned: ", status, "\n\n");}RFSendTest()RFSendTest(Address, DLCI)Return value• “Success”• “Failure”• “Not Connected”• “Failure”CommentsSends a test frame on a particular RFCOMM connection.Exampleresult = RFOpenClientChannel(Device, 1);DLCI = result[1];if(result[0] == "Success"){status = RFSendTest("CONNECTED_DEVICE", DLCI);Trace("RFSendTest returned: ", status, "\n\n");}Parameter Meaning Default Value CommentsAddress Bluetooth address of deviceCan use “CONNECTED_DEVICE” to send a test frame on a master RFCOMM connection. Note that this will work only if exactly one device is connected via RFCOMM.DLCI Data link con-nection identi-fierThe DLCI is returned by RFOpenClientChan-nel()](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-98.png)
![233CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsRFAdvanceCredit()RFAdvanceCredit(Address, DLCI, credit)Return value• “Success”• “Failure”• “Not Connected”CommentsAdvances a specified number of credits to a particular RFCOMM connec-tion.Exampleresult = RFOpenClientChannel(Device, 1);DLCI = result[1];if(result[0] == "Success"){status = RFAdvanceCredit(Device, DLCI, 2);Trace("RFAdvanceCredit returned: ", status, "\n\n");}C.7 TCS CommandsTCSRegisterProfile()TCSRegisterProfile()Parameter Meaning Default Value CommentsAddress Bluetooth address of deviceCan use “CONNECTED_DEVICE” to advance a credit to a master RFCOMM connection. Note that this will work only if exactly one device is connected via RFCOMM.DLCI Data link con-nection identi-fierThe DLCI is returned by RFOpenClientChan-nel()credit Number of credits to advanceParameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-99.png)


![236CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsTCSSendInfoMessage()TCSSendInfoMessage(Phone_Number)Return value• “Success”• “Failure”• “Invalid Parameter”CommentsThis command can be called after a TCS channel is opened. It sends an INFORMATION TCS message with a called party number. Exampleresult = TCSSendInfoMessage("4088447081");Trace("TCSSendInfoMessage result : ", result, "\n");if( result != "Success")return result;########################################################## Tested TCS Call initiation, information sending, ## and Call clearing ##########################################################Main(){#Device = '838010AC0008'; Device = DoInquiry();Trace(Device, "\n");result = Connect(Device[0]);Trace("Connection result : ", result, "\n");if( result != "Success")return result;Sleep(1000);result = TCSRegisterProfile();Trace("TCSRegisterProfile result : ", result, "\n");if( result != "Success")return result;Parameter Meaning Default Value CommentsPhone_Number Up to 10-digit Phone Num-ber](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-102.png)
![237CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsSleep(1000);result = TCSOpenChannel(Device[0]);Trace("TCSOpenChannel result : ", result, "\n");if( result != "Success")return result;Sleep(1000);result = TCSStartCall();Trace("TCSStartCall result : ", result, "\n");if( result != "Success")return result; Sleep(1000);result = TCSSendInfoMessage("4088447081");Trace("TCSSendInfoMessage result : ", result, "\n");if( result != "Success")return result;Sleep(1000);result = TCSDisconnectCall();Trace("TCSDisconnectCall result : ", result, "\n");if( result != "Success")return result;Sleep(1000);Trace("HCI Disconnect result: ",Disconnect(Device[0]), "\n"); }](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-103.png)


![240CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsExampleL2CAPConfigurationResponse("Reject-unknown options");L2CAPConnectRequest()L2CAPConnectRequest(Address, PSM, ReceiveMTU)Return valueReturns a list with three values: result, ACL Handle, and a list of all L2CAP CIDs.Result (element 0) is one of the following:• “Success”• “Failure”• “Not found”• “Not connected”ACL Handle (element 1) is a unique identifier for an ACL connection.List of all L2CAP CIDs (element 2) is a list of all channel identifiers for an L2CAP connection with a particular device.CommentsThis command is used to establish an L2CAP channel to the specified remote device.Exampleresult = L2CAPConnectRequest('0080370DBD02', 0x1001, 0x1C2);Trace("L2CAPConnectRequest returned: ", result[0], "\n");if (result[0] == "Success"){Handle = result[1];CID = result[2];}Parameter Meaning Default Value CommentsAddress Bluetooth address of the remote devicePSMReceiveMTU 0x01C2](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-106.png)


![243CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsExampleresult = L2CAPEchoRequest('838010AC0008', "Test");Trace("L2CAPEchoRequest result : ", result[0], "\n");if(result[0] == "Success"){Trace("Data : ", result[1], "\n");}L2CAPInfoRequest()L2CAPInfoRequest(Address)Return valuesReturns a list with three values: status, number of bytes, and data.Status (element 0) is one of the following:• “Success”• “Failure”• “Not found”• “Not connected”Number of bytes (element 1) is the number of bytes of data that follow.Data (element 2) is the raw data.CommentsSends an Info Request to the L2CAP protocol on the specified remote device. Info requests are used to exchange implementation-specific infor-mation regarding L2CAP’s capabilities.Exampleresult = L2CAPInfoRequest('838010AC0008');Trace("L2CAPInfoRequest result : ", result[0], "\n");if(result[0] == "Success"){Trace("Data length : ", result[1], "\n");Trace("Data : ", result[2], "\n");}Parameter Meaning Default Value CommentsAddress Bluetooth address of the remote device](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-109.png)



![247CATC MERLIN’S WAND 1.22 APPENDIX CUser’s Manual Merlin’s Wand Scripting CommandsExampleSDPAddProfileServiceRecord(rfChannel, "ObjectPush");SDPQueryProfile()SDPQueryProfile(Address, Profile)Return value• RFCOMM channel of the requested profile (profile is supported)• “Failure”CommentsQueries the specified device to see if a profile is supported.An ACL connection must already be established with the device.Exampleif((RFCommId = SDPQueryProfile(Devices[0], "SerialPort")) != "Failure"){RFOpenClientChannel(Devices[0], RFCommId);}SDPResetDatabase()SDPResetDatabase()Return value• “Success”• “Failure”Parameter Meaning Default Value CommentsAddress Bluetooth address of device to queryProfile Name of SDP profileProfile can be one of:“Headset”, “HeadsetAudioGateway”, “Seri-alPort”, “DialUp”, “FileTransfer”, “ObjectPush”, “Intercom”, “Cordless”, “Fax”, “LAN”, “Sync” or “SyncCommand”Parameter Meaning Default Value CommentsN/A](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-113.png)








![256CATC MERLIN’S WAND 1.22 APPENDIX DUser’s Manual CATC Scripting LanguageHexadecimal numbers must be preceded by 0x: 0x2A, 0x54, 0xFFFFFF01Octal numbers must begin with 0: 0775, 017, 0400Decimal numbers are written as usual: 24, 1256, 2Binary numbers are denoted with 0b: 0b01101100, 0b01, 0b100000StringsString literals are used to represent text. A string consists of zero or more characters and can include numbers, letters, spaces, and punctuation. An empty string ("") contains no characters and evaluates to false in an expression, whereas a non-empty string evaluates to true. Double quotes surround a string, and some standard backslash (\) escape sequences are supported.Escape SequencesThese are the available escape sequences in CSL:String Represented text"Quote: \"This is a string literal.\""Quote: "This is a string literal.""256" 256 **Note that this does not represent the integer 256, but only the characters that make up the number."abcd!$%&*" abcd!$%&*"June 26, 2001" June 26, 2001"[ 1, 2, 3 ]" [ 1, 2, 3 ]Character Escape Sequence Example Outputbackslash \\ "This is a backslash: \\" This is a backslash: \double quote \" "\"Quotes!\"" "Quotes!"horizontal tab \t "Before tab\tAfter tab" Before tab After tabnewline \n "This is how\nto get a newline."This is howto get a newline.single quote \' "\'Single quote\'" 'Single quote'](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-122.png)
![257CATC MERLIN’S WAND 1.22 APPENDIX DUser’s Manual CATC Scripting LanguageListsA list can hold zero or more pieces of data. A list that contains zero pieces of data is called an empty list. An empty list evaluates to false when used in an expression, whereas a non-empty list evaluates to true. List literals are expressed using the square bracket ([]) delimiters. List elements can be of any type, including lists.[1, 2, 3, 4][]["one", 2, "three", [4, [5, [6]]]]Raw BytesRaw binary values are used primarily for efficient access to packet payloads. A literal notation is supported using single quotes:'00112233445566778899AABBCCDDEEFF'This represents an array of 16 bytes with values starting at 00 and ranging up to 0xFF. The values can only be hexadecimal digits. Each digit represents a nybble (four bits), and if there are not an even number of nybbles specified, an implicit zero is added to the first byte. For example:'FFF'is interpreted as'0FFF'NullNull indicates an absence of valid data. The keyword null represents a literal null value and evaluates to false when used in expressions.result = null;D.3 VariablesVariables are used to store information, or data, that can be modified. A variable can be thought of as a container that holds a value.All variables have names. Variable names must contain only alphanumeric characters and the underscore ( _ ) character, and they cannot begin with a number. Some possible variable names arex_NewValuename_2](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-123.png)
![258CATC MERLIN’S WAND 1.22 APPENDIX DUser’s Manual CATC Scripting LanguageA variable is created when it is assigned a value. Variables can be of any value type, and can change type with re-assignment. Values are assigned using the assignment operator ( = ). The name of the variable goes on the left side of the operator, and the value goes on the right:x = [ 1, 2, 3 ]New_value = xname2 = "Smith"If a variable is referenced before it is assigned a value, it evaluates to null.There are two types of variables: global and local.Global VariablesGlobal variables are defined outside of the scope of functions. Defining global variables requires the use of the keyword set. Global variables are visible throughout a file (and all files that it includes).set Global = 10;If an assignment in a function has a global as a left-hand value, a variable will not be created, but the global variable will be changed. For exampleset Global = 10;Function(){Global = "cat";Local = 20;}will create a local variable called Local, which will only be visible within the function Function. Additionally, it will change the value of Global to "cat", which will be visible to all functions. This will also change its value type from an integer to a string.Local VariablesLocal variables are not declared. Instead, they are created as needed. Local variables are created either by being in a function's parameter list, or simply by being assigned a value in a function body. Function(Parameter){Local = 20;}](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-124.png)



![262CATC MERLIN’S WAND 1.22 APPENDIX DUser’s Manual CATC Scripting Language!1which uses the logical negation operator. It returns a value of 0.The unary operators are sizeof(), head(), tail(), ~ and !.Operator Precedence and AssociativityOperator rules of precedence and associativity determine in what order operands are evaluated in expressions. Expressions with operators of higher precedence are evaluated first. In the expression4 + 9 * 5the * operator has the highest precedence, so the multiplication is performed before the addition. Therefore, the expression evaluates to 49.The associative operator () is used to group parts of the expression, forcing those parts to be evaluated first. In this way, the rules of precedence can be overridden. For example,( 4 + 9 ) * 5causes the addition to be performed before the multiplication, resulting in a value of 65.When operators of equal precedence occur in an expression, the operands are evaluated according to the associativity of the operators. This means that if an operator's associativity is left to right, then the operations will be done starting from the left side of the expression. So, the expression4 + 9 - 6 + 5would evaluate to 12. However, if the associative operator is used to group a part or parts of the expression, those parts are evaluated first. Therefore,( 4 + 9 ) - ( 6 + 5 )has a value of 2.In the following table, the operators are listed in order of precedence, from highest to lowest. Operators on the same line have equal precedence, and their associativity is shown in the second column. Operator Symbol Associativity[] () Left to right~ ! sizeof head tail Right to left* / % Left to right](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-128.png)
![263CATC MERLIN’S WAND 1.22 APPENDIX DUser’s Manual CATC Scripting Language++ -- Right to left[] () Left to right~ ! sizeof head tail Right to left* / % Left to right+ - Left to right<< >> Left to right< > <= >= Left to right== != Left to right&Left to right^Left to right|Left to right&& Left to right|| Left to right= += -= *= /= %= >>= <<= &= ^= |=Right to leftOperator Symbol Associativity](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-129.png)
![264CATC MERLIN’S WAND 1.22 APPENDIX DUser’s Manual CATC Scripting Language Operator Symbol Description Operand Types Result Types ExamplesIndex Operator[ ] Index or subscriptRaw Bytes Integer Raw = '001122'Raw[1] = 0x11List Any List = [0, 1, 2, 3, [4, 5]]List[2] = 2List[4] = [4, 5]List[4][1] = 5*Note: if an indexed Raw value is assigned to any value that is not a byte ( > 255 or not an integer), the variable will be promoted to a list before the assignment is performed.Associative Operator( ) Associative Any Any ( 2 + 4 ) * 3 = 182 + ( 4 * 3 ) = 14Arithmetic Operators*Multiplication Integer-integer Integer 3 * 1 = 3/Division Integer-integer Integer 3 / 1 = 3%Modulus Integer-integer Integer 3 % 1 = 0+Addition Integer-integer Integer 2 + 2 = 4String-string String "one " + "two" = "one two"Raw byte-raw byte Raw '001122' + '334455' = '001122334455'List-list List [1, 2] + [3, 4] = [1, 2, 3, 4]Integer-list List 1 + [2, 3] = [1, 2, 3]Integer-string String "number = " + 2 = "number = 2"*Note: integer-string concatenation uses decimal conversion.String-list List "one" + ["two"] = ["one", "two"]-Subtraction Integer-integer Integer 3 – 1 = 2Increment and Decrement Operators++ Increment Integer Integer a = 1++a = 2b = 1b++ = 1*Note that the value of b after execution is 2.-- Decrement Integer Integer a = 2--a = 1b = 2b-- = 2*Note that the value of b after execution is 1.Operators](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-130.png)
![265CATC MERLIN’S WAND 1.22 APPENDIX DUser’s Manual CATC Scripting LanguageEquality Operators== Equal Integer-integer Integer 2 == 2String-string Integer "three" == "three"Raw byte-raw byte Integer '001122' == '001122'List-list Integer [1, [2, 3]] == [1, [2, 3]]*Note: equality operations on values of different types will evaluate to false.!= Not equal Integer-integer Integer 2 != 3String-string Integer "three" != "four"Raw byte-raw byte Integer '001122' != '334455'List-list Integer [1, [2, 3]] != [1, [2, 4]]*Note: equality operations on values of different types will evaluate to false.Relational Operators<Less than Integer-integer Integer 1 < 2String-string Integer "abc" < "def">Greater than Integer-integer Integer 2 > 1String-string Integer "xyz" > "abc"<= Less than or equalInteger-integer Integer 23 <= 27String-string Integer "cat" <= "dog">= Greater than or equalInteger-integer Integer 2 >= 1String-string Integer "sun" >= "moon"*Note: relational operations on string values are evaluated according to character order in the ASCII table.Logical Operators!Negation All combinations of typesInteger !0 = 1 !"cat" = 0!9 = 0 !"" = 1&& Logical AND All combinations of typesInteger 1 && 1 = 1 1 && !"" = 11 && 0 = 0 1 && "cat" = 1|| Logical OR All combinations of typesInteger 1 || 1 = 1 0 || 0 = 01 || 0 = 1 "" || !"cat" = 0Operator Symbol Description Operand Types Result Types ExamplesOperators (Continued)](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-131.png)
![266CATC MERLIN’S WAND 1.22 APPENDIX DUser’s Manual CATC Scripting LanguageBitwise Logical Operators~Bitwise complementInteger-integer Integer ~0b11111110 = 0b00000001&Bitwise AND Integer-integer Integer 0b11111110 & 0b01010101 = 0b01010100^Bitwise exclusive ORInteger-integer Integer 0b11111110 ^ 0b01010101 = 0b10101011|Bitwise inclusive ORInteger-integer Integer 0b11111110 | 0b01010101 = 0b11111111Shift Operators<< Left shift Integer-integer Integer 0b11111110 << 3 = 0b11110000>> Right shift Integer-integer Integer 0b11111110 >> 1 = 0b01111111Assignment Operators=Assignment Any Any A = 1B = C = A+= Addition assignmentInteger-integer Integer x = 1x += 1 = 2String-string String a = "one "a += "two" = "one two"Raw byte-raw byte Raw z = '001122'z += '334455' = '001122334455'List-list List x = [1, 2]x += [3, 4] = [1, 2, 3, 4]Integer-list List y = 1y += [2, 3] = [1, 2, 3]Integer-string String a = "number = "a += 2 = "number = 2"*Note: integer-string concatenation uses decimal conversion.String-list List s = "one"s + ["two"] = ["one", "two"]-= Subtraction assignmentInteger-integer Integer y = 3y –= 1 = 2*= Multiplication assignmentInteger-integer Integer x = 3x *= 1 = 3/= Division assignmentInteger-integer Integer s = 3s /= 1 = 3%= Modulus assignmentInteger-integer Integer y = 3y %= 1 = 0>>= Right shift assignmentInteger-integer Integer b = 0b11111110b >>= 1 = 0b01111111<<= Left shift assignmentInteger-integer Integer a = 0b11111110a <<= 3 = 0b11111110000Operator Symbol Description Operand Types Result Types ExamplesOperators (Continued)](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-132.png)
![267CATC MERLIN’S WAND 1.22 APPENDIX DUser’s Manual CATC Scripting LanguageAssignment Operators (continued)&= Bitwise AND assignmentInteger-integer Integer a = 0b11111110a &= 0b01010101 = 0b01010100^= Bitwise exclusive OR assignmentInteger-integer Integer e = 0b11111110e ^= 0b01010101 = 0b10101011|= Bitwise inclusive OR assignmentInteger-integer Integer i = 0b11111110i |= 0b01010101 = 0b11111111List Operatorssizeof() Number of elementsAny Integer sizeof([1, 2, 3]) = 3sizeof('0011223344') = 5sizeof("string") = 6sizeof(12) = 1sizeof([1, [2, 3]]) = 2*Note: the last example demonstrates that the sizeof() operator returns the shallow count of a complex list.head() Head List Any head([1, 2, 3]) = 1*Note: the Head of a list is the first item in the list.tail() Tail List List tail([1, 2, 3]) = [2, 3]*Note: the Tail of a list includes everything except the Head.Operator Symbol Description Operand Types Result Types ExamplesOperators (Continued)](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-133.png)









![277CATC MERLIN’S WAND 1.22 APPENDIX DUser’s Manual CATC Scripting LanguageCall()Call( <function_name string>, <arg_list list> )Return valueSame as that of the function that is called.CommentsCalls a function whose name matches the function_name parameter. All scope rules apply normally. Spaces in the function_name parameter are interpreted as the ‘_’ (underscore) character since function names cannot contain spaces.ExampleCall("Format", ["the number is %d", 10]); is equivalent to: Format("the number is %d", 10);Format()Format (<format string>, <value string or integer>)Return valueNone.CommentsFormat is used to control the way that arguments will print out. The format string may contain conversion specifications that affect the way in which the arguments in the value string are returned. Format conversion characters, flag characters, and field width modifiers are used to define the conversion specifications.ExampleFormat("0x%02X", 20);would yield the string 0x14.Parameter Meaning Default Value Commentsfunction_name stringarg_list list Used as the list of parameters in the function call.Parameter Meaning Default Value Commentsformat stringvalue string or integer](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-143.png)



![281CATC MERLIN’S WAND 1.22 APPENDIX DUser’s Manual CATC Scripting LanguageCommentsAttempts to resolve the value of a symbol. Can resolve global, constant, and local symbols. Spaces in the symbol_name parameter are interpreted as the ‘_’ (underscore) character since function names cannot contain spaces.Examplea = Resolve( "symbol" );is equivalent to:a = symbol;Trace()Trace( <arg1 any>, <arg2 any>, ... )Return valueNone.CommentsThe values given to this function are given to the debug console.Examplelist = ["cat", "dog", "cow"];Trace("List = ", list, "\n");would result in the outputList = [cat, dog, cow]Parameter Meaning Default Value Commentsarg any The number of arguments is variable.](https://usermanual.wiki/Computer-Access-Technology/BT004APA-X.WAND-Manual-2-of-2/User-Guide-272617-Page-147.png)
