# cbToCoNet\_vRxEvent()

## 解説

無線パケット受信後に呼び出されます。引数に [`tsRxDataApp`](broken://pages/-LCSQBsTPXoLivWdwxrd) `*psRx` が渡されます、受信データ（パケットの中身、アドレス情報など）が格納されます。構造体は本コールバック関数の呼び出しスコープ内で有効で、一旦関数を抜けると値は保証されません。

{% hint style="warning" %}
頻繁に受信される場合は、本関数を終了を遅延すべきではありません。受信キューの解放が遅れ取りこぼしが発生するかもしれません。

受信パケットは、内部のMAC層の割り込みにより、FIFO キューに蓄積されます。アプリケーションループの制御下になったとき、このキューから取り出し、コールバック関数が実行されます。
{% endhint %}

## 引数

| 型                                                        | 名前     | 詳細                           |
| -------------------------------------------------------- | ------ | ---------------------------- |
| [`tsRxDataApp`](broken://pages/-LCSQBsTPXoLivWdwxrd) `*` | `psRx` | 受信されたデータが格納される。詳細は構造体の解説を参照。 |

## 戻り値

なし。

## サンプル

```c
// display packet content 
void cbToCoNet_vRxEvent(tsRxDataApp *pRx) {
	int i;
	static uint16 u16seqPrev = 0xFFFF;
	uint8 *p = pRx->auData; // pointer to the payload

	// print control info
	vfPrintf(&sSerStream, LB"[PKT Ad:%04x,Ln:%03d,Seq:%03d,Lq:%03d,Tms:%05d \"",
			pRx->u32SrcAddr, // source address
			pRx->u8Len, // payload size
			pRx->u8Seq, // seq number
			pRx->u8Lqi, // LQI
			pRx->u32Tick & 0xFFFF); // time stamp
	// print first 32 bytes
	for (i = 0; i < pRx->u8Len; i++) {
		if (i < 32) {
			sSerStream.bPutChar(sSerStream.u8Device,
				(pRx->auData[i] >= 0x20 && pRx->auData[i] <= 0x7f) ? pRx->auData[i] : '.');
		} else {
			vfPrintf(&sSerStream, "..");
			break;
		}
	}
	vfPrintf(&sSerStream, "C\"]");
}
```


---

# 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/twelite-net-api-ref/krubakku/cbtoconet_vrxevent.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.
