ymodem Bibliothek

    • Release
    • Closed Source

      ymodem Bibliothek

      Version:
      1.0.0

      Funktion:
      Diese Bibliothek kann eine Datei mithilfe des YMODEM-Protokolls über eine Serielle Schnittstelle senden. Momentan ist nur das Senden einer Datei implementiert.

      Verfügbare Funktionen:

      Spoiler anzeigen

      VB.NET-Quellcode

      1. ''' <summary>
      2. ''' This function sends a file with the ymodem protocol.
      3. ''' </summary>
      4. ''' <param name="PortName">the name of the port on which the file will be sent</param>
      5. ''' <param name="Baudrate">the baudrate of the port</param>
      6. ''' <param name="Timeout">the timeout in ms for this port</param>
      7. ''' <param name="FilePath">the path to the file which will be sent</param>
      8. ''' <returns>1: The file does not exist, 2: Could not open file, 3: Could not open the port, 5: Reached timeout, 6: Wrong acknowledge char received (or timeout), 7: Could not send block, 0: File sucessfully sent</returns>
      9. ''' <remarks></remarks>
      10. Public Function SendFile(ByVal PortName As String, ByVal Baudrate As Integer, ByVal Timeout As Integer, ByVal FilePath As String) As Integer
      11. ''' <summary>
      12. ''' This function sends a file asynchronus with the ymodem protocol. Use AsyncGetProgress to get the progress or AsyncIsFinished.
      13. ''' </summary>
      14. ''' <param name="PortName">the name of the port on which the file will be sent</param>
      15. ''' <param name="Baudrate">the baudrate of the port</param>
      16. ''' <param name="Timeout">the timeout in ms for this port</param>
      17. ''' <param name="FilePath">the path to the file which will be sent</param>
      18. ''' <returns>true: the sending of the file has started, false: the sending of the file could not be started</returns>
      19. ''' <remarks></remarks>
      20. Public Function SendFileAsync(ByVal PortName As String, ByVal Baudrate As Integer, ByVal Timeout As Integer, ByVal FilePath As String) As Boolean
      21. ''' <summary>
      22. ''' This function returns the actual progress of a sending started with SendFileAsync.
      23. ''' </summary>
      24. ''' <returns>the progress of the file which is currently sent</returns>
      25. ''' <remarks></remarks>
      26. Public Function AsyncGetProgress() As Integer
      27. ''' <summary>
      28. ''' Checks if a file transfer started with SendFileAsync is finished.
      29. ''' </summary>
      30. ''' <returns>-1: the file is still sent (not finished yet), 0: the file was sucessfully sent, 1: The file does not exist, 2: Could not open file, 3: Could not open the port, 5: Reached timeout, 6: Wrong acknowledge char received (or timeout), 7: Could not send block</returns>
      31. ''' <remarks></remarks>
      32. Public Function AsyncIsFinished() As Integer
      33. ''' <summary>
      34. ''' This function checks if a serial Port can be opened.
      35. ''' </summary>
      36. ''' <param name="PortName">the name of the port which should be tested</param>
      37. ''' <param name="Baudrate">the baudrate for this port</param>
      38. ''' <param name="Timeout">the timeout in ms for this port</param>
      39. ''' <returns>true: The Port could be opened, false: The Port could not be opened.</returns>
      40. ''' <remarks></remarks>
      41. Public Function CheckPort(ByVal PortName As String, ByVal Baudrate As Integer, ByVal Timeout As Integer) As Boolean


      Aufruf:

      Spoiler anzeigen

      VB.NET-Quellcode

      1. Imports ymodem
      2. Module Main
      3. ' This is a simple Ymodem program
      4. Sub Main()
      5. Dim sender As New ymodem.YMODEM
      6. sender.SendFileAsync("COM1", 115200, 1000, "C:\Test.txt")
      7. End Sub
      8. End Module


      Sonstige Details:
      Programmiersprache: VB.NET
      IDE: Visual Studio 2012 Ultimate
      Framework: 4.5 (es wird momentan eine Funktion aus 4.5 gebraucht)

      Download:
      Im Anhang.
      Dateien
      • ymodem.dll

        (27,14 kB, 250 mal heruntergeladen, zuletzt: )