# Setup Generic File Integration ## Overview This feature is responsible for handling the connection setup between our Automation and the Equipment. ## How To Configure To configure the connection between our Automation Driver and the File System a set of keys must be configured in the IoTMetadataDefinition Smart Table. ### Relevant Artifacts The table below describes the properties for this entity type: | Name | Type | Is Mandatory | Data Type | Description | | :-------------------- | :--------- | :----------: | :-------- | :----------------------------------------------- | | IoTMetadataDefinition | SmartTable | Yes | | Metadata configuration for equipment integration | ### IoTMetadataDefinition Resource Level Configuration At the **Resource** level, there are several configuration we can make to set our connection with the File System where our Equipment will write it's Process files. | Resource | Resource Type | Area | Name | Value | Description | | ---------------------- | ------------- | ---- | ----------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | *MES FileRaw Resource* | | | **FileRaw_watcherType** | Type | Type of watcher to use. Default: `Chokidar`. | | *MES FileRaw Resource* | | | **FileRaw_ignoreInitial** | True or False | Flag to define if, during startup/restart, the files that were created, changed, deleted should be processed or ignored. Default: `false`. | | *MES FileRaw Resource* | | | **FileRaw_watcherMode** | Mode | (Type=Chokidar) To successfully watch files over a network (and in other non-standard situations), it is typically necessary to use Polling, however it could lead to high CPU utilization. FileSystemEvents is the most efficient method for monitoring local files. | | *MES FileRaw Resource* | | | **FileRaw_ProcessFilePath** | Process File Path | Where the Process files will be written to. | | *MES FileRaw Resource* | | | **FileRaw_SuccessArchiveFilePath** | Success Archive Path | Where the files will be moved after successful MES processing. | | *MES FileRaw Resource* | | | **FileRaw_ErrorArchiveFilePath** | Error Archive File | Where the files will be moved after an error occurs during processing. | | *MES FileRaw Resource* | | | **FileRaw_Mount_localPath_Process** | Local Path | Local Path to use as Mount destination of Network Process path. Default: `${temp}\${id}_Process`. | | *MES FileRaw Resource* | | | **FileRaw_Mount_localPath_Success** | Local Path | Local Path to use as Mount destination of Network Success Archive path. Default: `${temp}\${id}_Success`. | | *MES FileRaw Resource* | | | **FileRaw_Mount_localPath_Error** | Local Path | Local Path to use as Mount destination of Network Error Archive path. Default: `${temp}\${id}_Error`. | | *MES FileRaw Resource* | | | **FileRaw_Mount_OperatingSystem** | Operating System | Operating System where Connect IoT is running. Default: `Windows`. | | *MES FileRaw Resource* | | | **FileRaw_Mount_username** | Username | Username to use to create the Mounted folder. Default: Current Service credentials. | | *MES FileRaw Resource* | | | **FileRaw_Mount_password** | Password | Password to use to create Mounted folder. Default: Current Service credentials. | --- ## How To Use On Automation startup we will retrieve the information on `IoTMetadataDefinition` related to the linked Resource and set the retrieved configuration parameters as connection values. !!! Warning "Every time you change this values you **must restart** the Automation Controller." ## Implementation Details During **Equipment Setup** we will resolve `IoTMetadataDefinition` and check which parameters we should configure. These values will be stored in persistency for use during process. In the Setup phase we will evaluate if the configured Paths are **Local** or **Network** folders. In case of **Network folder** we will **Mount** them to a Local Path to use during Process. If a local path is defined for the corresponding Network location we will use that as the local Mount path, otherwise a folder will be created in the User temporary folder. !!! info "The path defined in `FileRaw_ProcessFilePath` will be monitored for any activity wile our Connect IoT Controller is running." ### Control File Each location will have a file written in this format `MESStartControlFile__.cmf`, where **Type** is one of `Process`, `Success` or `Error`, and **Resource Name** is the **MES Resource** connected to the current **Controller Instance**. This **Control File** will be written at a fixed interval of 60 seconds and the content will be a timestamp at that time in ISO format.