Hi Sheran,

Yep, you're onto the right general idea.  DBPacket (and the related packet
classes) are just abstractions in order to keep the low level packet code
in one place.  If you experiment far enough, you may need to modify,
or derive from, some of the packet classes, to create new packets.

As for the missing packet.h, that is on purpose.  The idea is to hide
all low level protocol access from the application, so that the application
does not need to worry about any changes in the low level protocols.
Ideally, the protocol may change, but the application won't have to care.
If the application messes with the packets and the command codes, then
you'd need to update your application if device logic changed.

Also, the Barry library is compiled with the g++ option -fno-strict-aliasing.
This is required because we do a lot of type casting the lower we go.
For normal applications, you don't want to use -fno-strict-aliasing,
so we need to keep the protocol code separate from the API code.

The main reason packet.h is not installed is because it includes protocol.h.
If we moved the JLPacket inline functions into the .cc file, then we
could in theory install packet.h as well.

A much better idea would be to write your own class inside the library
itself, which makes use of packet.h.  i.e. you would create your own
Mode derived class, similar to Desktop, perhaps even derived from
Desktop, which accomplishes what you desire.  Then your application
would use your new Mode.

Don't hesitate to add new classes to the library, even for testing.
It should be easy to see where to add the files in src/Makefile.am.
Once it gets polished, those new classes improve the API for all applications.

Hope this helps,
- Chris



On Sat, Jul 10, 2010 at 03:22:50PM +0700, Sheran Gunasekera wrote:
> Hello List,
> 
> I wanted to ask about the use of DBPacket.  Rather than making use of the
> LoadDatabase function in Barry::Mode::Desktop, I wanted to send my own
> command and receive a raw packet.  I am working under the impression that I
> can do something like this:
> 
> ...
> Barry::Mode::Desktop desktop(con);
> desktop.Open(); //Implement password at a later stage
> Data command, response;
> DBPacket packet(desktop, command, response);
> packet.GetRecords(dbId);
> ...
> 
> First off, is this the correct direction to move in?  If not, I'd appreciate
> some guidance on how best to move forth with requesting my own Database
> Packet.  Second, if I am on the right track, then it seems like in order to
> initiate "packet", I need to include "packet.h" in my code.  The problem is
> that packet.h was nowhere to be found in my include directory.  This leaves
> me with a few conclusions: 1) either packet.h was not copied during the
> "make install" phase. 2) I am supposed to use another approach to initiate
> DBPacket. 3) I am not supposed to initiate DBPacket at all and use another
> approach :)
> 
> Please let me know if I'm moving in the right direction or if there is a
> better way to accomplish what I am after.
> 
> Thank you,
> Sheran

> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Barry-devel mailing list
> Barry-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/barry-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Barry-devel mailing list
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel

Reply via email to