GXGPRS component sends received data through this method.
/// <summary>
/// Show received data.
/// </summary>
/// <param name="sender"></param>
/// <param name="Data"></param>
/// <param name="SenderInfo"></param>
private void gxgprs1_OnReceived(object sender, byte[] Data, string SenderInfo)
{
try
{
//We receive byte array from GXGPRS and this must be changed to chars.
if (HexCB.Checked)
{
ReceivedText.Text += BitConverter.ToString(Data);
}
else
{
//Get received data as string.
ReceivedText.Text += System.Text.Encoding.ASCII.GetString(Data);
}
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
}
''' <summary>
''' Show received data.
''' </summary>
Private Sub Gxgprs1_OnReceived(ByVal sender As System.Object, ByVal Data() As System.Byte, ByVal SenderInfo As System.String) Handles Gxgprs1.OnReceived
'We receive byte array from GXGPRS and this must be changed to chars.
Dim Value As Byte()
Value = Data
If (HexCB.Checked) Then
ReceivedText.Text += BitConverter.ToString(Value)
Else
'Get received data as string.
ReceivedText.Text += System.Text.Encoding.ASCII.GetString(Value)
End If
End Sub
'New data from GXGPRS is received
Private Sub GXGPRS1_OnReceived(ByVal sender As Object, Data As Variant, ByVal SenderInfo As String)
'We receive byte array from GXGPRS and this must be changed to chars.
Dim ch As String
Dim pos As Long
For pos = 0 To UBound(Data)
If HexCB.Value = 1 Then
'Show as hex
ReceivedText.Text = ReceivedText.Text & Hex(Data(pos)) & " "
Else
'Convert byte to chr
ch = Chr(Data(pos))
ReceivedText.Text = ReceivedText.Text + ch
End If
Next
End Sub
Assembly: Gurux.GPRS (Module: Gurux.GPRS) Version: 5.0.0.1