RTL.PhotoWall Sample

From Appmethod Code Examples
Jump to: navigation, search

PhotoWall is a sample application with a client-server architecture where a client application lets you take a picture and send that picture to a server application, which displays the picture.

The client application is a FireMonkey application, and the server application is available both as a VCL application and as a FireMonkey application.


You can find the PhotoWall project at:


This sample applications folder provides two server projects (FireMonkey and VCL) and a client project. The projects are designed so that you can run any number of instances of each at the same time. Many client applications may connect to the same server application, and any client application may connect to multiple server applications, as long as they are reachable using app tethering.

Note: The VCL server application is only available in Object Pascal\RTL\Tethering\PhotoWall folder.

In the server application (DesktopWallApp or DesktopWallVCLApp) you have an empty image area that you can fill remotely with a picture using a client application.


In the client application (MainMobileApp) you have the following controls:

  • An image area that shows the last picture taken and sent to a server application.
  • A list of connected server applications under Select Photo Wall, and a Refresh button to refresh the list.
  • A Take Photo button to take a picture to send to the server application selected from the list.

How to Use the Sample

  1. Navigate to the location given above and either one of the server applications in any of the locations given above:
    • DesktopWall\DesktopWallApp.dproj
    • DesktopWall\DesktopWallApp.cbproj
    • DesktopWallVCL\DesktopWallVCLApp.dproj
    • DesktopWallVCL\DesktopWallVCLApp.cbproj
  2. Select Run > Run to run the selected server application.
  3. On the Project Manager:
    1. Right-click the project group entry.
    2. Select Add Existing Project.
    3. Open either Mobile\MobilePhotoApp.dproj or Mobile\MobilePhotoApp.cbproj in any of the locations given above.
  4. Select Run > Run to run the client application.


Each application in the project group contains a single source file that contains the class for the main form of the application.


Each application defines a single class that implements the main form of the application.


FireMonkey Server Application

VCL Server Application

FireMonkey Client Application

  • The application defines the following methods:
    • CheckPhotoWalls returns True
if there is an item selected in lbWalls. If there is no selected item, CheckPhotoWalls returns False and shows a message.
    • SendImage sends a previously-taken picture, or shows a message asking you to take a picture first.
    • FindWalls clears lbWalls and calls TakePhotoManager.DiscoverManagers. TakePhotoManager.DiscoverManagers eventually triggers TakePhotoManagerEndManagersDiscovery.
  • The application defines the following event handlers:
    • If CheckPhotoWalls returns True

, lbWallsClick connects to the remote profile selected in lbWalls and calls SendImage.

    • BtRefreshClick calls FindWalls.
    • TakePhotoManagerEndManagersDiscovery attempts to pair with any remote manager, and if successful triggers TakePhotoManagerEndProfilesDiscovery.
    • TakePhotoManagerEndProfilesDiscovery:
      1. Clears lbWalls.
      2. If there is a discovered remote profile with "MediaReceiverApp" or "VCLMediaReceiverApp" as description, adds the profile to lbWalls.
      3. If lbWalls is not empty, selects the first remote profile in the the list and connects to it.
    • TakePhotoManagerRequestManagerPassword provides the password of the remote server application: "1234".
    • TakePhotoFromCameraAction1DidFinishTaking loads the taken image into the image area and calls SendImage if CheckPhotoWalls returns True



See Also