> For the complete documentation index, see [llms.txt](https://developer.magtek.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.magtek.com/sdks-and-tools/sdks-and-software-libraries/odynamo-sdks/common-message-structure-mtcms-microsoft-.net-java-applet/mtdevice-events.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.magtek.com/sdks-and-tools/sdks-and-software-libraries/odynamo-sdks/common-message-structure-mtcms-microsoft-.net-java-applet/mtdevice-events.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
