WSDG Contents 

Text mode Programming

1 The WireLess Studio Text OLE library
2 Installing the library
3 Including the library
4 Visual Basic Programming
    4.1 VB 6 Project
    4.2 VB NET Project
    4.3 Programming
5 C++ Programming (MS Visual C++)
    5.1 Creating the C++ project
    5.2 Suppressing dialog and classes
    5.3 Adding Exit Handler
    5.4 Adding WireLess Classes from Type Library
    5.5 Adding header files
    5.6 Adding RF Objects and functions
6 WinDev Programming
7 OLE compliant Programming
8 Debugging procedure


1 The WireLess Studio Text OLE library

The WireLess Studio OLE library (WireLessStudioOle) is a DLL included in your project that allows to communicate with WS Clients through the WireLess Studio Server. This library has some objects that group the methods allowing to control RF terminals in Text mode.

WireLess Studio includes 2 OLE librairies:


2 Installing the library

The OLE library is installed and registered in the target computer at installation time, either with the "Server" component or in the "Development libraries" component. The library must be installed in the PC that runs the server and in the development PC.


3 Including the library

To include the library, you only need to reference this registered type library as a part of your project, and you'll have access to methods and constants of the OLE library.


4 Visual Basic Programming

4.1 VB 6 Project

Normally, the WireLess programs have no Windows frames, because the user interface is performed by the WS Client.

Create a new standard executable file.     

In the new VB project, suppress the first frame that is created by default.

Right click on the form, and choose the "Remove Form1" option (without saving changes).


Insert a new module:
In the project menu, select 
"Add module" option 
  

This module will have the starting object of the application (the main sub) (see the project properties).

In the project menu, select "References" option.

Look for WireLessStudioOle library and select it.
Click on "OK" button.

4.2 VB NET Project

4.3 Programming

Declare the WireLess Studio objects that you need as global objects ONCE.

Public wsRfAuxPort As New RFAUXPORT
Public wsRfBarcode As New RFBARCODE
Public wsRfError As New RFERROR
Public wsRfFile As New RFFILE
Public wsRfIo As New RFIO
Public wsRfMenu As New RFMENU
Public wsRfTerminal As New RFTERMINAL
Public wsRfTone As New RFTONE

The names of the objects are just an example and may differ.

WireLess Studio server will launch the application attached to the logged terminal. When the application ends, the connection with the terminal is automatically closed and all the objects are cleaned.

You need to check for errors, because due to wireless RF technology the Client may be out of network range and may disconnect from the server. So, you must properly close the application and exit to free the unused server connection.

Some program source files are installed together with the WS development library to illustrate the functions of some objects. You may find these files in "[Install Dir]\WireLessStudio\samples".

The executable files are in the "[Install Dir]\WireLessStudio\samples\exe" folder and you may launch them by the client with the "DEMO" profile and password.


5 C++ Programming (MS Visual C++)

5.1 Ceating the C++ project
5.2 Suppressing dialog and classes
5.3 Adding Exit Handler
5.4 Adding WireLess Classes from Type Library
5.5 Adding header files
5.6 Adding RF Objects and functions

Normally, the WireLess programs have no Windows frames, because the user interface is performed by the WS Client.
You may see and modify the "Cpp" demo project program in X:\Program Files\WirelessStudio\Samples\Cpp\Cpp.dsw or follow the instructions to build a new C++ project.

5.1 Creating the C++ project
Create a New MFC project.
Click OK.
Create a Dialog Based project.
Click Next.
5.2 Suppressing dialog and classes
Press [DEL] to suppress the dialog.
Press [DEL] to eliminate the C++ source file from the project.
Press [DEL] to eliminate the C++ header file from the project.
Suppress the references to the class dialog header file "CppDlg.h".

You may eliminate the CppDlg.cpp and CppDlg.h files from the directory.

Clean the calls to the suppressed dialog from the InitInstance() function. /////////////////////////////////////////////////////////////////////////////
// CCppApp initialization

BOOL CCppApp::InitInstance()
{
return FALSE;
}
5.3 Adding Exit Handler
From the "View" menu start the "Class Wizard".

Add a function to the exit instance handler.

Click on the "Add function" button.
Click OK.

5.4 Adding WireLess Classes from Type Library
From the "View" menu start the "Class Wizard". 

From the "Add Class" button, select the "From a Type Library" option.

Select the file WSOle.tlb from the WS folder (normally in  C:\Program Files\WireLessStudio\Ws_Ole) 
Confirm the creation of the classes from the library.
Click OK.
Click on the "OK" button of the  "ClassWizard" dialog.
The new classes appear in the project navigator.
5.5 Adding header files
Use the Windows file explorer.

Copy the "WsDef.h" file from the WireLess program folder to your project folder.

Include the "WsDef.h" file in your project, through the "Project" menu, "Add to project", "Files".

Click on the OK button.

Include the WireLess Studio definition file (WsDef.h) and the library file (WsOle.h) in the main cpp source, (before the user header file Cpp.h). // Cpp.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "WsOle.h"
#include "WsDef.h"
#include "Cpp.h"
5.6 Adding RF Objects and functions
Create the member objects (in the main class) from each class in the WS library.

You should suppress the WS objects not used by the application.

// Cpp.h : main header file for the CPP application
//
...
/////////////////////////////////////////////////////////////////////////////
// CCppApp:
// See Cpp.cpp for the implementation of this class
//

class CCppApp : public CWinApp
{
public:
CCppApp();

// The WS objects
IRFAuxPort m_rfAuxPort;
IRFBarcode m_rfBarcode;
IRFButton m_rfButton;
IRFError m_rfError;
IRFFile m_rfFile;
IRFIO m_rfIO;
IRFLog m_rfLog;
IRFMenu m_rfMenu;
IRFPgm m_rfPgm;
IRFTerminal m_rfTerminal;
IRFTone m_rfTone;
IRFUsrApp m_rfUsrApp;

...
Initialize the member library objects one time. Normally in the InitInstance() function. Then call your user application.

Note:
The WS application will run in the InitInstance() handler and does not process Windows messages.


Initialize the WSOLE.RFIO object FIRST.

/////////////////////////////////////////////////////////////////////////////
// CCppApp initialization
BOOL CCppApp::InitInstance()
{
// Initialize the OLE libraries
if (AfxOleInit () == FALSE) {
MessageBox(NULL,"Load DLL Error OLE","WSCpp",MB_OK); return FALSE; }

// WS Dispatcher
if (m_rfIO.CreateDispatch( "WSOLE.RFIO" ) == FALSE) {
MessageBox(NULL,"Load DLL Error RFIO","WSCpp",MB_OK); return FALSE; }
if (m_rfAuxPort.CreateDispatch( "WSOLE.RFAUXPORT" ) == FALSE) {
MessageBox(NULL,"Load DLL Error RFAUXPORT","WSCpp",MB_OK); return FALSE; }
if (m_rfBarcode.CreateDispatch( "WSOLE.RFBARCODE" ) == FALSE) {
MessageBox(NULL,"Load DLL Error RFBARCODE","WSCpp",MB_OK); return FALSE; }
if (m_rfButton.CreateDispatch( "WSOLE.RFBUTTON" ) == FALSE) {
MessageBox(NULL,"Load DLL Error RFBUTTON","WSCpp",MB_OK); return FALSE; }
if (m_rfError.CreateDispatch( "WSOLE.RFERROR" ) == FALSE) {
MessageBox(NULL,"Load DLL Error RFERROR","WSCpp",MB_OK); return FALSE; }
if (m_rfFile.CreateDispatch( "WSOLE.RFFILE" ) == FALSE) {
MessageBox(NULL,"Load DLL Error RFFILE","WSCpp",MB_OK); return FALSE; }
if (m_rfFile.CreateDispatch( "WSOLE.RFLOG" ) == FALSE) {
MessageBox(NULL,"Load DLL Error RFLOG","WSCpp",MB_OK); return FALSE; }
if (m_rfMenu.CreateDispatch( "WSOLE.RFMENU" ) == FALSE) {
MessageBox(NULL,"Load DLL Error RFMENU","WSCpp",MB_OK); return FALSE; }
if (m_rfPgm.CreateDispatch( "WSOLE.RFPGM" ) == FALSE) {
MessageBox(NULL,"Load DLL Error RFPGM","WSCpp",MB_OK); return FALSE; }
if (m_rfTerminal.CreateDispatch( "WSOLE.RFTERMINAL") == FALSE) {
MessageBox(NULL,"Load DLL Error RFTERMINAL","WSCpp",MB_OK); return FALSE; }
if (m_rfTone.CreateDispatch( "WSOLE.RFTONE" ) == FALSE) {
MessageBox(NULL,"Load DLL Error RFTONE","WSCpp",MB_OK); return FALSE; }
if (m_rfUsrApp.CreateDispatch( "WSOLE.RFUSRAPP" ) == FALSE) {
MessageBox(NULL,"Load DLL Error RFUSRAPP","WSCpp",MB_OK); return FALSE; }

// Call the application
MyApp();

return FALSE;
}
Release the WS library at application exit, in the ExitInstance() function. int CCppApp::ExitInstance() 
{
if (m_rfAuxPort.m_lpDispatch != NULL) m_rfAuxPort.ReleaseDispatch();
if (m_rfBarcode.m_lpDispatch != NULL) m_rfBarcode.ReleaseDispatch();
if (m_rfButton.m_lpDispatch != NULL) m_rfButton.ReleaseDispatch();
if (m_rfError.m_lpDispatch != NULL) m_rfError.ReleaseDispatch();
if (m_rfFile.m_lpDispatch != NULL) m_rfFile.ReleaseDispatch();
if (m_rfIO.m_lpDispatch != NULL) m_rfIO.ReleaseDispatch();
if (m_rfLog.m_lpDispatch != NULL) m_rfLog.ReleaseDispatch();
if (m_rfMenu.m_lpDispatch != NULL) m_rfMenu.ReleaseDispatch();
if (m_rfPgm.m_lpDispatch != NULL) m_rfPgm.ReleaseDispatch();
if (m_rfTerminal.m_lpDispatch != NULL) m_rfTerminal.ReleaseDispatch();
if (m_rfTone.m_lpDispatch != NULL) m_rfTone.ReleaseDispatch();
if (m_rfUsrApp.m_lpDispatch != NULL) m_rfUsrApp.ReleaseDispatch();
return CWinApp::ExitInstance();
}
Write your application in the application function. /////////////////////////////////////////////////////////////////////////////
// The application
void CCppApp::MyApp()
{
}

6 WinDev Programming

WireLess Studio will be used with WinDev development tools.
A sample with documentation and sources are included in the folder \Samples\WinDev.


7 OLE compliant Programming

WireLess Studio will be used in any development tool that support OLE interfaces. The previous example is for Microsoft VB, and the way to reference the WireLessStudioOle component will differ. The objects and the methods are the same.


8 Debugging procedure

Configure the server:
* Set server on Debug mode
* Block Killer (AppKiller disabled)
* Increase Timeout

Go to "Start / Programs / WireLess Studio / WireLess Studio Server V4 / WireLess Studio server Configuration" to be able to modify the configuration.

Set Debug Mode and disable Appkiller


Increase Timeout (for the PDA not to enter into Error)

Here below the TimeOut is at 30 seconds:


Then restart the server for the new configuration to be taken into account:

Launch the Administrator:
"Start / Programs / WireLess Studio / WireLess Studio Server V4 / WireLess Studio Administrator".

On Administrator window, get connected to server, then click on [Server administration] and select "Server Shutdown":

Click on [Select] and the server will shutdown.

On administrator window, click on [Connection To Server], then on [Start Service]. The service will restart.

* Open your WireLess Studio project on development/ depuration and get ready to start the program.
* Connect a WSt client to the server.
* A Pop-Up MessageBox will notify you that the server is ready to connect an application on "Debug", showing the message: "Launch a WireLess Studio OLE...".

* Click on [OK] button on the MessageBox.
* Launch your application on Debug mode (you have 30 seconds).
Wait a few seconds and your application will connect to server.