BusyBar
Namespace: Busy.Bar
A typed client for the BUSY Bar HTTP API. Aggregates every namespace
(Account, Assets, Audio, Ble, Busy, Display, Input, Settings, SmartHome, Storage,
System, Time, Update, Wifi) on one instance, mirroring @busy-app/busy-lib.
public sealed class BusyBar : System.IDisposable
Inheritance Object → BusyBar
Implements IDisposable
Attributes NullableContextAttribute, NullableAttribute
Constructors
BusyBar()
Connects using the default options (10.0.4.20 over USB-Ethernet).
public BusyBar()
BusyBar(BusyBarOptions)
Connects using the given options.
public BusyBar(BusyBarOptions options)
Parameters
options BusyBarOptions
BusyBar(HttpClient, BusyBarOptions)
Connects using a caller-supplied, already-configured System.Net.Http.HttpClient — e.g. one obtained from
IHttpClientFactory, or with custom System.Net.Http.HttpMessageHandlers for retry, logging, or
proxying. Use this overload instead of BusyBar.BusyBar(BusyBarOptions) when you need control over
connection pooling/lifetime or want to compose the client with other handlers. This constructor does NOT
take ownership of httpClient: BusyBar.Dispose() never disposes it, so the caller
remains responsible for its lifetime.
public BusyBar(HttpClient httpClient, BusyBarOptions options)
Parameters
httpClient HttpClient
options BusyBarOptions
Methods
AccountInfoGetAsync(RequestOptions, CancellationToken)
Retrieves the BUSY Cloud account linked to this device, if any.
public Task<AccountInfo> AccountInfoGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
AccountStatusGetAsync(RequestOptions, CancellationToken)
Retrieves the device's current MQTT connection status to BUSY Cloud.
public Task<AccountStatus> AccountStatusGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
AccountBackendGetAsync(RequestOptions, CancellationToken)
Retrieves the device's MQTT backend configuration.
public Task<AccountBackend> AccountBackendGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
AssetsUploadAsync(AssetsUploadParams, Stream, RequestOptions, CancellationToken)
Ownership of fileContent transfers to this call; it is disposed once the upload completes.
public Task<SuccessResponse> AssetsUploadAsync(AssetsUploadParams parameters, Stream fileContent, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters AssetsUploadParams
fileContent Stream
options RequestOptions?
cancellationToken CancellationToken
Returns
AssetsDeleteAsync(AssetsDeleteParams, RequestOptions, CancellationToken)
Deletes all uploaded assets for the given application.
public Task<SuccessResponse> AssetsDeleteAsync(AssetsDeleteParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters AssetsDeleteParams
options RequestOptions?
cancellationToken CancellationToken
Returns
AudioPlayAsync(AudioPlayParams, RequestOptions, CancellationToken)
Plays an audio file (e.g. a .snd file) from either the application's assets directory or the device's stock library.
public Task<SuccessResponse> AudioPlayAsync(AudioPlayParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters AudioPlayParams
options RequestOptions?
cancellationToken CancellationToken
Returns
AudioStopAsync(RequestOptions, CancellationToken)
Stops any audio currently playing.
public Task<SuccessResponse> AudioStopAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
AudioVolumeGetAsync(RequestOptions, CancellationToken)
Retrieves the device's current audio volume.
public Task<AudioVolumeInfo> AudioVolumeGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
AudioVolumeSetAsync(AudioVolumeSetParams, RequestOptions, CancellationToken)
Sets the device's audio volume.
public Task<SuccessResponse> AudioVolumeSetAsync(AudioVolumeSetParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters AudioVolumeSetParams
options RequestOptions?
cancellationToken CancellationToken
Returns
BleEnableAsync(RequestOptions, CancellationToken)
Enables the BLE module and starts advertising.
public Task<SuccessResponse> BleEnableAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
BleDisableAsync(RequestOptions, CancellationToken)
Disables the BLE module, stopping advertising.
public Task<SuccessResponse> BleDisableAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
BlePairingRemoveAsync(RequestOptions, CancellationToken)
Removes the pairing with the previously paired device, making the device discoverable again.
public Task<SuccessResponse> BlePairingRemoveAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
BleStatusGetAsync(RequestOptions, CancellationToken)
Retrieves the device's current BLE status.
public Task<BleStatusResponse> BleStatusGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
BusySnapshotGetAsync(RequestOptions, CancellationToken)
Retrieves the current state of the BUSY timer, as a snapshot.
public Task<BusySnapshot> BusySnapshotGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
BusySnapshotSetAsync(BusySnapshot, RequestOptions, CancellationToken)
Starts (or resumes) the BUSY timer from the given snapshot.
public Task<SuccessResponse> BusySnapshotSetAsync(BusySnapshot snapshot, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
snapshot BusySnapshot
options RequestOptions?
cancellationToken CancellationToken
Returns
BusyProfileGetAsync(BusyProfileSlot, RequestOptions, CancellationToken)
Retrieves the BUSY timer profile stored under the given slot.
public Task<BusyProfile> BusyProfileGetAsync(BusyProfileSlot slot, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
slot BusyProfileSlot
options RequestOptions?
cancellationToken CancellationToken
Returns
BusyProfileSetAsync(BusyProfileSlot, BusyProfile, RequestOptions, CancellationToken)
Saves a BUSY timer profile under the given slot.
public Task<SuccessResponse> BusyProfileSetAsync(BusyProfileSlot slot, BusyProfile profile, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
slot BusyProfileSlot
profile BusyProfile
options RequestOptions?
cancellationToken CancellationToken
Returns
SetToken(String)
Sets or replaces the cloud proxy bearer token at runtime.
public void SetToken(string token)
Parameters
token String
SetHttpAccessPassword(String)
Sets or replaces the LAN HTTP access password at runtime.
public void SetHttpAccessPassword(string password)
Parameters
password String
Dispose()
Disposes the underlying System.Net.Http.HttpClient, but only if this instance created it (the BusyBar.BusyBar(BusyBarOptions) overload) — a caller-supplied client (BusyBar.BusyBar(HttpClient, BusyBarOptions)) is left untouched.
public void Dispose()
DisplayDrawAsync(DisplayDrawParams, RequestOptions, CancellationToken)
Draws one or more elements on a display.
public Task<SuccessResponse> DisplayDrawAsync(DisplayDrawParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters DisplayDrawParams
options RequestOptions?
cancellationToken CancellationToken
Returns
DisplayClearAsync(DisplayClearParams, RequestOptions, CancellationToken)
Clears display elements previously drawn by the Canvas application. If parameters specifies an application name, only that application's elements are removed.
public Task<SuccessResponse> DisplayClearAsync(DisplayClearParams? parameters = null, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters DisplayClearParams?
options RequestOptions?
cancellationToken CancellationToken
Returns
DisplayScreenFrameGetAsync(ScreenFrameGetParams, RequestOptions, CancellationToken)
Captures a single frame from the requested display, as a BMP image stream.
public Task<Stream> DisplayScreenFrameGetAsync(ScreenFrameGetParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters ScreenFrameGetParams
options RequestOptions?
cancellationToken CancellationToken
Returns
Task<Stream>
A stream containing the raw BMP image data. The caller owns the returned stream and must dispose it.
DisplayBrightnessGetAsync(RequestOptions, CancellationToken)
Retrieves the device's current display brightness.
public Task<DisplayBrightnessInfo> DisplayBrightnessGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
DisplayBrightnessSetAsync(DisplayBrightnessParams, RequestOptions, CancellationToken)
Sets the device's display brightness, for one or both displays.
public Task<SuccessResponse> DisplayBrightnessSetAsync(DisplayBrightnessParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters DisplayBrightnessParams
options RequestOptions?
cancellationToken CancellationToken
Returns
InputKeySetAsync(InputKeyParams, RequestOptions, CancellationToken)
Simulates a single key press event on the device.
public Task<SuccessResponse> InputKeySetAsync(InputKeyParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters InputKeyParams
options RequestOptions?
cancellationToken CancellationToken
Returns
AccessGetAsync(RequestOptions, CancellationToken)
Gets the device's HTTP API access over Wi-Fi configuration.
public Task<HttpAccessInfo> AccessGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
AccessSetAsync(AccessSetParams, RequestOptions, CancellationToken)
Sets the device's HTTP API access over Wi-Fi configuration.
public Task<SuccessResponse> AccessSetAsync(AccessSetParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters AccessSetParams
options RequestOptions?
cancellationToken CancellationToken
Returns
NameGetAsync(RequestOptions, CancellationToken)
Gets the device's current display name.
public Task<NameInfo> NameGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
NameSetAsync(NameInfo, RequestOptions, CancellationToken)
Sets the device's display name.
public Task<SuccessResponse> NameSetAsync(NameInfo parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters NameInfo
options RequestOptions?
cancellationToken CancellationToken
Returns
SmartHomePairingGetAsync(RequestOptions, CancellationToken)
Gets the device's smart home commissioning status.
public Task<SmartHomePairingInfo> SmartHomePairingGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
SmartHomePairingStartAsync(RequestOptions, CancellationToken)
Starts pairing ("commissioning") the device into a Matter smart home, returning the QR/manual codes needed to complete pairing.
public Task<SmartHomePairingPayload> SmartHomePairingStartAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
SmartHomePairingEraseAsync(RequestOptions, CancellationToken)
Erases all smart home pairing info from the device. A device restart is needed for this to take effect.
public Task<SuccessResponse> SmartHomePairingEraseAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
SmartHomeSwitchGetAsync(RequestOptions, CancellationToken)
Gets the state of the device's emulated smart home switch.
public Task<SmartHomeSwitchState> SmartHomeSwitchGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
SmartHomeSwitchSetAsync(SmartHomeSwitchState, RequestOptions, CancellationToken)
Sets the state of the device's emulated smart home switch.
public Task<SuccessResponse> SmartHomeSwitchSetAsync(SmartHomeSwitchState state, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
state SmartHomeSwitchState
options RequestOptions?
cancellationToken CancellationToken
Returns
StorageWriteAsync(StorageWriteParams, Stream, RequestOptions, CancellationToken)
Uploads a file to internal storage. Ownership of fileContent transfers to this call; it is disposed once the upload completes.
public Task<SuccessResponse> StorageWriteAsync(StorageWriteParams parameters, Stream fileContent, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters StorageWriteParams
fileContent Stream
options RequestOptions?
cancellationToken CancellationToken
Returns
StorageReadAsync(StorageReadParams, RequestOptions, CancellationToken)
Downloads a file from internal storage.
public Task<Stream> StorageReadAsync(StorageReadParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters StorageReadParams
options RequestOptions?
cancellationToken CancellationToken
Returns
StorageListAsync(StorageListParams, RequestOptions, CancellationToken)
Lists the contents of a directory on internal storage.
public Task<StorageList> StorageListAsync(StorageListParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters StorageListParams
options RequestOptions?
cancellationToken CancellationToken
Returns
StorageRemoveAsync(StorageRemoveParams, RequestOptions, CancellationToken)
Removes a file from internal storage.
public Task<SuccessResponse> StorageRemoveAsync(StorageRemoveParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters StorageRemoveParams
options RequestOptions?
cancellationToken CancellationToken
Returns
StorageMkdirAsync(StorageMkdirParams, RequestOptions, CancellationToken)
Creates a new directory on internal storage.
public Task<SuccessResponse> StorageMkdirAsync(StorageMkdirParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters StorageMkdirParams
options RequestOptions?
cancellationToken CancellationToken
Returns
StorageRenameAsync(StorageRenameParams, RequestOptions, CancellationToken)
Renames or moves a file on internal storage.
public Task<SuccessResponse> StorageRenameAsync(StorageRenameParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters StorageRenameParams
options RequestOptions?
cancellationToken CancellationToken
Returns
StorageStatusGetAsync(RequestOptions, CancellationToken)
Gets internal storage usage.
public Task<StorageStatus> StorageStatusGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
SystemVersionGetAsync(RequestOptions, CancellationToken)
Gets the device's local HTTP API version.
public Task<VersionInfo> SystemVersionGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
SystemTransportGetAsync(RequestOptions, CancellationToken)
Gets the device's current network connection type (USB or Wi-Fi).
public Task<NetworkInterfaceInfo> SystemTransportGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
SystemStatusGetAsync(RequestOptions, CancellationToken)
Gets combined device, firmware, system, and power status.
public Task<SystemStatus> SystemStatusGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
SystemStatusDeviceGetAsync(RequestOptions, CancellationToken)
Gets hardware identity and provisioning information for the device.
public Task<StatusDevice> SystemStatusDeviceGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
SystemStatusFirmwareGetAsync(RequestOptions, CancellationToken)
Gets firmware build and version information for the device.
public Task<StatusFirmware> SystemStatusFirmwareGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
SystemStatusSystemGetAsync(RequestOptions, CancellationToken)
Gets general system status information.
public Task<StatusSystem> SystemStatusSystemGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
SystemStatusPowerGetAsync(RequestOptions, CancellationToken)
Gets power and battery status.
public Task<StatusPower> SystemStatusPowerGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
SystemLogDumpAsync(LogDumpParams, RequestOptions, CancellationToken)
Snapshots the device's in-memory log buffer to a file on internal storage.
public Task<LogDumpResult> SystemLogDumpAsync(LogDumpParams? parameters = null, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters LogDumpParams?
options RequestOptions?
cancellationToken CancellationToken
Returns
TimeGetAsync(RequestOptions, CancellationToken)
Gets the device's current real-time-clock timestamp, with timezone, in ISO 8601 format.
public Task<TimestampInfo> TimeGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
TimeSetTimestampAsync(TimeSetTimestampParams, RequestOptions, CancellationToken)
Sets the device's real-time-clock timestamp.
public Task<SuccessResponse> TimeSetTimestampAsync(TimeSetTimestampParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters TimeSetTimestampParams
options RequestOptions?
cancellationToken CancellationToken
Returns
TimeTimezoneGetAsync(RequestOptions, CancellationToken)
Gets the device's current timezone.
public Task<TimezoneInfo> TimeTimezoneGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
TimeTimezoneSetAsync(TimeSetTimezoneParams, RequestOptions, CancellationToken)
Sets the device's timezone. Use BusyBar.TimeTzlistGetAsync(RequestOptions, CancellationToken) to get the list of accepted names.
public Task<SuccessResponse> TimeTimezoneSetAsync(TimeSetTimezoneParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters TimeSetTimezoneParams
options RequestOptions?
cancellationToken CancellationToken
Returns
TimeTzlistGetAsync(RequestOptions, CancellationToken)
Gets the list of time zones accepted by BusyBar.TimeTimezoneSetAsync(TimeSetTimezoneParams, RequestOptions, CancellationToken).
public Task<TimezoneListResponse> TimeTzlistGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
UpdateFirmwareAsync(Stream, RequestOptions, CancellationToken)
Uploads a firmware update package (TAR file) and initiates the update process; the device reboots once
the update is applied. Ownership of firmwareTar transfers to this call; it is disposed
once the upload completes.
public Task<SuccessResponse> UpdateFirmwareAsync(Stream firmwareTar, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
firmwareTar Stream
options RequestOptions?
cancellationToken CancellationToken
Returns
UpdateCheckAsync(RequestOptions, CancellationToken)
Starts an asynchronous check for available firmware updates. Use BusyBar.UpdateStatusGetAsync(RequestOptions, CancellationToken) to monitor progress.
public Task<SuccessResponse> UpdateCheckAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
UpdateStatusGetAsync(RequestOptions, CancellationToken)
Gets the current firmware update installation and update-check status, including progress information.
public Task<UpdateStatus> UpdateStatusGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
UpdateChangelogGetAsync(UpdateChangelogParams, RequestOptions, CancellationToken)
Gets the changelog for a specific firmware version.
public Task<UpdateChangelogResult> UpdateChangelogGetAsync(UpdateChangelogParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters UpdateChangelogParams
options RequestOptions?
cancellationToken CancellationToken
Returns
UpdateInstallAsync(UpdateInstallParams, RequestOptions, CancellationToken)
Starts asynchronous firmware installation of the given version from a remote URL. The update process (download, SHA verification, unpack, prepare, apply, reboot) runs in the background; use BusyBar.UpdateStatusGetAsync(RequestOptions, CancellationToken) to monitor progress.
public Task<SuccessResponse> UpdateInstallAsync(UpdateInstallParams parameters, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
parameters UpdateInstallParams
options RequestOptions?
cancellationToken CancellationToken
Returns
UpdateAbortDownloadAsync(RequestOptions, CancellationToken)
Signals the updater to abort an ongoing firmware package download.
public Task<SuccessResponse> UpdateAbortDownloadAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
UpdateAutoupdateGetAsync(RequestOptions, CancellationToken)
Gets the device's current automatic-update configuration.
public Task<AutoupdateSettings> UpdateAutoupdateGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken
Returns
UpdateAutoupdateSetAsync(AutoupdateSettings, RequestOptions, CancellationToken)
Sets the device's automatic-update configuration. Only the fields provided in settings are updated.
public Task<SuccessResponse> UpdateAutoupdateSetAsync(AutoupdateSettings settings, RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
settings AutoupdateSettings
options RequestOptions?
cancellationToken CancellationToken
Returns
WifiStatusGetAsync(RequestOptions, CancellationToken)
Gets the device's current Wi-Fi status.
public Task<WifiStatusResponse> WifiStatusGetAsync(RequestOptions? options = null, CancellationToken cancellationToken = null)
Parameters
options RequestOptions?
cancellationToken CancellationToken