VNC file transfer (Sample)

From SEGGER Wiki
Jump to: navigation, search
GUI_VNC_FileTransfer.c
GUI VNC FileTransfer.png
File(s) required
  • GUI_VNC_FileTransfer.c
Runs in simulation Yes
Runs on target Yes
Download GUI_VNC_FileTransfer.c

This sample shows how to use a VNC server with emWin to transfer files.

Code

/*********************************************************************
*                    SEGGER Microcontroller GmbH                     *
*        Solutions for real time microcontroller applications        *
**********************************************************************
*                                                                    *
*        (c) 1996 - 2020  SEGGER Microcontroller GmbH                *
*                                                                    *
*        Internet: www.segger.com    Support:  support@segger.com    *
*                                                                    *
**********************************************************************

** emWin V6.10 - Graphical user interface for embedded applications **
emWin is protected by international copyright laws.   Knowledge of the
source code may not be used to write a similar product.  This file may
only  be used  in accordance  with  a license  and should  not be  re-
distributed in any way. We appreciate your understanding and fairness.
----------------------------------------------------------------------
File        : GUI_VNC_FileTransfer.c
Purpose     : Sample that demonstrates how to use a VNC server with
              emWin and use it for file transfer.
Requirements: WindowManager - ( )
              MemoryDevices - ( )
              AntiAliasing  - ( )
              VNC-Server    - (x)
              PNG-Library   - ( )
              TrueTypeFonts - ( )
---------------------------END-OF-HEADER------------------------------
*/

#include "GUI.h"
#include "GUI_VNC.h"

/*********************************************************************
*
*       Defines
*
**********************************************************************
*/
#define PASSWORD "emwin"
#define BASE_DIR "C:\\Temp\\FTP\\"

/*********************************************************************
*
*       Static data
*
**********************************************************************
*/

/*********************************************************************
*
*       Static code
*
**********************************************************************
*/

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  //
  // Init emWin.
  //
  GUI_Init();
  //
  // Display something
  //
  GUI_DispStringAt("VNC File Transfer", 10, 10);
  //
  // Start VNC server with file transfer support.
  //
  GUI_VNC_X_StartServerFT(0, 0);
  //
  // Set the base directory of the server.
  //
  IP_FS_WIN32_ConfigBaseDir(BASE_DIR);
  //
  // Optionally, a password can be set.
  //
  GUI_VNC_SetPassword(PASSWORD);
  //
  // Now, connect to the server with emVNC.exe and enter the server IP.
  // Right click the top bar of the window and select 'Open File Transfer Window'
  // to be able to copy files over.
  //

  while (1) {
    GUI_Delay(100);
  }
}

/*************************** End of file ****************************/