Where to put keyboard code

General FreeBASIC programming questions.
Posts: 2056
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Where to put keyboard code

Postby badidea » Jan 13, 2019 20:32

Gablea wrote:... html basic attenuation ...

What is that? DDG and Google weren't much help here.
Posts: 1049
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom

Re: Where to put keyboard code

Postby Gablea » Jan 13, 2019 20:33

badidea wrote:
Gablea wrote:... html basic attenuation ...

What is that? DDG and Google weren't much help here.

I may have spelt it wrong

this is a sample of the code I use to get the terminals status

Code: Select all

            Dim Request As HttpWebRequest = HttpWebRequest.Create(PS_URL & "/terminals/" & TerminalIDNumber)
            Dim credentials As String = Convert.ToBase64String(Encoding.ASCII.GetBytes(PS_USER & ":" & PS_PASS))
            txtResults.Text = vbNullString

            With Request
                .Proxy = Nothing
                .Headers(HttpRequestHeader.Authorization) = String.Format("Basic {0}", credentials)
                .UserAgent = PS_USER
            End With

            Dim response As HttpWebResponse = Request.GetResponse()
            Dim dataStream As Stream = response.GetResponseStream
            Dim reader As New StreamReader(dataStream)
            Dim responseFromServer As String = reader.ReadToEnd()

            txtResults.Text = responseFromServer

            If responseFromServer = "0" Then
                MsgBox("Retreal of Status Failed")
                Dim json As String = responseFromServer
                Dim ser As JObject = JObject.Parse(json)
                Dim data As List(Of JToken) = ser.Children().ToList
                For Each item As JProperty In data
                    Select Case item.Name
                        Case "status"
                            Select Case item.Value
                                Case "AVAILABLE"
                                    addtoStatusList("Terminal Ready")

                                Case "BUSY"
                                    addtoStatusList("Terminal busy please wait 10 seconds and try again")

                                Case "Offline", "OFFLINE", "offline"
                                    addtoStatusList("Terminal OFFLINE NO Card processing Possible")
                            End Select
                    End Select
            End If
        Catch ex As Exception
        End Try

so the PS_URL, TerminalIDNumber, PS_USER and PS_PASS are loaded from a ini file at start up of the program

Return to “General”

Who is online

Users browsing this forum: No registered users and 10 guests