Getting Started with SECS/GEM for .NET Framework 4, .NET Core 5, .NET 6



After your buy SECSGEM.NET we will provide SECSGEM.NET Setup application and the license keys depending on the features you have bought. Here you can see the files.
SECSGEM.NET Setup Files

SECSGEM.NET.exe is the Installer. EQUIPMENT_PRODUCT.KEY is the license key for your 'specific computer'. HOST_PRODUCT.KEY license file is needed to start Host Simulator. SECSGEM_MANAGER_PRODUCT.KEY license is for SECSGEM_MANAGER application where you can simulate Host side, edit Equipment Dictionary files, see logs in realtime and a lot more .. Please click on SECSGEM.NET.exe to start installation.

SECS/GEM.NET/GEM300 Installation


Please follow the images for SECS/GEM .NET installation.
SECSGEM.NET Setup Content SECSGEM.NET Setup Content SECSGEM.NET Setup Content SECSGEM.NET Setup Content SECSGEM.NET Setup Content

If you had bought the Developer License, you could start the SampleSECSGEMApp right away to see SECS/GEM DEMO APPLICATION. Please copy the license files before running the Demo Application. If you bought SECSGEM.NET Runtime License for your equipment, you dont need to start. After you have successfully installed the SECSGEM.NET Driver, you will see file and directory structure similar to below. Please use the proper .NET version when you are referencing SECSGEM.NET. If you are creating a .NET5 project, you have to use the DLL files from .NET5 folder.

SECSGEM.NET Setup Content
Only 3 items are needed for your Equipment to be SECS/GEM compatible/compliant:

SECS/GEM Development with Visual Studio




If you want to start developing SECS/GEM application from scratch, please follow the steps below. Start a new Windows Forms Aplication in Visual Studio.

SECSGEM.NET Visual Studio Step 1

Add reference to 2 SECSGEM.NET files (SECSGEMInterfaces_NET*.dll and SECSGEMLicenseNET*_x64.dll) from the proper .NET folder. (.NET4 or .NET5)

SECSGEM.NET Visual Studio Step 2 SECSGEM.NET Visual Studio Step 3

Create a new Button on the Form1 Designer

SECSGEM.NET Visual Studio Step 4

Replace the Form1.cs file with the code below. After that assign InitializeButtons click event to InitializeEquipment_Click.

using eo_semi;
using eo_semi.e030_gem;
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;

namespace SECSGEMTutorial
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public IGEMDevice Equipment { get; set; }

        private void InitializeEquipment_Click(object sender, EventArgs e)
        {
            //Read the content of the Equipment License file
            string EQUIPMENT_PRODUCT_KEY = "";
            if (EQUIPMENT_PRODUCT_KEY == string.Empty || EQUIPMENT_PRODUCT_KEY == null)
            {
                if (File.Exists("EQUIPMENT_PRODUCT.KEY"))
                {
                    EQUIPMENT_PRODUCT_KEY = File.ReadAllText("EQUIPMENT_PRODUCT.KEY");
                }
                else
                {
                    string message = "License file EQUIPMENT_PRODUCT.KEY is NOT found in the current directory = " + Environment.CurrentDirectory;
                    throw new Exception(message);
                }
            }

            //Initialize Equipment with the License Key
            Int64 EQUIPMENT_ID = ClassFactory.Initialize(EQUIPMENT_PRODUCT_KEY);

            string equipmentDataDictionaryPath = Environment.CurrentDirectory + @"\EquipmentDataDictionary.xml";
            if (!File.Exists(equipmentDataDictionaryPath))
            {
                string message = "Equipment Data Dictionary File is NOT found. Without Equipment configuration file Equipment cannot be initialized" + Environment.CurrentDirectory;
                throw new Exception(message);
            }
            string equipmentLogsPath = Environment.CurrentDirectory + @"\EquipmentLogs";
            
            //Initialize the instance of our Equipment, you will use this instance to communicate with the host.
            Equipment = InitializeSECSGEM(equipmentDataDictionaryPath, equipmentLogsPath, EQUIPMENT_ID);

            //TODO:See the C:\SECSGEM.NET\SampleSECSGEMApp\SampleSECSGEMApp.sln sample application to see the usage of SECSGEM.NET
            //After you have analyzed the SampleSECSGEMApp , you can come back here and advance your code according to your needs
            
        }
        public IGEMDevice InitializeSECSGEM(string path_to_data_dictionary, string log_path, Int64 DBID)
        {
            IGEMDevice device = ClassFactory.CreateInstance<IGEMDevice>(path_to_data_dictionary, log_path, DBID);

            //listening to events
            device.Processing.StateChanged += EquipmentProcessingStateChanged;
            device.Communication.StateChanged += EquipmentCommunicationStateChanged;
            device.Control.StateChanged += EquipmentControlStateChanged;

            //only for equipment
            device.RemoteControl.RemoteCommandReceived += EquipmentRemoteControl_RemoteCommandReceived;
            device.EquipmentConstants.OnNewEquipmentConstantSend += EquipmentConstants_OnNewEquipmentConstantSend;
            device.EquipmentTerminalServices.OnTerminalRequest += EquipmentTerminalServices_OnTerminalRequest;
            device.ProcessRecipeManagement.OnCurrentEPPDRequest += ProcessRecipeManagement_OnCurrentEPPDRequest;

            device.PrimaryMessageReceived += EquipmentPrimaryMessageReceived;
            device.SecondaryMessageReceived += EquipmentSecondaryMessageReceived;

            return device;
        }

        private void EquipmentProcessingStateChanged(object sender, ProcessingStateEventArgs e) { }
        private void EquipmentCommunicationStateChanged(object sender, CommunicationStateEventArgs e) { }
        private void EquipmentControlStateChanged(object sender, ControlStateEventArgs e) { }
        private void EquipmentRemoteControl_RemoteCommandReceived(object sender, RemoteCommandReceivedEventArgs e){}
        private void EquipmentConstants_OnNewEquipmentConstantSend(IEnumerable<EquipmentConstant> equipment_constants) { }
        private void EquipmentTerminalServices_OnTerminalRequest(string terminal_message){ }
        private void ProcessRecipeManagement_OnCurrentEPPDRequest(SECSMessage message) { }
        private void EquipmentPrimaryMessageReceived(SECSMessage message) { }
        private void EquipmentSecondaryMessageReceived(SECSMessage message) { }

    }
}


In order to run this application properly all we need is to copy and paste following 2 files EQUIPMENT_PRODUCT.KEY and EquipmentDataDictionary.xml to the folder we are going to run this application from => C:\SECSGEM.NET\Projects\SECSGEMTutorial\bin\Debug

SECSGEM.NET Visual Studio Step 5

Set a breakpoint at Line 44 and and run the application to see Equipment initialized like below.

SECSGEM.NET Visual Studio Step 6

Sample SECS/GEM Application for .NET



Now you are ready to look at the Sample SECSGEM Application with the source codes provided with the Installer. Please open the solution file C:\SECSGEM.NET\SampleSECSGEMApp\SampleSECSGEMApp.sln with Visual Studio 2019. If you have HOST_PRODUCT.KEY you can start the SECS/GEM Demo Application to play with it after you copy Equipment and Host license files to working directory. When you run the application you will see the following screen.

SECSGEM.NET Demo Application

If you would still have problems after this tutorial, you can still contact us with the form below or use our emails.


Buy SECS/GEM.NET Software



Development License Price is 1000 Euro for 1 Computer. Runtime License is cheaper! Please ask us for more about prices of features and other applications.(i.e HOST LICENSE, MULTIPLE CONNECTIONS etc..)

15 REASONS to BUY SECSGEM.NET EQUIPMENT CONTROL SOFTWARE!


*If you want to use 32-Bit versions of SECSGEM.NET, you have to talk to us.

Please write us, let us show you the demo over Microsoft Teams in 30 minutes or any other way you prefer and if you don't like it, you can always say no!


Contact


* You can also use our contact form to get SECS/GEM Support for your needs!

License Agreement Legal Notice Privacy Policy

Go to top  Purchase  Contact