({{, (RefLink[DeviceExecuteAsynchronous, paclet:ref/DeviceExecuteAsynchronous])[device,"command",fun] 
initiates asynchronous execution of the specified command on a device, calling the handler function fun when an event occurs.}, {, (RefLink[DeviceExecuteAsynchronous, paclet:ref/DeviceExecuteAsynchronous])[device,"command",params,fun]
executes the command with the parameters params.}})

OpenersNotesSection(Spacer1)Details

A device can be specified either by a (RefLink[DeviceObject, paclet:ref/DeviceObject]) or by a string representing a device class.

(RefLink[DeviceExecuteAsynchronous, paclet:ref/DeviceExecuteAsynchronous]) is a non-blocking function that returns an (RefLink[AsynchronousTaskObject, paclet:ref/AsynchronousTaskObject]).

The parameters params can be given either as a list of raw parameters or as an association or list of rules giving names and values of parameters.

The form in which specifications of events are fed to the handler function varies from one device to another.

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Asynchronously read from a demo device that retrieves cookies from a specified URL, calling (RefLink[URLFetchAsynchronous, paclet:ref/URLFetchAsynchronous]) in the background:

fun[_, "cookies", data_]:=cookies=data

DeviceExecuteAsynchronous[DeviceOpen["AsynchronousDemo"],"Read","wolfram.com",fun];

The retrieved cookies:

cookies

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[DeviceExecute, paclet:ref/DeviceExecute])  ▪  (RefLink[DeviceStreams, paclet:ref/DeviceStreams])  ▪  (RefLink[TaskResume, paclet:ref/TaskResume])  ▪  (RefLink[TaskSuspend, paclet:ref/TaskSuspend])  ▪  (RefLink[URLSubmit, paclet:ref/URLSubmit])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Developing Device Drivers, paclet:tutorial/DevelopingDeviceDrivers])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Using Connected Devices, paclet:guide/UsingConnectedDevices])}, {▪(RefLinkPlain[Background & Scheduled Tasks, paclet:guide/BackgroundAndScheduledTasks])}, {▪(RefLinkPlain[Raspberry Pi, paclet:guide/RaspberryPi])}})}})