# Start

### int Start()

EZGemPlus 라이브러리의 통신 및 내부 로직을 본격적으로 가동합니다.\
실행 과정에서 호스트로부터 오는 메시지나 이벤트를 처리할 수 있도록 EventHandler와 MsgHandler를 연결하며, 성공 시 라이브러리는 외부와의 통신 대기 상태가 됩니다.

```csharp
// 초기 설정(IP, Port, ID 등)이 완료된 후 호출

//로그파일을 남기는 함수입니다.
m_gem.SetLogFile(string.Format("LOG\\GEM.LOG"));
//로그를 삭제하는 시점. 날짜를 기준으로 해당 폴더명이 날짜에 해당되면 삭제합니다.
m_gem.SetLogRetention(30);

 //Format.SML파일을 이용하여 지정된 포맷 이외의 메시지는 에러메시지를 발생시킵니다.(S9Fxx)
 //========================================================================================================
 m_gem.SetFormatFile(string.Format("FORMAT.SML"));	// S9계열 error메세지를 거르기 위하여 미리 포멧을 정의합니다.
 m_gem.SetFormatCheck(true);                         //Format.SML을 사용하도록 설정합니다.
 //========================================================================================================

//Report FilePath를 지정하여 EZGEM.RPT를 저장할 위치를 지정합니다.
//==============================================================
string strFilePath = GetFilePath("EZGEM.RPT");
m_gem.SetReportFilePath(strFilePath);
//==============================================================

 //SOFTREV / MODELNAME을 설정합니다.
 //==================================
 m_gem.SetModelName("SAMPLE_GEM_C#");
 m_gem.SetSoftRev("1.0.0");
 //==================================


 //타임 포맷을 설정합니다.
 //12 yyyymmddhhmmssCC or yymmddhhmmss
 m_gem.SetTimeFormat(16);

 //각 ID는 미리 등록을 해두어야 사용이 가능합니다.
 //=========================================
 AddSVID(); // SVID등록하기
 AddCEID(); // CEID등록하기
 AddALID(); // ALAMR등록하기
 AddECID(); // ECID등록하기
//AddDVID(); // DVID등록하기
//=========================================




 // 사용자가 직접 처리를 원하는 메세지 선언
 // 아래와 같이 선언해두면 [ OnMsgReceived(lMsgId) ] 함수를 통해 메시지가 들어오며, Stream/Function별로 직접 처리하실 수 있습니다.
 //===================================================================================================================
 m_gem.DisableAutoReply(2, 25);


  // RCMD[REMOTE COMMAND] 등록
  // RemoteCommand를 미리 등록해 두어야 Host에서 S2F41W 로 원격명령 전송시에 자동처리가 가능합니다.
  //=======================================================================================
  m_gem.AddRemoteCommand(RCMD.START);
  m_gem.AddRemoteCommand(RCMD.PPSELECT);
  //=======================================================================================




m_gem.Start();    //EZGEMPlus 구동



```


---

# 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/undefined/start.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.
