Hi,
Via bluetooth, a write request is sent to a device using shell wait for (shl) shl_ProcessCompleted.
After successful completion, a read request is sent to a device using (again) shell wait for (shl) shl_ProcessCompleted.
The stdout of the read request is converted to a Double which is assigned to a global variable.
Pseudo Code (Temperature is a global double) defined in a Class
Private Sub Temperature_GetRS As ResumableSub
Temperature_Request
Wait for Temperature_Request_Complete
Temperature_Read
Wait For Temperature_Read_Complete
Log($"Temperature: ${NumberFormat(Temperature, 0,2)}"$)
Return Temperature
End Sub
Question: Is there a way to return the result from the sub?
The intention is to use the sub Temperature_Get from other classes, i.e. T = MyClass.Temperature_Get
Tried below but getting an error "Resumable return type must be resumable sub".
Sub Temperature_Get As Double
Dim rs As ResumableSub = Temperature_GetRS
Wait For(rs) Complete (Result As Double)
Temperature = Result
End Sub