Method ExecuteAsync
Namespace: Belay.Core
Assembly: Belay.Core.dll
ExecuteAsync(string, CancellationToken)
Executes Python code on the device using sophisticated adaptive Raw REPL protocol. Includes comprehensive input validation and security checks to prevent code injection.
csharp
public Task<string> ExecuteAsync(string code, CancellationToken cancellationToken = default)Parameters
code string
The Python code to execute.
cancellationToken CancellationToken
Cancellation token.
Returns
The execution result.
Exceptions
Thrown when code is null.
Thrown when code fails security validation.
Thrown when device execution fails.
ExecuteAsync<T>(string, CancellationToken)
Executes code and returns typed result (simplified generic version).
csharp
public Task<T> ExecuteAsync<T>(string code, CancellationToken cancellationToken = default)Parameters
code string
The Python code to execute.
cancellationToken CancellationToken
Cancellation token for the operation.
Returns
Task<T>
The execution result converted to the specified type.
Type Parameters
T
The type to convert the result to.