NET

Automatically Configure POS for Terminal

Easier configuration of POS by picking up the terminal address from the configuration message

Edit "Automatically Configure POS for Terminal" on GitHub

When implementing the default mode where both the POS and the terminal are running as severs, there is a way to simplify the configuration. Since the POS system needs to know the address of the terminal and the terminal needs to know the address of the POS, it is possible to just add the address to POS in the terminal. When exiting the terminal’s admin menu by pressing Save button, a configuration message is sent to the just entered POS address and port. From the .Net SDK the EventCallback is called with event object TerminalAddressObtainedEventCallback.

lightbulb

Even if TerminalAddressObtainedEventCallback is not implemented, the SDK will pick up the address and use it, but it will not remember it.

Picking up the configuration could look something like this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
    public class PaxImplementation : ISwpTrmCallbackInterface
    {
        private string terminalIPnPort;
        public string TerminalIPnPort { 
            get {return terminalIPnPort;}
            set {
                terminalIPnPort = value; 
                SaveConfiguration();
                }
            }
        
        public PaxImplementation()
        {
            ReadConfigration();

            PAX = PAXTrmImp_1.Create(
                new SwpIfConfig(),
                this);

            PAX.TerminalAddress = TerminalIPnPort;
        }

        public void EventCallback(EventCallbackObject eventObject)
        {
            switch (eventObject.type) 
            {
                .
                .
                .
                case EventCallbackTypes.TerminalAddressObtainedEventCallback: 
                    var ta = (TerminalAddressObtainedEventCallback)eventObject;
                    TerminalIPnPort = $"{ta.Ipv4}:{ta.Port}";
                    break;
            }
        }
    .
    .
    .
info

DHCP: If the terminal receives a new address a configuration message is sent automatically to the configured ECR IP and Port. This works fine when using static IP for the POS and DHCP for the terminal.