> 
> 
> In a computer-science project (I'm a student there ;)) I have to
> program an infrared connection between a Palm V and a Linux PC. On the
> Palm side I use the 3.5 SDK (C) and under Linux I would like to use Java
> (or C too, if there isn't a way to do it in Java).
> 
> I have succesfully made a HotSync via IrCOMM and have printed stuff on a
> LasterJet 2100N via IrLPT.
> But now I need to program some code to establish a data-connection by
> myself. How can I do it best ? Should I use IrObex or should I use IrComm
> ?
> 
> If you can give me some hints (some code examples whould be very very fine
> !), I will thank you very much. :-)

It depends on what sort of connections you want. There are in fact 3 choices:
1. direct ircomm connection
2. ppp over ircomm
3. obex

obex is the nicest protocol in theory, but has a few problems for some
applications on the Palm: you get lots of unavoidable dialogs, and it is
quite slow, and as the Palm only implements Put it is bad for session
type communications. It is the only one I have used and I am happy with
the restrictions. It is very easy to program. Here is a small program to
send an obex message from the Palm which irobex_palm3 can receive, without
a user interface or anything (my first palm program!):

#include <PalmOS.h>
#include <SoundMgr.h>
#include <ExgMgr.h>
#include <StringMgr.h>

ExgSocketType socketP;
Err err;

char *send = "0 message\n";

UInt32  PilotMain (UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{

  // normal application launch (all we deal with)

  if (cmd != sysAppLaunchCmdNormalLaunch)
    return 0; // ignore other startups

  MemSet(&socketP,sizeof(socketP),0);

  socketP.target = 'Ctrl';
  //socketP.count = 1; // sending 1 object
  socketP.length = 1; // of 1 byte
  //socketP.localMode = 0;
  //socketP.packetMode = 1;
  socketP.description = "Palm control message";
  socketP.type="text/plain";
  socketP.name="control.txt";

  if (ExgPut (&socketP))
    {
      // error - do what?
      SndPlaySystemSound(sndAlarm); // make a noise
      return 1;
    }

  ExgSend (&socketP, (void *)send, StrLen(send), &err);
  ExgDisconnect(&socketP, err);

  return 0;

}

_______________________________________________
Linux-IrDA mailing list  -  [EMAIL PROTECTED]
http://www4.pasta.cs.UiT.No/mailman/listinfo/linux-irda

Reply via email to