Serves as the base class for managing and interacting with MedWand devices. More...
Inherits IDisposable.
Inherited by MWSDK.Wpf.MedWandController.
Public Member Functions | |
| void | Construct (string licenseString, string publicKey) |
| Initializes the MedWand controller with the provided license information and public key. | |
| void | Connect () |
| Establishes a connection to the MedWand device. | |
| void | Initialize () |
| Initializes the MedWand device, setting it to the DeviceState.Initialized state if successful. | |
| bool | IsBootloaderMode (bool forceCheck=false) |
| Determines whether the device is currently in bootloader mode. | |
Public Attributes | |
| string | DeviceName = "MedWand" |
| Represents the name of the MedWand device. | |
Properties | |
| bool | IsLicenseValid [get] |
| Gets a value indicating whether the license associated with the MedWand device is valid. | |
| DeviceState | DeviceState [get] |
| Gets the current state of the MedWand device. | |
| ReadingState | ReadingState [get] |
| Gets the current state of the reading process for the MedWand device. | |
| bool | IsConnected [get] |
| Gets a value indicating whether the MedWand device is currently connected. | |
| bool | IsInitialized [get] |
| Gets a value indicating whether the MedWand device has been successfully initialized. | |
| string | LicenseInfo [get] |
| Gets the license information associated with the current instance of the MedWand controller. | |
| bool | CanUseStethoscope [get] |
| Gets a value indicating whether the stethoscope feature can be used with the current license. | |
| bool | CanUseCamera [get] |
| Gets a value indicating whether the camera feature can be used based on the current license. | |
| bool | CanUseEcg [get] |
| Gets a value indicating whether the ECG (Electrocardiogram) feature can be used. | |
| string? | ComPort [get] |
| Gets the name of the COM port associated with the MedWand device. | |
| string? | VendorId [get] |
| Gets the Vendor ID of the connected MedWand device. | |
| string? | ProductId [get] |
| Gets the product identifier of the connected MedWand device. | |
| Version? | FirmwareVersion [get] |
| Gets the firmware version of the connected MedWand device. | |
| string | DeviceId [get] |
| Gets the unique identifier of the connected MedWand device. | |
| MedWandGeneration | Generation [get] |
| Gets the generation of the MedWand device. | |
| string | Udi [get] |
| Gets the Unique Device Identifier (UDI) of the connected MedWand device. | |
| MedWandReading | LastReading [get] |
| Gets the most recent reading data from the MedWand sensor. | |
| MedWandSensor | ActiveSensor [get] |
| Gets the currently active sensor on the MedWand device. | |
| int | LedIntensity [get] |
| Gets the current intensity level of the LED. | |
Events | |
| Action< LicenseState >? | LicenseError |
| Occurs when there is an issue with the license state of the MedWand device. | |
| Action< DeviceState >? | DeviceStateChanged |
| Occurs when the state of the MedWand device changes. | |
| Action< MedWandDeviceError >? | DeviceError |
| Occurs when an error related to the MedWand device is encountered. | |
| Action< ReadingState >? | ReadingStateChanged |
| Occurs when the reading state of the MedWand device changes. | |
| Action< MedWandReading >? | ReadingReceived |
| Occurs when a new reading is received from the MedWand device. | |
| Action< int >? | LedIntensityChanged |
| Occurs when the LED intensity of the MedWand device changes. | |
Serves as the base class for managing and interacting with MedWand devices.
This abstract class provides core functionality for configuring, initializing, and controlling MedWand devices.
It includes support for licensing, device state management, sensor operations, and event handling.
Derived classes can extend this functionality to implement specific use cases or platform-specific features.
| void MWSDK.NetCore.MedWandControllerBase.Connect | ( | ) |
Establishes a connection to the MedWand device.
This method attempts to locate and connect to the MedWand device via the serial port. It validates the license, configures the serial port, and initializes communication threads.
| AccessViolationException | Thrown if the license is invalid or if the serial port fails to connect. |
| KeyNotFoundException | Thrown if the MedWand device cannot be found. |
| IOException | Thrown if the serial port fails to open. |
| Exception | Thrown for any other unexpected errors during the connection process. |
| void MWSDK.NetCore.MedWandControllerBase.Construct | ( | string | licenseString, |
| string | publicKey ) |
Initializes the MedWand controller with the provided license information and public key.
| licenseString | The license string required to initialize the MedWand controller. This value must not be null or empty. |
| publicKey | The public key associated with the license string. This value must not be null or empty. |
If the license is invalid, expired, or nearing expiration, the LicenseError event will be triggered.
| ArgumentException | Thrown when licenseString or publicKey is null or empty. |
Example usage:
| void MWSDK.NetCore.MedWandControllerBase.Initialize | ( | ) |
Initializes the MedWand device, setting it to the DeviceState.Initialized state if successful.
| AccessViolationException | Thrown when the license is invalid. |
| Exception | Thrown when the device is not connected, fails to send the initialization command, does not respond to the initialization command, or the initialization result is unsuccessful. |
This method ensures that the MedWand device is properly initialized and ready for use. It transitions the device state to DeviceState.Initializing during the process and to DeviceState.Initialized upon successful completion. If an error occurs, the device state is set to DeviceState.Error.
| bool MWSDK.NetCore.MedWandControllerBase.IsBootloaderMode | ( | bool | forceCheck = false | ) |
Determines whether the device is currently in bootloader mode.
| forceCheck | If set to true, forces a fresh check of the device's bootloader mode status, bypassing any cached results. Defaults to false. |
true if the device is in bootloader mode; otherwise, false. This method communicates with the device to verify its bootloader mode status. If forceCheck is false, the method may return a cached result if the last check occurred within the past 10 minutes.
| InvalidOperationException | Thrown if the device fails to respond or an error occurs during the check. |
| string MWSDK.NetCore.MedWandControllerBase.DeviceName = "MedWand" |
Represents the name of the MedWand device.
This field is initialized with the default value "MedWand".
|
get |
Gets the currently active sensor on the MedWand device.
A MedWandSensor value representing the sensor currently in use. Defaults to MedWandSensor.None if no sensor is active.
The active sensor is managed by the internal reading state machine and is updated when a sensor is started or stopped. Ensure that no other sensor is active before starting a new one to avoid conflicts.
|
get |
Gets a value indicating whether the camera feature can be used based on the current license.
true if the camera feature is available; otherwise, false.
This property checks the license to determine if the "Camera" feature is enabled.
|
get |
Gets a value indicating whether the ECG (Electrocardiogram) feature can be used.
true if the ECG feature is available and licensed; otherwise, false.
This property checks the license to determine if the ECG feature is enabled.
|
get |
Gets a value indicating whether the stethoscope feature can be used with the current license.
true if the stethoscope feature is available; otherwise, false.
This property checks the license to determine if the "Stethoscope" feature is enabled.
|
get |
Gets the name of the COM port associated with the MedWand device.
A string representing the COM port name, or null if no COM port is assigned.
The COM port is used for communication with the MedWand device. Ensure that the device is properly connected and recognized by the system to retrieve a valid COM port.
|
get |
Gets the unique identifier of the connected MedWand device.
The DeviceId property retrieves the device's unique identifier. If the identifier is not already cached, it attempts to fetch it by transmitting the appropriate command to the device and waiting for a response.
A string representing the unique identifier of the MedWand device. Returns an empty string if the identifier cannot be retrieved.
|
get |
Gets the current state of the MedWand device.
The DeviceState property reflects the current operational state of the device, such as whether it is connected, disconnected, initializing, or in an error state. Changes to this property trigger the DeviceStateChanged event.
A DeviceState enumeration value representing the current state of the device.
|
get |
Gets the firmware version of the connected MedWand device.
The firmware version is retrieved from the device during the connection process. If the firmware version cannot be determined, a default version of 0.0.0.0 is returned.
A Version object representing the firmware version of the device, or null if the device is not connected.
|
get |
Gets the generation of the MedWand device.
The generation is determined based on the device's unique identifier or by querying the device. Possible values include MedWandGeneration.Generation1, MedWandGeneration.Generation2, MedWandGeneration.Generation25, MedWandGeneration.Unknown, and MedWandGeneration.NotReady.
A MedWandGeneration value representing the generation of the MedWand device.
|
get |
Gets a value indicating whether the MedWand device is currently connected.
A device is considered connected if its state is one of the following: DeviceState.Connected, DeviceState.Initializing, or DeviceState.Initialized.
true if the device is connected; otherwise, false.
|
get |
Gets a value indicating whether the MedWand device has been successfully initialized.
true if the device is initialized; otherwise, false.
The IsInitialized property reflects the initialization state of the MedWand device. It becomes true after the device has completed the initialization process successfully.
|
get |
Gets a value indicating whether the license associated with the MedWand device is valid.
true if the license is valid; otherwise, false.
This property is determined by the internal license controller and reflects the current state of the license.
|
get |
Gets the most recent reading data from the MedWand sensor.
An instance of MedWandReading containing the latest sensor data, such as timestamp, status, and various measurement values.
|
get |
Gets the current intensity level of the LED.
An integer representing the LED intensity level.
The LED intensity level is managed internally and can be adjusted using the appropriate methods. Changes to the intensity level trigger the LedIntensityChanged event.
|
get |
Gets the license information associated with the current instance of the MedWand controller.
This property retrieves a string representation of the license details managed by the underlying license controller.
A string containing the license information.
The following example demonstrates how to access the license information:
|
get |
Gets the product identifier of the connected MedWand device.
A string representing the product identifier, or null if the product identifier is unavailable.
The product identifier is typically used to uniquely identify the connected device model.
|
get |
Gets the current state of the reading process for the MedWand device.
The ReadingState property reflects the operational state of the device's reading mechanism. Possible states include ReadingState.Stopped, ReadingState.Starting, ReadingState.Started, ReadingState.Reading, ReadingState.Recording, ReadingState.Stopping, and ReadingState.Error.
A ReadingState enumeration value representing the current state of the reading process.
|
get |
Gets the Unique Device Identifier (UDI) of the connected MedWand device.
The UDI is a globally unique identifier that provides detailed information about the device. If the UDI is not already cached, this property attempts to retrieve it from the device.
A string representing the UDI of the device, or an empty string if the UDI could not be retrieved.
|
get |
Gets the Vendor ID of the connected MedWand device.
The Vendor ID is a unique identifier assigned to the manufacturer of the device. This property retrieves the value from the underlying serial port service.
A string representing the Vendor ID of the device, or null if unavailable.
| Action<MedWandDeviceError>? MWSDK.NetCore.MedWandControllerBase.DeviceError |
Occurs when an error related to the MedWand device is encountered.
This event is triggered to notify about various device-related errors, such as connection issues, serial port errors, or other device-specific problems. The event provides detailed error information through the MedWandDeviceError parameter.
Example usage:
| Action<DeviceState>? MWSDK.NetCore.MedWandControllerBase.DeviceStateChanged |
Occurs when the state of the MedWand device changes.
This event is triggered whenever the DeviceState property transitions to a new state. It can be used to monitor the connection status, initialization progress, or other state changes of the MedWand device.
Example usage:
| Action<int>? MWSDK.NetCore.MedWandControllerBase.LedIntensityChanged |
Occurs when the LED intensity of the MedWand device changes.
This event is triggered whenever the LED intensity is updated via the SetLedIntensity method. Subscribers can use this event to respond to changes in the LED intensity, such as updating UI elements or logging.
Example usage:
| Action<LicenseState>? MWSDK.NetCore.MedWandControllerBase.LicenseError |
Occurs when there is an issue with the license state of the MedWand device.
This event is triggered in scenarios such as:
To handle license errors, subscribe to this event:
| Action<MedWandReading>? MWSDK.NetCore.MedWandControllerBase.ReadingReceived |
Occurs when a new reading is received from the MedWand device.
This event is triggered whenever the MedWand device processes and provides a new reading. The event handler receives a MedWandReading object containing the details of the reading.
Example usage:
| Action<ReadingState>? MWSDK.NetCore.MedWandControllerBase.ReadingStateChanged |
Occurs when the reading state of the MedWand device changes.
This event is triggered whenever the ReadingState property of the MedWand device changes. It provides the updated ReadingState as an argument to the event handler.
To handle this event, you can subscribe to it as follows: