NET

Open

Open is the first function that actually communicates with the terminal. It sends a LoginRequest which is needed before sending any other message.

Edit "Open" on GitHub

Open

The Open function have two variants and may be called asynchonously or synchronously. Both variants result in an OpenResult but for the synchronous it is returned in the SyncRequestResult callback. The POIID in the login is essential and will decide whether the terminal needs the parameters or software. A POIID was supplied in the call to Start in a SaleApplInfo object, but may be changed when calling Open.

Before call to Open make sure to provide the ip address and port of the terminal.

Simple asynchronous Open call

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
    class PaxImplementation : ISwpTrmCallbackInterface
    {
        public ISwpTrmIf_1 PAX = {get; internal set; } = null;
        public string Poiid = string.Empty;
        public string TerminalAddressAndPort {get; set; } // <ip>:<port>
        .
        .
        .
        public async Task OpenTerminalForUse()
        {
            if (TerminalAddressAndPort != string.Empty && PAX != null)
            {
                PAX.TerminalAddress = TerminalAddressAndPort;
                OpenResult result = await PAX.OpenAsync();
                if (result.Result == ResponseResult.Success)
                {
                    // A login session with the terminal has now been established
                    // and the terminal may be used. Serialnumber prefix may be 
                    // used to identify what type of terminal 171=A30/229=A35/185=A920
                    // 
                    
                }
                else
                {
                    // Login failed. 
                }
            }
        }

Same simple functionality using synchronous Open call

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
    class PaxImplementation : ISwpTrmCallbackInterface
    {
        public ISwpTrmIf_1 PAX = {get; internal set; } = null;
        public string TerminalAddressAndPort {get; set; } // <ip>:<port>
        .
        .
        .
        public void OpenTerminalForUse()
        {
            if (TerminalAddressAndPort != string.Empty && PAX != null)
            {
                PAX.TerminalAddress = TerminalAddressAndPort;
                PAX.Open();
            }
        }

        // Results for the synchronous calls are obtained here.
        public void SyncRequestResult(object result)
        {
            switch (Enum.Parse(typeof(RequestResultTypes), result.GetType().Name))
            {
                case RequestResultTypes.OpenResult:
                    OpenResult openresult = result as OpenResult;
                    if (openresult.Success) 
                    {
                    // Now a login session with the terminal is established and the terminal may be used.
                    // Serialnumber prefix may be used to identify what type of terminal 171=A30/229=A35/185=A920
                    }
                    else
                    {
                    // Login failed. 
                    }
                break;
            }
        }