# MTDevice Events

#### OnDeviceList

This event occurs when device information is available.

```
public event DeviceListHandler OnDeviceList
public delegate void DeviceListHandler(object sender,
MTConnectionType connectionType, List<MTDeviceInformation> deviceList)
```

<table data-header-hidden><thead><tr><th width="166" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">Sender</td><td valign="top">Object representing the publisher of the event.</td></tr><tr><td valign="top">connectionType</td><td valign="top">MTConnectionType value: MTConnectionType.USB, MTConnectionType.IP, MTConnectionType.Serial</td></tr><tr><td valign="top">deviceList</td><td valign="top">A list of MTDeviceInformation objects</td></tr></tbody></table>

#### OnDeviceConnectionStateChanged <a href="#toc_250015" id="toc_250015"></a>

This event occurs when the connection state of the device is changed.&#x20;

```
 public event DeviceListHandler OnDeviceList

public delegate void DeviceListHandler(object sender,
MTConnectionType connectionType, List<MTDeviceInformation> deviceList)
```

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">sender</td><td valign="top">Object representing the publisher of the event.</td></tr><tr><td valign="top">state</td><td valign="top"><p>MTDeviceState value indicating the state of the device:</p><p>Disconnected Connecting Error Connected Disconneting</p></td></tr></tbody></table>

#### OnDeviceDataString <a href="#toc_250014" id="toc_250014"></a>

This event occurs when a response is received from the device.&#x20;

```
public event DeviceDataStringHandler OnDeviceDataString

public delegate void DeviceDataStringHandler(object sender, string dataString)
```

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">sender</td><td valign="top">Object representing the publisher of the event.</td></tr><tr><td valign="top">dataString</td><td valign="top">Hexadecimal string representing data received.</td></tr></tbody></table>

#### OnDeviceDataBytes <a href="#toc_250013" id="toc_250013"></a>

This event occurs when a response is received from the device.

```
public event DeviceDataBytesHandler OnDeviceDataBytes 
public delegate void DeviceDataBytesHandler(object sender, byte[] dataBytes)
```

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">sender</td><td valign="top">Object representing the publisher of the event.</td></tr><tr><td valign="top">dataBytes</td><td valign="top">Byte array representing data received.</td></tr></tbody></table>

#### OnDeviceResponseMessage <a href="#toc_250012" id="toc_250012"></a>

This event occurs when a response is received from the device.

&#x20;

```
public event DeviceResponseMessageHandler OnDeviceResponseMessage 
public delegate void DeviceResponseMessageHandler(object sender, 
MTCMSResponseMessage response)
```

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">sender</td><td valign="top">Object representing the publisher of the event.</td></tr><tr><td valign="top">response</td><td valign="top">MTCMSResponseMessage representing data received.</td></tr></tbody></table>

#### OnDeviceNotificationMessage <a href="#toc_250011" id="toc_250011"></a>

This event occurs when a response is received from the device.

```
public event DeviceNotificationMessageHandler OnDeviceNotificationMessage 

public delegate void DeviceNotificationMessageHandler(object sender, 
MTCMSNotificationMessage notification)
```

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">sender</td><td valign="top">Object representing the publisher of the event.</td></tr><tr><td valign="top">notification</td><td valign="top">MTCMSNotificationMessage representing data received.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.magtek.com/hardware/oem-readers-and-components/oem-readers/odynamo/documentation/programmers-manuals/common-message-structure-mtcms-microsoft-.net-java-applet/mtdevice-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
