Bcrv Examples
Michael Day
10 Oct 2010

The Bcrv Examples are a simplified example of how to 
program using the FryeCom DLL to communciate with Fonix instruments.


BCrvFull:

The BCrvFull program shows an example of using the FryeCom.DLL
with the FippUnit.cpp file to communicate with a Fonix instrument. 

The program includes the BCrvFull.cpp, BCform.cpp, FippUnit.cpp and 
FippCore.cpp  files as well as source files located in the Common 
source directory. 

To run the program, you only need the BCrvFull.exe file and 
the FryeCom.DLL file.


BCrvCore:

The BCrvCore program shows an example of using the FryeCom.DLL
with the simple FippCore.cpp file to communicate with a Fonix instrument. 

The program includes the BCrvCore.cpp, BCform.cpp, and FippCore.cpp 
files as well as source files located in the Common source directory. 

To run the program, you only need the BCrvCore.exe file and 
the FryeCom.DLL file.


FippUnit, FippCore and FryeCom.DLL:

You can use either FippUnit, or the simpler FippCore interface 
in your programs. FippCore is the interface to the FryeCom DLL. 
You can of course create your own interface to the FryeCom DLL if
you wish, however it is recommended that you use the FryeCom object
as it takes care of the mundane management of the interface for you. 

FryeComD:

If you decide to not use the FippCore, you might want to consider
using the FryeComD.cpp file as your core unit. The FippCore object
uses the FryeComD interface to load the DLL and comunicate with it.
It takes care of the details of the task so that you don't have to. 

FryeComS:

FryeComS is similar to FryeComD except that FryeComS loads the DLL 
at program start up and will prevent the program from running if the 
FryeCom DLL is not available. The FryeComD version loads the DLL 
dynamically after the program is running. This way your program will 
still run even if the FryeCom.DLL was not found so that you can 
decide within your program what to do (perhaps provide instructions 
to the user about what is wrong).


FippUnit:

The FippUnit.cpp file provides an extensive set of call interfaces 
for most of the FIPP commands that are available (as of the time that
the file was created). The calls take care of most error handling issues
returning either a true or false result. The data is stored in the 
FIPP object. The FippUnit is the core file used by the TestCom program. 
(TestCOm uses the Pascal version of the file.) 

The FippCore.cpp file is a simplified call interface. It is the core 
object that FippUnit uses to communicate with the FryeCom DLL. 
If you only need to make a few FIPP calls, you might want to consider 
using the FippCore unit rather than the FippUnit which brings in a
lot more resources and code (and thus a greater chance of bugs). 

The FippCore unit it a transport agent, it does not know about the 
FIPP commands it transports. FippUnit on the otherhand is a distribution
agent. It contains a FIPP command specific interface. 

While you can still call the lower level FippCore calls through the 
FippUnit object (which inherits the FippCore object), it is recommended
that you not do this since it can leave the FippUnit confused as it 
keeps track of the data being transferred so that it can properly manage
the transferrs. If you feel you need to bypass the FippUnit and call
FippCore directly, 


Error Handling:

FippCore passes back the error codes generated by the FryeCom DLL
SUCCESS means that there was no error, Otherwise, the result indicates
the error that occured (see FryeComDefs).

The FippUnit simplifies the error handling process. Instead of passing 
back an error number, it just returns true(success) or false(failed).
The error code of what happened is stored in FippError. 

Pascal:

There are also Pascal versions of these files provided. 
The TestCom program was written in Pascal (as was the FBatCom program).
The reason for this is historical, the original development for Fryers
was done in Borland Pascal, so rather than rewrite everything the 
TestCom program was left as a Pascal program (Borland Delphi). 
(FippUnit and FippCore were translated from their Pascal versions). 

FryeCom.DLL:

The FryeCom DLL itself is also written in Pascal. The DLL is a critical 
file, so rather than trying to translate it and potentially add a 
multitude of new bugs, it has been left as a Pascal program.

Fryers32.DLL

The FryeCom DLL sits on top of the older Fryers32.DLL. In fact, the 
FryeCom.DLL it completely backwards compatible to the Fryers32.DLL
(the old register based call interface is still available). 
You could rename the FryeCom file to Fryers32 and old programs 
that use the older Fryers register calls will be able to use the DLL.
We don't recommend doing that though. The older Fryers32 DLL 
still works fine. While it is not longer offically being updated,
it is still being supported for now. The version of Fryers32 provided 
with this package is built from the core code inside the FryeCom DLL.
The FryeCom DLL is just a layer on top of the original Fryers32.DLL to 
provide a simplified calling interface. 


Improvements:

What improvements have we made in the new FryeCom DLL? 

As well as the simplified calling interface (no more twidling fake
MSDOS registers to talk to the DLL). We have provided functionality 
to make it easier to find a Fonix instrument connected to the com port. 
This includes automatic baudrate sync so that you can configure the 
Fonix instrument to a higher baudrate. 
If you use the FryeCore interface, it will also seek out the instrument
using an automatic port seek function. This can make the task of
interfacing your program with the instrument much easier for the user. 

FippCore is object based, so you can either use it as a stand-alone 
object, or just inhereit the object into your own object. 
The same is true of FippUnit.  

It should be noted that while a single FippCore object (and the lower
FryeComD and FryeComDLL components) can talk to multiple com ports without 
conflict, the FippUnit needs to be implemented as one object per com port. 

When FryeCom DLL opens a com port, it allocates data for the port and 
launches two threads to manage the port. It does this for each com port
that it opens. When the comport is closed, the threads and memory 
are released. The FryeCom DLL can access up to 255 different com ports.  


<eof>
