At 9:07 PM -0800 on 3/18/99, Danny Epstein wrote:

> I'm writing an application that uses the IR library. I'm wondering 
> how to verify that the device I'm running on supports IR 
> communication so I can put up a dialog and abort when necessary. 
> Scanning old messages on this list, I found:
>
> On 1/29/1999, Steve Lemke wrote:
> <snip>
>>In other words, the following should ONLY be used on Palm OS version
>>3.0.  It *WILL* change in the future (in particular, the "IrSerial
>>Library" will NOT exist in future upgrades once it is replaced with
>>the NewSerialMgr, which will make ALL of this stuff a bit easier).
> <snip>
>>    // Are we running on version 3.0?
>>    FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
>>    if ( (sysGetROMVerMajor(romVersion) == 3) &&
>>         (sysGetROMVerMinor(romVersion) == 0) ) {
>>
>>        // check for Palm III Upgrade Card (w/IR)
>>        if ( GHwrMiscFlags & hwrMiscFlagHasCardIrDA ) {
>>
>>            // found it; locate the Upgrade Card's special serial library
>>            SysLibFind("IrSerial Library", &serRefNum);
>>
>>        } else {
>>
>>            // check for IR support on motherboard
>>            if ( GHwrMiscFlags & hwrMiscFlagHasMbdIrDA ) {
>>
>>                // locate the default serial library
>>                SysLibFind("Serial Library", &serRefNum);
>>
>>            }
>>        }
>>    }
>
> My current approach is based on the above code. I first check the 
> ROM version. If it's older than 3.0 then I complain right away. If 
> it's 3.0, I check if either the hwrMiscFlagHasMbdIrDA bit or the 
> hwrMiscFlagHasCardIrDA bit is set in GHwrMiscFlags. If it's newer 
> than 3.0, I assume the device has IR support. Does this make sense? 
> Should I be checking the hardware flags on 3.1 and 3.2? Are there 
> any 3.0, 3.1 or 3.2 devices without IR hardware?
> What's the best strategy for future compatibility? Would it be 
> better to go ahead and try to open the IR library? What will happen 
> if I try to use the IR library on a device running 3.0 or later but 
> without IR hardware?

[Sorry for quoting all of that, but it keeps all of this useful 
information in one place.]

You can use my code example (SysLibFind, etc.) for Palm OS versions 
3.1 as well as 3.0.

Beyond that, things change.  Starting with Palm OS version 3.2, the 
"New SerialMgr" MAY or MAY NOT be available.  You can tell if it is 
available by looking for the feature that it installs 
(sysFileCSerialMgr, which is defined as 'smgr').  If it is present, 
you should use it, since using it directly will be faster than going 
through the "wrapper" library that is installed to provide backwards 
compatibility with apps that use the serial library APIs.  If it is 
not present, use the same code as for 3.0 or 3.1.

That said, however, I don't know if the New SerialMgr has 
documentation available yet, though I believe it may be available as 
a seed release for developers.  In any case, the New SerialMgr will 
let you open the "IR" port without your having to know the name of a 
specific serial library or having to check check hardware flags.

BTW, you should probably not assume that every post-3.0 device has IR.

Hope this helps,
--Steve

Reply via email to