# PANIC

PANIC occurs when TWELITE NET believes that continued system operation is not possible and is reported as a network event.

### PANIC structure definition

```c
typedef struct {
	bool_t bCancelReset; //!< Store TRUE to cancel the reset.
	uint8 u8ReasonCode; //!< Factor code
	uint32 u32ReasonInfo; //!< Supporting Information for Factors
	string strReason; //!< String information of factors
} tsPanicEventInfo;
```

### Reference codes for PANIC processing

```c
void cbToCoNet_vNwkEvent(teEvent eEvent, uint32 u32arg) {
	switch(eEvent) {
	case E_EVENT_TOCONET_PANIC:
		if (u32arg) {
			tsPanicEventInfo *pInfo = (void*)u32arg;
			V_PRINTF( “PANIC! %d/%s“, pInfo-> u8ReasonCode, pInfo->strReason);
			pInfo->bCancelReset = TRUE; 
	// If set to TRUE, it will not reset immediately afterwards.
        // However, the subsequent behaviour is undefined.
		} break;
	...
```

### ID of the PANIC factor

| `TOCONET_PANIC_TX_FAIL_COUNT` | The transmission process continued to fail within the MAC layer. This is an error that is not normally expected. |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------- |


---

# 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://sdk.twelite.info/en/twelite-net-api-ref/panic.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.
