WebSocket API JavaScript Library

The WebSocket API Extension is discontinued. It is replaced by the JavaScript API Library. If you need assistance, please contact Technical Support.

The WebSocket API Extension comes packaged with a JavaScript library that allows web based applications to interact with the deviceWISE gateway's runtime process. The JavaScript library files are placed into the www/devicewise directory within the Staging Browser file system when the extension is installed.

Gateway HTTP Server

To support the JavaScript API calls into the gateway, the gateway's HTTP Server must be Started. The status of the gateway's HTTP Server can be viewed using the Workbench -> Administration -> HTTP Server tab. For more information, see HTTP Server.

Setup

To create a web page that makes use of the JavaScript API library, the following links must be included in the head of the main HTML page.

<script src="devicewise/jquery-3.1.0.min.js"></script>
<script src="devicewise/cookie.js"></script>
<script src="devicewise/devicewiseUtil.js"></script>
<script src="devicewise/devicewiseClient.js"></script>
<script src="devicewise/devicewiseConstants.js"></script>
<script src="devicewise/devicewiseDiagnostics.js"></script>
<script src="devicewise/devicewiseVariable.js"></script>
<script src="devicewise/devicewiseSQLite.js"></script>
<script src="devicewise/devicewiseDevice.js"></script>
<script src="devicewise/devicewiseTrigger.js"></script>
<script src="devicewise/devicewiseProject.js"></script>
<script src="devicewise/devicewiseChannel.js"></script>
<script src="devicewise/devicewiseSystem.js"></script>

deviceWISE types

Datatype codes are accessed using the following definitions:

  • devicewise.INT1
  • devicewise.INT2
  • devicewise.INT4 
  • devicewise.INT8
  • devicewise.UINT1
  • devicewise.UINT2
  • devicewise.UINT4
  • devicewise.UINT8
  • devicewise.FLOAT4
  • devicewise.FLOAT8
  • devicewise.BOOL
  • devicewise.STRING

deviceWISE driver code listing

* Virtual...........................   1
* [PeerLink] Device Connection......   5
* [PeerLink] Node Connection........   6
* [System] Alias Device.............   8
* [System] Global Device............   9
* [System] Property Reader..........  10
* [Mitsubishi] Q CPU (Local)........  11
* [Mitsubishi] Q CPU (EZ)...........  13
* [Mitsubishi] QnA CPU (EZ).........  14
* [Mitsubishi] A CPU (EZ)...........  15
* [Mitsubishi] Fx CPU (FX3CPU)......  16
* [Mitsubishi] A CPU................  17
* [Mitsubishi] QnA CPU..............  18
* [Mitsubishi] Q CPU................  19
* [Omron] CS Series.................  21
* [Omron] CJ Series.................  22
* [Omron] CV Series.................  23
* [Omron] NJ Series.................  24
* [Siemens] Siemens LOGO PLC........  30
* [Siemens] S7-200 Series...........  31
* [Siemens] S7-300 Series...........  32
* [Siemens] S7-400 Series...........  33
* [Siemens] S7-1200 Series..........  34
* [Siemens] S7-300 PLC (Local)......  35
* [Siemens] S7-300 PLC (ERPC).......  36
* [Siemens] S7 TCP Connection.......  37
* [Siemens] S5 Series...............  38
* [Siemens] ET 200pro...............  39
* [Siemens] S7-1500 Series..........  40
* [Rockwell] Backplane (Local)......  41
* [Rockwell] ControlLogix...........  42
* [Rockwell] SLC-500................  43
* [Rockwell] PLC-5..................  44
* [Rockwell] Logix Listener.........  45
* [Rockwell] CompactLogix...........  46
* [Rockwell] MicroLogix.............  47
* [Rockwell] SLC/PLC5 Listener......  48
* [Modbus] Generic TCP..............  51
* [Modbus] Generic Serial...........  52
* [Modbus] TCP Server...............  53
* [Modbus] Serial Server............  54
* [FANUC] Series 90..............  61
* [FANUC] CNC....................  62
* [Fuji] PLC........................  71
* [Telemecanique] PLC...............  81
* [Alien] 9X00 Reader............... 101
* [Alien] 9780 Reader............... 102
* [Alien] 9650 Reader............... 103
* [Symbol] RFID Readers............. 111
* [Symbol] Barcode Readers.......... 112
* [Hawkeye] 15XX Camera............. 121
* [Banner] PresencePLUS Camera...... 122
* [Hawkeye] Visionscape Camera...... 123
* [EMS] Cobalt HF Reader............ 131
* [Tyco] AMP Analyzer............... 141
* [Tyco] C Series Power Meter....... 142
* [Esensors] EMT08.................. 151
* [Mitsubishi] GOT.................. 161
* [Mitsubishi] QNEUD................ 162
* [Mitsubishi] L CPU (CC-Link IE Field) 163
* [Mitsubishi] Listener............. 165
* [Mitsubishi] iQ-R (RCPU).......... 166
* [Mitsubishi] iQ-F (FX5CPU)........ 167
* [OPC] UA Client................... 201
* [OPC] DA Client................... 202
* [OPC] DA(T) Client................ 203
* [OPC] XML-DA Client............... 204
* [OPC] XML-DA Client (ILS)......... 211
* [OPC] SIMOTION Controller......... 271
* [SNMP] SNMP Client................ 301
* [SYSMON] System Monitor........... 311
* [SYSMON] Process Monitor.......... 312
* [Artila] PAC-5070................. 321
* [BACnet] Client................... 331
* [Z-Wave] Z-Wave Device............ 361
* [MultiTech] Local I/O Device...... 371
* [MultiTech] GPIO Device........... 372
* [MultiTech] Serial Device......... 373
* [GPS] NMEA GPS Receiver........... 381
* [CalAmp] I/O Device............... 391
* [CalAmp] LMU I/O Device........... 392
* [Atlas/Copco] Power Focus Device.. 401
* [Atlas/Copco] Power MACS Device... 402
* [NCD] Relay IO.................... 411
* [ROCPlus] Emerson ROC 809 Device.. 421
* [SQ-Electronics] NP-02U........... 431
* [Moxa] E1240...................... 441 
* [Pike-Aero] HA10.................. 451
* [Telematics] OBD-II (ScanTool.net) 461
* [Modicon] Quantum CPS 111......... 471
* [Modicon] Quantum CPS 114......... 472
* [Advantech] UNO2050 Local IO...... 481
* [SICK] RFID Reader................ 491
* [MTConnect] Client................ 501
* [CTI] 2572 Listener............... 511
* [CTI] 2572 Device................. 512
* [Davis] Vantage Vue............... 521
* [Philips] Hue Bridge.............. 531
* [IrrigationCaddy] ICEthS1......... 541
* [NetComm] NTC-6200-02............. 551
* [Monnit] USB Gateway.............. 561
* [Systech] SysLINK SL-500.......... 571
* [BBE] Spectre IO.................. 581
* [Beckhoff] TwinCAT 2.............. 591
* [Beckhoff] TwinCAT 3.............. 592
* [Beckhoff] TwinCAT 2.............. 591
* [Beckhoff] TwinCAT 3.............. 592
* [Tesla Motors] Model S............ 601
* [MQTT] Client Connection.......... 611
* [CalAmp] CDM-5030 Local IO........ 621
* [GenICam] JAI Go 5000............. 700
* [MLAN] MLAN Device................ 800
* [Siemens] S7 Listener............. 1000
* [Siemens] SINUMERIK 840D.......... 1001
* [Siemens] PCS 7................... 1002
* [RTI] Analog Sensors.............. 80101
* [RTI] Display..................... 80102
* [AdLink] SEMA..................... 80201
* [Brooks Robotics] WAVE II......... 80301
* [ITW] MIT II TTL.................. 80401
* [ITW] Vulcan ABC7 Combi........... 80402
* [ITW] Warewash.................... 80403

The above list is incomplete and will not be updated to the latest driver codes. To find out the driver code of your device, use the devicewise.deviceInfo() function or export the device and view the type in the exported XML in the *.dwx file.

API functions

devicewise.connect(URL, callbackSuccess, callbackDisconnect, callbackError)

Create a WebSocket connection to the WebSocket API Extension proxy.

  • URL - URL to connect to. The WebSocket proxy listens on port 9980. In most cases the WebSocket URL would be: "ws://_ipaddress_of_devicewise_gateway_:9980".
  • callbackSuccess() - Callback function called upon successful authentication.
  • callbackDisconnect() - Callback called in the event of a WebSocket disconnect.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.login(username, password, callbackSuccess, callbackError)

Login to deviceWISE gateway runtime.

Before you login, you will need to create a new user in the gateway, using the Workbench. Use the Workbench -> Administration -> Security tab to display the Security panel, then select the Users tab.
Create a new User with the following credentials

  • Name: websocketapi
  • Password: 9cZbK9HFUtcTZY3Z
  • Role: select one of the Roles that are defined on the gateway.
    For complete information on Users, Roles, and Policies, see: Security.

Once you've created the new user, you will be able to login with the following credentials:

  • username - websocketapi
  • password - wV7/btowyFzwgPlwhgPDV5jR1AaBVeoty9uQ3AjESxg=
  • callbackSuccess() - Callback function called upon successful authentication.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.login2(username, password, callbackSuccess, callbackError)

Login to deviceWISE gateway runtime and persist session.

Before you login, you will need to create a new user in the gateway, using the Workbench. Use the Workbench -> Administration -> Security tab to display the Security panel, then select the Users tab.
Create a new User with the following credentials

  • Name: websocketapi
  • Password: 9cZbK9HFUtcTZY3Z
  • Role: select one of the Roles that are defined on the gateway.
    For complete information on Users, Roles, and Policies, see: Security.

Once you've created the new user, you will be able to login with the following credentials:

  • username - websocketapi
  • password - wV7/btowyFzwgPlwhgPDV5jR1AaBVeoty9uQ3AjESxg=
  • callbackSuccess(token) - Callback function called upon successful authentication. Function returns token for session.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.loginToken(callbackSuccess, callbackError)

Attempt to resume existing session for client. Requires originally authenticating with "devicewise.login2()".

  • callbackSuccess() - callback if existing session is resumed successfully
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.logout()

Logout from the deviceWISE gateway runtime. Closes the WebSocket connection after logging out.

devicewise.read(device, variable, type, count, length, callbackSuccess, callbackError)

Read a variable.

  • device - Device to be read from.
  • variable - Variable to be read. Full path must be supplied (ex. folder1.folder2.variableName). If reading from arrays include the index you want to begin reading from (ex. arrayVariable[0]).
  • type - deviceWISE data type.
  • count - Number of elements to read from an array. Use a -1 for scalar reads.
  • length - Length of the deviceWISE data type. Used for STRING data types. Use a -1 to inherit length for other types.
  • callbackSuccess(data) - Callback function that returns data read.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.write(device, variable, type, count, length, data, callbackSuccess, callbackError)

Write to a variable.

  • device - Device to write to.
  • variable - Variable to be written. Full path must be supplied (ex. folder1.folder2.variableName). If writing to arrays include the index you want to begin writing from (ex. arrayVariable[0]).
  • type - deviceWISE data type.
  • count - Number of elements to write to an array. Use a -1 for scalar writes.
  • length - Length of the deviceWISE data type. Used for STRING data types. Use a -1 to inherit length for other types.
  • data - data to be written to the variable.
  • callbackSuccess() - Callback function called upon successful completion.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.subscribe(device, variable, rate, type, count, length, callbackSuccess, callbackError, callbackPublishReceived)

Subscribe to a variable. Subscribing to multiple elements of an array will result in a subscription created for each element. The callbacks are shared for each element.

  • device - Device containing the variable to subscribe to.
  • variable - Variable to be subscribed to. Full path must be supplied (ex. folder1.folder2.variableName). If subscribing to arrays include the index you want to begin subscribing from (ex. arrayVariable[0]).
  • rate - Poll rate, in seconds, for the subscription.
  • type - deviceWISE data type.
  • count - Number of elements to subscribe to for an array.
  • length - Length of the deviceWISE data type. Used for STRING data types. Use a -1 to inherit length for other types.
  • callbackSuccess(subscriptionID, variableName) - Callback function called upon successful completion. Returns the subscription's ID and variable name.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.
  • callbackPublishReceived(dataStructure) - Callback called when data publish is received for the given subscription. Returns a JSON object with the following structure:

{

device: device containing subscription,
variable: variable name,
count: element count,
length: data length,
type: datatype,
value: published value,
subId: subscription ID,
cbSuccess: success callback,
cbError: error callback,
cbPublish: publish callback

}

devicewise.unsubscribe(subscriptionID, callbackSuccess, callbackError)

Unsubscribe from a variable.

  • subscriptionID - ID of the subscription to unsubscribe from.
  • callbackSuccess() - Callback called upon successful removal of the subscription.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.deviceList(callbackSuccess, callbackError)

Get a list of the defined devices on the deviceWISE gateway.

  • callbackSuccess(devices) - Callback called upon reception of device list. Contains a list of devices. Each device is represented with a name, a type, and it's state.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

Response

  • Name - Name of Device
  • Type - The device type from the deviceWISE driver code listing. The driver code listing is in the section, deviceWISE driver code listing.
  • State:
    • 1 - The device is Started.
    • 2 - The device is Stopped.
    • 3 - The device is Disabled.
    • 4 - The device is Starting
    • 5 - The device is Stopping
    • 6 - Unknown

Example device list response:
[
     {"name":"System Monitor","type":"311","state":"2"},
     {"name":"TestDevice","type":"9","state":"1"}
]

devicewise.triggerList(projectName, callbackSuccess, callbackError)

Get a list of triggers for a given project.

  • projectName - Name of the project to get a list of triggers from.
  • callbackSuccess(triggers) - Callback returning a list of triggers. Each trigger contains a name, a state, the number of successful executions, number in instances in progress, and the number of failure executions.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

Response

  • Name - The name of the trigger
  • State:
    • 1 - The trigger is Started.
    • 2 - The trigger is Stopped.
    • 3 - The trigger is Disabled.
    • 4 - The device is Starting
    • 5 - The device is Stopping
    • 6 - Unknown
  • Successes - The number of executions that ended in success.
  • InProgress - The number of executions that are in progress.
  • Failures - The number of executions that ended in failure.

Example trigger list response:
[
    {"name":"TestTrigger1","state":"2","successes":"0","inProgress":"0","failures":"0"},
    {"name":"TestTrigger2","state":"2","successes":"0","inProgress":"0","failures":"0"}
]

devicewise.projectList(callbackSuccess, callbackError)

Get a list of defined projects on the deviceWISE gateway.

  • callbackSuccess(projects) - Callback returning a list of projects. Each project contains a name and a state.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

Response

  • Name - The name of the project
  • State:
    • 1 - The project is Started.
    • 2 - The project is Stopped.

Example project list response:
[
    {"name":"Project1","state":"2"},
    {"name":"Project2","state":"2"}
]

devicewise.triggerStart(projectName, triggerName, callbackSuccess, callbackError)

Start a trigger.

  • projectName - Name of the project containing the trigger.
  • triggerName - Name of the trigger.
  • callbackSuccess() - Callback called upon success.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.triggerFire(projectName, triggerName, callbackSuccess, callbackError)

Fire a trigger.

  • projectName - Name of the project containing the trigger.
  • triggerName - Name of the trigger.
  • callbackSuccess() - Callback called upon success.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.triggerStop(projectName, triggerName, callbackSuccess, callbackError)

Stop a trigger.

  • projectName - Name of the project containing the trigger.
  • triggerName - Name of the trigger.
  • callbackSuccess() - Callback called upon success.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.projectStart(projectName, callbackSuccess, callbackError)

Start a project.

  • projectName - Name of the project.
  • callbackSuccess() - Callback called upon success.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.projectStop(projectName, callbackSuccess, callbackError)

Stop a project.

  • projectName - Name of the project.
  • callbackSuccess() - Callback called upon success.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.deviceInfo(device, callbackSuccess, callbackError)

Get device information.

  • device - Name of the device to query for information.
  • callbackSuccess(xmlString) - Callback containing xml string with device information.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

Response

  • Type - The device type from the deviceWISE driver code listing. The driver code listing is in the section, deviceWISE Driver Code Listings.
  • Type_name - The device model name from the deviceWISE driver code listing.
  • State:
    • 1 - The device is Started.
    • 2 - The device is Stopped.
    • 3 - The device is Disabled.
    • 4 - The device is Starting
    • 5 - The device is Stopping
    • 6 - Unknown
  • Variable:
    • Name - Variable name
    • Type - Variable data type
    • xdim - X dimensions (array spots)
    • ydim - Y dimensions (2D array)
    • zdim - Z dimensions (3D array)

Example device information XML response:

<?xml version="1.0" encoding="UTF-8"?>
<DeviceDefinition name="TestDevice" type="9" type_name="Global Variables" state="1" options="2104"> <Variables> <VariableInfo name="boolArray" type="BOOL" xdim="3" options="7"/> <VariableInfo name="bool" type="BOOL" options="7"/><VariableInfo name="int1" type="INT1" options="7"/> <VariableInfo name="int2" type="INT2" options="7"/> <VariableInfo name="int4" type="INT4" options="7"/> <VariableInfo name="int8" type="INT8" options="7"/> <VariableInfo name="uint1" type="UINT1" options="7"/> <VariableInfo name="uint2" type="UINT2" options="7"/> <VariableInfo name="uint4" type="UINT4" options="7"/> <VariableInfo name="uint8" type="UINT8" options="7"/> <VariableInfo name="float4" type="FLOAT4" options="7"/> <VariableInfo name="float8" type="FLOAT8" options="7"/> <VariableInfo name="string" type="STRING" length="32" options="7"/> <VariableInfo name="boolMatrix" type="BOOL" xdim="100" options="7"/> <VariableInfo name="int1Array" type="INT1" xdim="3" options="7"/> <VariableInfo name="int2Array" type="INT2" xdim="3" options="7"/> <VariableInfo name="int4Array" type="INT4" xdim="3" options="7"/> <VariableInfo name="int8Array" type="INT8" xdim="3" options="7"/> <VariableInfo name="uint1Array" type="UINT1" xdim="3" options="7"/> <VariableInfo name="uint2Array" type="UINT2" xdim="3" options="7"/> <VariableInfo name="uint4Array" type="UINT4" xdim="3" options="7"/> <VariableInfo name="uint8Array" type="UINT8" xdim="3" options="7"/> <VariableInfo name="float4Array" type="FLOAT4" xdim="3" options="7"/> <VariableInfo name="float8Array" type="FLOAT8" xdim="3" options="7"/> <VariableInfo name="stringArray" type="STRING" xdim="3" length="32" options="7"/> </Variables><Structures/> <MappedDescriptions/> </DeviceDefinition>

devicewise.deviceStart(device, callbackSuccess, callbackError)

Start a device.

  • device - Device to start.
  • callbackSuccess(xmlString) - Callback containing xml string with device information.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.deviceStop(device, callbackSuccess, callbackError)

Stop a device.

  • device - Name of the device to stop.
  • callbackSuccess(xmlString) - Callback containing xml string with device information.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

devicewise.channelSubscribe(channel, callbackSuccess, callbackError, callbackPost)

Subscribe to a deviceWISE channel.

  • channel - channel to subscribe to.

    DW Available Channels
    PROJECT
    TRIGGER
    ALERT
    DISKWATCH_CHANNEL
    EXPORT
    FTPSERVER
    LICENSE
    LOGGING
    TIME
    SESSION
    SYSTEM
    SECURITY
    DEVICE
    MAPPER
    VARGROUP
    USEROP
    ASSET
    SAF
    MAPLOG
    TR50 SAF QUEUE
    TR50 SAF CONNECTIONS
    TR50 SAF PROFILE
  • callbackSuccess() - Callback called on success.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.
  • callbackPost(data) - Callback called when a channel post is received. The response is an array of strings containing post specific information.

Response - Example: Subscribing to channel "TRIGGER"

  • Format – ("TRIGGER", LoadStatus, ProjectName, TriggerName, Status, State, User)

  • Load Status:

    • 1 - Add
    • 2 - Delete
    • 3 - Edit
    • 4 - State Change
    • 5 - Load Status Changed
  • Project Name – The name of the project
  • Trigger Name – The name of the trigger
  • Status:
    • 1 - Loaded
    • 2 - Unloaded
    • 3 - Loading
    • 4 - Unloading
  • State:
    • 1 - Started
    • 2 - Stopped
    • 3 - Disabled
  • User – The last user of the trigger. This will only show when a user sets a state.

Log for starting and stopping trigger(bottom entry is most recent):

  • Stopping (unloading & started... stopped... unloaded & stopped)
    • TRIGGER,5,WebAPI,TestTrigger,2,2
      Load Status Change, Unloaded, Stopped
    • TRIGGER,4,WebAPI,TestTrigger,2
      Status Change, Stopped
    • TRIGGER,5,WebAPI,TestTrigger,4,1
      Load Status Change, Unloading, Started
  • Starting (loading & stopped, started, loaded & started)
    • TRIGGER,5,WebAPI,TestTrigger,1,1
      Load Status Change, Loaded, Started
    • TRIGGER,4,WebAPI,TestTrigger,1,admin
      State Change, Started, admin
    • TRIGGER,5,WebAPI,TestTrigger,3,2
      Load Status Change, Loading, Stopped

devicewise.networkPing(IPAddress, numPings, callbackSuccess, callbackError)

Ping an IP address.

  • IPAddress - IP address to ping.
  • numPings - Number of pings to send.
  • callbackSuccess(data) - Callback called on success. Returns array with response times for pings in milliseconds.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

Response:

Array of response times in milliseconds

[ping1response, ping2response, ping3response, ping4response]

Example network ping response:
[2, 3, 2, 2]

devicewise.referenceList(sourceType, source, options, callbackSuccess, callbackError)

Get a reference list.

  • sourceType - The type of the object to get references for.

    Available Reference Types
    Administration
    Local Database
    Security
    TR50 Connection
    device
    alerts
    attention bit
    dbtable
    ftp server
    os
    license
    policy
    project
    report
    role
    system
    timesync
    transaction
    transport
    trigger
    user
  • source - The name of the object to get references for. Must be the same type as sourceType.
  • Reference Direction:
    • 0 - Forward - Referenced by source
    • 1 - Backwards - References of source
    • 2 - Both - All references of the source and by the source.
  • callbackSuccess(data) - Callback called on success. Returns xml string containing reference information.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

Returned XML

  • crossreference name - Name of the source.
  • referencedby name - Name of what's referencing the source.
  • type - The type of reference.

Example reference list response:

<?xml version="1.0" encoding="UTF-8"?> 
<crossreference name="TestDevice" type="device">
<referenceby name="WebAPI/TestTrigger" type="trigger">
<referenceby name="WebAPI" type="project"/>
</referenceby>
</crossreference>

This example is showing that TestDevice is a device that is being referenced by the trigger WebAPI/TestTrigger as well as the project WebAPI. This makes sense because TestDevice is used by one trigger, WebAPI/TestTrigger, which is part of the project WebAPI.

devicewise.SQLiteExec(query, callbackSuccess, callbackError)

Execute SQLite query.

  • query - Query string to be executed.
  • callbackSuccess(data) - Callback handling SQLite response. Response is an array of data whose structure is based on the query type.
  • callbackError(errorCode) - Callback called if an error occurs. Returns errorCode.

Example SQLiteExec response 1

  • Query: insert into SampleTable values ("samplevalue")
  • Response: Affected Rows: 1

Example SQLiteExec response 2

  • Query: SELECT * FROM SampleTable;
  • Response: 1,1,SampleTable;,SampleColumn,samplevalue

Error Codes

Error codes can be looked up from the deviceWISE Workbench by selecting the Help menu in the upper right hand corner, and then selecting Error Lookup.

Demo web application

The Demo Web App is a web browser based application that allows you to test all the WebSocket API Extension Javascript library functions.

The WebSocketAPI_Demo_Project_and_Device.dwx includes a sample deviceWISE project, trigger, and device for testing the demo web app.

The  Demo Table can be imported if you want to test the SQLite library function.

To run the demo web application:

The demo web application user interface should look similar to this: