GXDN: Gurux Developer Network
ReceivedEventHandler Delegate
NamespacesGurux.GPRSReceivedEventHandler
GXGPRS component sends received data through this method.
Parameters
sender (Object)
The source of the event.
data (array< Byte >[]()[])
Byte buffer (variant array) containing the received data.
senderInfo (String)
Serial port number.
Examples
CopyC#
                /// <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);
    }
}
CopyVB.NET
                ''' <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
CopyVBScript
                '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
See Also

Assembly: Gurux.GPRS (Module: Gurux.GPRS) Version: 5.0.0.1