What is that? DDG and Google weren't much help here.Gablea wrote:... html basic attenuation ...
Where to put keyboard code
Re: Where to put keyboard code
Re: Where to put keyboard code
I may have spelt it wrongbadidea wrote:What is that? DDG and Google weren't much help here.Gablea wrote:... html basic attenuation ...
this is a sample of the code I use to get the terminals status
Code: Select all
Try
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")
Else
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
item.CreateReader()
Select Case item.Name
Case "status"
Select Case item.Value
Case "AVAILABLE"
SendToPoSterminal("TerminalOnLine|")
addtoStatusList("Terminal Ready")
Case "BUSY"
SendToPoSterminal("TerminalBusy|")
addtoStatusList("Terminal busy please wait 10 seconds and try again")
Case "Offline", "OFFLINE", "offline"
SendToPoSterminal("offline|")
addtoStatusList("Terminal OFFLINE NO Card processing Possible")
End Select
End Select
Next
End If
Catch ex As Exception
addtoStatusList(ex.ToString)
SendToPoSterminal("ProcessingError")
End Try
so the PS_URL, TerminalIDNumber, PS_USER and PS_PASS are loaded from a ini file at start up of the program