# GetWaitBit

### int GetWaitBit(int lMsgId)

특정 메시지 ID(`lMsgId`)의 헤더 정보 중에서 Wait Bit의 설정 여부를 확인합니다.

* W-Bit = 1: 응답 메시지가 반드시 필요함 (Primary Message).
* W-Bit = 0: 응답이 필요 없음 (Reply Message 또는 단방향 알림).

{% hint style="info" %}

* 통신 흐름 제어: 장비 개발 시 호스트로부터 온 메시지에 응답을 보내야 할지 말지를 결정하는 가장 기초적인 판단 기준이 됩니다.
* S7F23 등 특정 메시지: 레시피 관련 메시지들은 대부분 응답이 필요하므로 W-Bit가 1로 설정되어 수신됩니다. 반면, 그에 대한 응답인 S7F24 등은 W-Bit가 0으로 설정됩니다.
  {% endhint %}

Parameters

| **Name** | **Type** | **Description** |
| -------- | -------- | --------------- |
| lMsgId   | int      | 확인하려는 대상 메시지 ID |

```csharp
void OnMessageReceived(int lMsgId)
{
    // 1. 수신된 메시지가 응답을 기다리는지 확인
    int waitBit = m_gem.GetWaitBit(lMsgId);

    if (waitBit == 1)
    {
        Console.WriteLine("이 메시지는 응답(Reply)이 필요한 메시지입니다.");
        // 응답 메시지 빌드 및 전송 로직 수행
    }
    else if (waitBit == 0)
    {
        Console.WriteLine("응답이 필요 없는 메시지입니다.");
    }
}
```


---

# 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 dynamically by asking a question.

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

```
GET https://nviasoft.gitbook.io/nviasoft-docs/api-reference/item-parsing/getwaitbit.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.
