BLEServer Component
Properties Methods Events Config Settings Errors
TBD.
Syntax
nsoftware.IPWorksBLE.BLEServer
Remarks
TBD.
Property List
The following is the full list of the properties of the component with short descriptions. Click on the links for further details.
| Listening | This property indicates whether the component is listening for incoming connections on LocalPort. |
| ServerId | TBD. |
Method List
The following is the full list of the methods of the component with short descriptions. Click on the links for further details.
| AddCharacteristic | TBD. |
| Config | Sets or retrieves a configuration setting. |
| DoEvents | This method processes events from the internal message queue. |
| StartListening | TBD. |
| StopListening | TBD. |
Event List
The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.
| AdvertisementStatusChanged | TBD. |
| Connected | TBD. |
| Disconnected | TBD. |
| Error | Fired when information is available about errors during data delivery. |
| Log | Fires once for each log message. |
| ReadRequested | TBD. |
| SessionStatusChanged | TBD. |
| SubscriptionChanged | TBD. |
| WriteRequested | TBD. |
Config Settings
The following is a list of config settings for the component with short descriptions. Click on the links for further details.
| LogLevel | The level of detail that is logged. |
| BuildInfo | Information about the product's build. |
| GUIAvailable | Whether or not a message loop is available for processing events. |
| LicenseInfo | Information about the current license. |
| MaskSensitiveData | Whether sensitive data is masked in log messages. |
| UseInternalSecurityAPI | Whether or not to use the system security libraries or an internal implementation. |
Listening Property (BLEServer Component)
This property indicates whether the component is listening for incoming connections on LocalPort.
Syntax
Default Value
False
Remarks
This property indicates whether the component is listening for connections on the port specified by the LocalPort property. Use the StartListening and StopListening methods to control whether the component is listening.
This property is read-only and not available at design time.
ServerId Property (BLEServer Component)
TBD.
Syntax
Default Value
""
Remarks
TBD.
This property is not available at design time.
AddCharacteristic Method (BLEServer Component)
TBD.
Syntax
public void AddCharacteristic(string serviceId, string characteristicId, int props); Async Version public async Task AddCharacteristic(string serviceId, string characteristicId, int props); public async Task AddCharacteristic(string serviceId, string characteristicId, int props, CancellationToken cancellationToken);
Public Sub AddCharacteristic(ByVal ServiceId As String, ByVal CharacteristicId As String, ByVal Props As Integer) Async Version Public Sub AddCharacteristic(ByVal ServiceId As String, ByVal CharacteristicId As String, ByVal Props As Integer) As Task Public Sub AddCharacteristic(ByVal ServiceId As String, ByVal CharacteristicId As String, ByVal Props As Integer, cancellationToken As CancellationToken) As Task
Remarks
TBD.
Config Method (BLEServer Component)
Sets or retrieves a configuration setting.
Syntax
Remarks
Config is a generic method available in every component. It is used to set and retrieve configuration settings for the component.
These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.
To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.
DoEvents Method (BLEServer Component)
This method processes events from the internal message queue.
Syntax
public void DoEvents(); Async Version public async Task DoEvents(); public async Task DoEvents(CancellationToken cancellationToken);
Public Sub DoEvents() Async Version Public Sub DoEvents() As Task Public Sub DoEvents(cancellationToken As CancellationToken) As Task
Remarks
When DoEvents is called, the component processes any available events. If no events are available, it waits for a preset period of time, and then returns.
StartListening Method (BLEServer Component)
TBD.
Syntax
public void StartListening(string serviceId); Async Version public async Task StartListening(string serviceId); public async Task StartListening(string serviceId, CancellationToken cancellationToken);
Public Sub StartListening(ByVal ServiceId As String) Async Version Public Sub StartListening(ByVal ServiceId As String) As Task Public Sub StartListening(ByVal ServiceId As String, cancellationToken As CancellationToken) As Task
Remarks
TBD.
StopListening Method (BLEServer Component)
TBD.
Syntax
public void StopListening(string serviceId); Async Version public async Task StopListening(string serviceId); public async Task StopListening(string serviceId, CancellationToken cancellationToken);
Public Sub StopListening(ByVal ServiceId As String) Async Version Public Sub StopListening(ByVal ServiceId As String) As Task Public Sub StopListening(ByVal ServiceId As String, cancellationToken As CancellationToken) As Task
Remarks
TBD.
AdvertisementStatusChanged Event (BLEServer Component)
TBD.
Syntax
public event OnAdvertisementStatusChangedHandler OnAdvertisementStatusChanged; public delegate void OnAdvertisementStatusChangedHandler(object sender, BLEServerAdvertisementStatusChangedEventArgs e); public class BLEServerAdvertisementStatusChangedEventArgs : EventArgs { public int Status { get; } public int Error { get; } }
Public Event OnAdvertisementStatusChanged As OnAdvertisementStatusChangedHandler Public Delegate Sub OnAdvertisementStatusChangedHandler(sender As Object, e As BLEServerAdvertisementStatusChangedEventArgs) Public Class BLEServerAdvertisementStatusChangedEventArgs Inherits EventArgs Public ReadOnly Property Status As Integer Public ReadOnly Property Error As Integer End Class
Remarks
TBD.
Connected Event (BLEServer Component)
TBD.
Syntax
public event OnConnectedHandler OnConnected; public delegate void OnConnectedHandler(object sender, BLEServerConnectedEventArgs e); public class BLEServerConnectedEventArgs : EventArgs { public string ClientId { get; } public int StatusCode { get; } public string Description { get; } }
Public Event OnConnected As OnConnectedHandler Public Delegate Sub OnConnectedHandler(sender As Object, e As BLEServerConnectedEventArgs) Public Class BLEServerConnectedEventArgs Inherits EventArgs Public ReadOnly Property ClientId As String Public ReadOnly Property StatusCode As Integer Public ReadOnly Property Description As String End Class
Remarks
TBD.
Disconnected Event (BLEServer Component)
TBD.
Syntax
public event OnDisconnectedHandler OnDisconnected; public delegate void OnDisconnectedHandler(object sender, BLEServerDisconnectedEventArgs e); public class BLEServerDisconnectedEventArgs : EventArgs { public string ClientId { get; } public int StatusCode { get; } public string Description { get; } }
Public Event OnDisconnected As OnDisconnectedHandler Public Delegate Sub OnDisconnectedHandler(sender As Object, e As BLEServerDisconnectedEventArgs) Public Class BLEServerDisconnectedEventArgs Inherits EventArgs Public ReadOnly Property ClientId As String Public ReadOnly Property StatusCode As Integer Public ReadOnly Property Description As String End Class
Remarks
TBD.
Error Event (BLEServer Component)
Fired when information is available about errors during data delivery.
Syntax
public event OnErrorHandler OnError; public delegate void OnErrorHandler(object sender, BLEServerErrorEventArgs e); public class BLEServerErrorEventArgs : EventArgs { public int ErrorCode { get; } public string Description { get; } }
Public Event OnError As OnErrorHandler Public Delegate Sub OnErrorHandler(sender As Object, e As BLEServerErrorEventArgs) Public Class BLEServerErrorEventArgs Inherits EventArgs Public ReadOnly Property ErrorCode As Integer Public ReadOnly Property Description As String End Class
Remarks
The Error event is fired in case of exceptional conditions during message processing. Normally the component throws an exception.
The ErrorCode parameter contains an error code, and the Description parameter contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.
Log Event (BLEServer Component)
Fires once for each log message.
Syntax
public event OnLogHandler OnLog; public delegate void OnLogHandler(object sender, BLEServerLogEventArgs e); public class BLEServerLogEventArgs : EventArgs { public int LogLevel { get; } public string Message { get; } public string LogType { get; } }
Public Event OnLog As OnLogHandler Public Delegate Sub OnLogHandler(sender As Object, e As BLEServerLogEventArgs) Public Class BLEServerLogEventArgs Inherits EventArgs Public ReadOnly Property LogLevel As Integer Public ReadOnly Property Message As String Public ReadOnly Property LogType As String End Class
Remarks
This events fires once for each log message generated by the component. The verbosity is controlled by the LogLevel setting.
LogLevel indicates the level of the Message. Possible values are:
| 0 (None) | No events are logged. |
| 1 (Info - default) | Informational events are logged. |
| 2 (Verbose) | Detailed data is logged. |
| 3 (Debug) | Debug data is logged. |
The default log level, Info, provides information when most BLE operations begin and end, and should be sufficient to get a good idea of what the component is doing at a high level.
The Verbose log level adds a few extra operation timing messages, and adds more detail to some messages logged at the Info level.
The Debug log level causes the component to output as much information as possible about what it is doing at all times. All BLE communications, even those which are typically abstracted away by the API, are logged in full detail. Typically the additional information added by this log level is not helpful to the end user, and would only be necessary to capture if you wish to report an issue to the support team.
LogType identifies the type of log entry. Possible values are:
- Scanning: Messages relating to scanning and advertisements.
- Connection: Messages relating to connecting, disconnecting, and connection failures.
- Discovery: Messages relating to any service, characteristic, or descriptor discovery process.
- Read: Messages relating to reading values from the remote device.
- Write: Messages relating to writing values to the remote device.
- Subscriptions: Messages relating to subscribing to and unsubscribing from characteristics.
- Info, Verbose, and Debug: Miscellaneous messages fired at the applicable log level concerning internal component operations.
ReadRequested Event (BLEServer Component)
TBD.
Syntax
public event OnReadRequestedHandler OnReadRequested; public delegate void OnReadRequestedHandler(object sender, BLEServerReadRequestedEventArgs e); public class BLEServerReadRequestedEventArgs : EventArgs { public string ClientId { get; } public string ServiceId { get; } public string CharacteristicId { get; } public string ResponseValue { get; set; } public bool Accept { get; set; } }
Public Event OnReadRequested As OnReadRequestedHandler Public Delegate Sub OnReadRequestedHandler(sender As Object, e As BLEServerReadRequestedEventArgs) Public Class BLEServerReadRequestedEventArgs Inherits EventArgs Public ReadOnly Property ClientId As String Public ReadOnly Property ServiceId As String Public ReadOnly Property CharacteristicId As String Public Property ResponseValue As String Public Property Accept As Boolean End Class
Remarks
TBD.
SessionStatusChanged Event (BLEServer Component)
TBD.
Syntax
public event OnSessionStatusChangedHandler OnSessionStatusChanged; public delegate void OnSessionStatusChangedHandler(object sender, BLEServerSessionStatusChangedEventArgs e); public class BLEServerSessionStatusChangedEventArgs : EventArgs { public string ClientId { get; } public int Status { get; } public int Error { get; } }
Public Event OnSessionStatusChanged As OnSessionStatusChangedHandler Public Delegate Sub OnSessionStatusChangedHandler(sender As Object, e As BLEServerSessionStatusChangedEventArgs) Public Class BLEServerSessionStatusChangedEventArgs Inherits EventArgs Public ReadOnly Property ClientId As String Public ReadOnly Property Status As Integer Public ReadOnly Property Error As Integer End Class
Remarks
TBD.
SubscriptionChanged Event (BLEServer Component)
TBD.
Syntax
public event OnSubscriptionChangedHandler OnSubscriptionChanged; public delegate void OnSubscriptionChangedHandler(object sender, BLEServerSubscriptionChangedEventArgs e); public class BLEServerSubscriptionChangedEventArgs : EventArgs { public string ServiceId { get; } public string CharacteristicId { get; } public bool IsSubscribed { get; } }
Public Event OnSubscriptionChanged As OnSubscriptionChangedHandler Public Delegate Sub OnSubscriptionChangedHandler(sender As Object, e As BLEServerSubscriptionChangedEventArgs) Public Class BLEServerSubscriptionChangedEventArgs Inherits EventArgs Public ReadOnly Property ServiceId As String Public ReadOnly Property CharacteristicId As String Public ReadOnly Property IsSubscribed As Boolean End Class
Remarks
TBD.
WriteRequested Event (BLEServer Component)
TBD.
Syntax
public event OnWriteRequestedHandler OnWriteRequested; public delegate void OnWriteRequestedHandler(object sender, BLEServerWriteRequestedEventArgs e); public class BLEServerWriteRequestedEventArgs : EventArgs { public string ClientId { get; } public string ServiceId { get; } public string CharacteristicId { get; } public string Value { get; }
public byte[] ValueB { get; } public bool WithResponse { get; } public bool Accept { get; set; } }
Public Event OnWriteRequested As OnWriteRequestedHandler Public Delegate Sub OnWriteRequestedHandler(sender As Object, e As BLEServerWriteRequestedEventArgs) Public Class BLEServerWriteRequestedEventArgs Inherits EventArgs Public ReadOnly Property ClientId As String Public ReadOnly Property ServiceId As String Public ReadOnly Property CharacteristicId As String Public ReadOnly Property Value As String
Public ReadOnly Property ValueB As Byte() Public ReadOnly Property WithResponse As Boolean Public Property Accept As Boolean End Class
Remarks
TBD.
Config Settings (BLEServer Component)
The component accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.BLEServer Config Settings
| 0 (None) | No events are logged. |
| 1 (Info - default) | Informational events are logged. |
| 2 (Verbose) | Detailed data is logged. |
| 3 (Debug) | Debug data is logged. |
The default log level, Info, provides information when most BLE operations begin and end, and should be sufficient to get a good idea of what the component is doing at a high level.
The Verbose log level adds a few extra operation timing messages, and adds more detail to some messages logged at the Info level.
The Debug log level causes the component to output as much information as possible about what it is doing at all times. All BLE communications, even those which are typically abstracted away by the API, are logged in full detail. Typically the additional information added by this log level is not helpful to the end user, and would only be necessary to capture if you wish to report an issue to the support team.
Base Config Settings
In some non-GUI applications, an invalid message loop may be discovered that will result in errant behavior. In these cases, setting GUIAvailable to false will ensure that the component does not attempt to process external events.
- Product: The product the license is for.
- Product Key: The key the license was generated from.
- License Source: Where the license was found (e.g., RuntimeLicense, License File).
- License Type: The type of license installed (e.g., Royalty Free, Single Server).
- Last Valid Build: The last valid build number for which the license will work.
Setting this configuration setting to true tells the component to use the internal implementation instead of using the system security libraries.
On Windows, this setting is set to false by default. On Linux/macOS, this setting is set to true by default.
NOTE: This setting is static. The value set is applicable to all components used in the application.
When this value is set, the product's system dynamic link library (DLL) is no longer required as a reference, as all unmanaged code is stored in that file.
Trappable Errors (BLEServer Component)
BLEServer Errors
| 600 | Invalid UUID. |
| 601 | Invalid Id. |
| 602 | Action not allowed. See error message for more details. |
| 603 | Scanning error. See error message for more details. |
| 604 | Connection error. See error message for more details. |
| 605 | Must be connected to a device to perform the requested action. |
| 606 | Error during communication. See error message for more details. |
| 607 | Device unreachable during communication attempt. |
| 608 | Error during discovery. See error message for more details. |
| 609 | Component detected a cycle of included services. |
| 610 | General read error. See error message for more details. |
| 611 | General write error. See error message for more details. |
| 612 | Application-specific protocol error. This error code indicates that a protocol error code in the range 0x80-0x9F was returned during a BLE communication. Such error codes are reserved for applications to use as they see fit. Refer to the documentation of your remote device for more information. |
| 613 | Bluetooth low energy not supported. |
| 701 | Invalid Handle: The attribute handle given was not valid on this server. |
| 702 | Read Not Permitted: The attribute cannot be read due to its permissions. |
| 703 | Write Not Permitted: The attribute cannot be written due to its permissions. |
| 704 | Invalid PDU: The attribute PDU was invalid. |
| 705 | Insufficient Authentication: The attribute requires authentication before it can be read or written. |
| 706 | Request Not Supported: Attribute server does not support the request received from the client. |
| 707 | Invalid Offset: Offset specified was past the end of the attribute's value. |
| 708 | Insufficient Authorization: The attribute requires authorization before it can be read or written. |
| 709 | Prepare Queue Full: Too many prepare writes have been queued. |
| 710 | Attribute Not Found: No attribute found within the given attribute handle range. |
| 711 | Attribute Not Long: The attribute cannot be read or written using the Read Blob Request. |
| 712 | Insufficient Encryption Key Size: The Encryption Key Size used for encrypting this link is insufficient. |
| 713 | Invalid Attribute Value Length: The attribute value length is invalid for the operation. |
| 714 | Unlikely Error: The attribute request that was requested has encountered an error that was unlikely, and therefore could not be completed as requested. |
| 715 | Insufficient Encryption: The attribute requires encryption before it can be read or written. |
| 716 | Unsupported Group Type: The attribute type is not a supported grouping attribute as defined by a higher layer specification. |
| 717 | Insufficient Resources: Insufficient Resources to complete the request. |
| 952 | Write Request Rejected: A requested write operation could not be fulfilled for reasons other than its permissions. |
| 953 | Client Characteristic Configuration Descriptor (CCCD) Improperly Configured: The CCCD is not configured according to the requirements of the profile or service. |
| 954 | Procedure Already in Progress: A profile or service request cannot be serviced because a previously triggered operation is still in progress. |
| 955 | Out of Range: An attribute value is out of range (as defined by a profile or service specification). |