> I am trying to write data to a TEC B-211 portable printer through the 
> IR port on the Palm SPT1700 device from Symbol.  Since the TEC-printer
> is only IrDA compatible on the SIR physical layer, I don't know how
> to write to it on this (low) level.

What you want to do is not a terribly easy task.

I've written code (under contract to a division of Symbol) to print to a TEC
B-211.  However, I can't give the code to you without permission of that
division.

The general idea is to use the serial manager to drive the IR port,
communicating in half-duplex mode.  You'll need to disable receiving before
sending, and then re-enable it after sending.

Here's a bit of code that I use to enable/disable receiving, and also to set
options so that the serial manager will use the IR port rather than the
serial port.

Neil

static Err DisableReceive()
{
  SerReceiveFlush(gSerialRefNum, 0);
 return SerControl(gSerialRefNum, serCtlRxDisable, NULL, 0);
}

static Err SetOptions()
{
 Err err;
 SerSettingsType settings;
 
 settings.baudRate = kTecIRBaudRate;
 settings.flags = serSettingsFlagStopBits1 | serSettingsFlagBitsPerChar8;
 err = SerSetSettings(gSerialRefNum, &settings);
 if (err)
  return err;
#ifdef nodef
 // this control call seems to sometimes crash. Don't know why
  // Also, it returns 768 (serErrNotImplemented) on an SPT1740
  // (although it works fine on a Palm VII which also runs Palm OS 3.2)
 err = SerControl(gSerialRefNum, serCtlIrScanningOff, NULL, 0);
 if (err)
  return err;
#endif
 err = SerControl(gSerialRefNum, serCtlIrDAEnable, NULL, 0);
 if (err)
  return err;

 err = DisableReceive();
 return err;
}

static Err EnableReceive(int pauseAmount)
{
 const Long kSerSendTimeoutParameter = -1;
 Err err;
 Err err2;
 err = SerSendWait(gSerialRefNum, kSerSendTimeoutParameter);
 if (pauseAmount) {
  Pause(pauseAmount);
 }
 err2 = SerControl(gSerialRefNum, serCtlRxEnable, NULL, 0);
 if (err == 0)
  err = err2;
  return err;
}


> My question is:
> ----------------
> Is it possible to write to this printer via the IR-port on a serial
> level (SIR), and if so, how?  (just in general terms)
> Can someone point out some places to look for more info on this subject?
>
> Equipment I am using:
> ----------------------
> CodeWarrior on a Win-NT PC to make PalmOS applications,
> Symbol SPT-1700 palm device with barcode scanner,
> TEC B-211 portable printer with IR receiveing capabilities.
>
>
> Best regards,
>                   Sigurdur Ragnarsson,
>     Strengur hf.
>     Armuli 7
>     108 Reykjavik
>     Iceland
>
> mail:  [EMAIL PROTECTED]
>



--
Neil Rhodes
Calliope Enterprises, Inc.
1328 Clock Avenue
Redlands, CA  92374
(909) 793-5995     [EMAIL PROTECTED]      fax: (909) 793-2545

Reply via email to