At 03:11 PM 6/7/00, you wrote:
>Call UInt16 HwrDockStatus(void) and check for the 
>hwrDockStatusModemAttached bit in the result. Note that not all hardware 
>is capable of uniquely setting each bit of the result, therefore in some 
>cases a "best fit" answer is computed.
>
>// Bits returned by HwrDockStatus()
>#define hwrDockStatusUndocked           0x0000  // nothing is attached
>#define hwrDockStatusModemAttached      0x0001  // some type of modem is 
>attached
>#define hwrDockStatusDockAttached       0x0002  // some type of dock is 
>attached
>#define hwrDockStatusUsingExternalPower 0x0004  // using some type of 
>external power
>#define hwrDockStatusCharging           0x0008  // internal power cells 
>are recharging

Ok. Another question from this annoying developer wanting to use 
undocumented/supported features...

I have the 3.5 SDK and looked high and low for a header with this sort of 
function, and couldn't see it. Then I looked in the older 3.1 SDK and lo 
and behold there is Hardware.h which contains (among other things):

typedef enum {
      DockStatusNotDocked = 0,
      DockStatusInModem,
      DockStatusInCharger,
      DockStatusUnknown = 0xFF
      } hwrDockStatusState, *hwrDockStatusStateP;

and  further down...

hwrDockStatusState HwrDockStatus(void)
                         SYS_TRAP(sysTrapHwrDockStatus);

Now this is close-ish to what was suggested, so for fun, I copied the above 
bits to the top of my program's source file and inserted the following line 
when my program loads:

while ((HwrDockStatus() & DockStatusInModem) == 0) {}

i.e. loop until a 'modem' is attached. This seemed to work fine: The 
program would hold until I connected a 20 Ohm R between VCC and the GPI2 
pin on one of my IIIe's.

I assume there is a better/proper way to access this function? How do I -- 
or CAN I -- get to it in the 3.5 SDK? I didn't define the trap anywhere 
(sysTrapHwrDockStatus) so that's there, but I don't know what to include to 
get the HwrDockStatus function.

Anyone who can point out the really obvious answer I must've missed, please do!

Kris


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to