''' <summary>
''' Classe de base pour l'empactage des trames
''' </summary>
''' <remarks></remarks>
Public MustInherit Class BaseFrame

    ''' <summary>
    ''' Trame empactée
    ''' </summary>
    ''' <remarks></remarks>
    Private mFrame As Frame.ClsFrameModbusBase

    ''' <summary>
    ''' Constructeur par défaut
    ''' </summary>
    ''' <remarks></remarks>
    Friend Sub New()
        mFrame = Nothing
    End Sub
    ''' <summary>
    ''' Constructeur
    ''' </summary>
    ''' <param name="pFrame">Trame empactée</param>
    ''' <remarks></remarks>
    Friend Sub New(ByVal pFrame As Frame.ClsFrameModbusBase)
        mFrame = pFrame
    End Sub

    ''' <summary>
    ''' Retourne la trame empactée
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property Trame() As Frame.ClsFrameModbusBase
        Get
            Return mFrame
        End Get
    End Property

    ''' <summary>
    ''' Définit la trame empactée
    ''' </summary>
    ''' <param name="pFrame">Trame empactée</param>
    ''' <remarks></remarks>
    Protected Sub SetFrame(ByVal pFrame As Frame.ClsFrameModbusBase)
        mFrame = pFrame
    End Sub
    ''' <summary>
    ''' Définit la trame empactée
    ''' </summary>
    ''' <param name="pFrame">Tableau d'octet de la trame empactée</param>
    ''' <param name="pReq">Requête ?</param>
    ''' <remarks></remarks>
    Protected Sub SetFrame(ByVal pFrame As Byte(), ByVal pReq As Boolean)
        Try
            mFrame = Frame.ClsFrameModbusBase.GetClassFromFrame(pFrame, pReq)
        Catch ex As Exception
            mFrame = Nothing
        End Try
    End Sub

    ''' <summary>
    ''' Retourne la trame (format binaire)
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public MustOverride Function GetFrame() As Byte()
    ''' <summary>
    ''' Retourne la trame (format texte)
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public MustOverride Function GetFrameAscii() As String
End Class
