> For the complete documentation index, see [llms.txt](https://nviasoft.gitbook.io/nviasoft-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nviasoft.gitbook.io/nviasoft-docs/api-reference/item-parsing/getremotecommandparam.md).

# GetRemoteCommandParam

### int GetRemoteCommandParam(int lMsgId, int nIndex, ref string pszName, ref string pszValue, ref int pnFormat)

호스트(Host)로부터 수신한 S2F41 (Host Command Send) 메시지에서 \*\*명령 파라미터(Command Parameter)\*\*의 이름과 값을 인덱스 번호를 기반으로 추출합니다. 하나의 명령에 여러 개의 파라미터가 포함될 수 있으므로, 반복문을 통해 모든 파라미터를 읽어올 수 있습니다.

Parameters

<table data-header-hidden><thead><tr><th width="193" valign="top"></th><th width="123" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Name</td><td valign="top">Type</td><td valign="top">Description</td></tr><tr><td valign="top">lMsgId</td><td valign="top">int</td><td valign="top">수신한 Message의 ID</td></tr><tr><td valign="top">nIndex</td><td valign="top">int</td><td valign="top">Remote Command수신시 받은 Parameter의 Index</td></tr><tr><td valign="top">pszName</td><td valign="top">ref string</td><td valign="top">Index에 위치한 Parameter Name</td></tr><tr><td valign="top">pszValue</td><td valign="top">ref string</td><td valign="top">Index에 위치한 Parameter Value</td></tr><tr><td valign="top">pnFormat</td><td valign="top">ref int</td><td valign="top">Parameter Value의 Format</td></tr></tbody></table>

```csharp
//OnRemoteCommand에서 사용자가 처리
public void OnRemoteCommand(int lMsgId)
{
    string strCommand = string.Empty;
    string strCPName = string.Empty, strCPValue = string.Empty;
    int nParamCount = 0, nFormat =0;
    short nHCACK = 0;
    //==============받아서 처리하는 변수를 선언합니다.=================
    string strLOTID = string.Empty, strPPID = string.Empty;
   //===============================================================
    nParamCount = m_gem.GetRemoteCommand(lMsgId, ref strCommand);

    for (short i = 0; i < (short)nParamCount; i++)
    {
        int nCntOFParam = m_gem.GetRemoteCommandParam(lMsgId, i, ref strCPName, ref strCPValue, ref nFormat);

        strCPName.ToUpper();
        if (strCPName == CPNAME.LOTID)
        {
            strLOTID = strCPValue;
        }
        else if (strCPName == CPNAME.PPID)
        {
            strPPID = strCPValue;
        }
        else //해당되는 CPNAME이 존재하지 않는 경우. NACK
        {
            nHCACK = 3;
            m_gem.SetRemoteCommandErrorCode(lMsgId, strCommand, i, 3);
        }
    }
    if (nHCACK != 0)
    { 
        m_gem.ReplyRemoteCommand(lMsgId, nHCACK);// 허용되지 않는 CPNAME이 존재함.
        return;
    }
    else
    {
        if (strCommand == RCMD.START)    //Start명령일경우
        {
            m_gem.ReplyRemoteCommand(lMsgId, nHCACK);//응답전송
            m_gem.SetVIDValue(SVID.LOT_ID, strLOTID);//LOTID 새로운 값으로 세팅
            m_gem.SendEventReport(CEID.LOT_START);    //S6F11 이벤트 전송
        }
        else if (strCommand == RCMD.PPSELECT)  //PP-Select명령일경우
        {
            if (strPPID != "")
            {
                m_gem.ReplyRemoteCommand(lMsgId, nHCACK);     //응답 전송
                m_gem.SetVIDValue(SVID.PPID, strPPID);        //PPID 새로운 값 세팅
                m_gem.SendEventReport(CEID.PP_SELECTED_LOADED);//S6F11 이벤트 전송
            }
            else
            {
                nHCACK = 3;//해당되는 레시피 이름이 없는 경우 작업진행 불가.
                m_gem.ReplyRemoteCommand(lMsgId, nHCACK); //HOST로 에러코드 전송
            }
        }
    }
}
```


---

# 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/getremotecommandparam.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.
