#include <BtPrefsPnlTypes.h>

Err TurnBluetoothOnOff(Boolean fOn)
{
        DmSearchStateType state;
        UInt16 cardNo;
        LocalID dbID;
        Err err;

        err = DmGetNextDatabaseByTypeCreator(true,&state,sysFileTPanel,
                        sysFileCBluetoothPanel,true,&cardNo,&dbID);
        if (err == errNone)
        {
                SvcCalledFromAppPBType *cmdPBP;
                UInt32 result;

                err = (Err)-1;
                cmdPBP = 
(SvcCalledFromAppPBType*)MemPtrNew(sizeof(SvcCalledFromAppPBType));
                if (cmdPBP)
                {
                        MemPtrSetOwner(cmdPBP,0);
                        cmdPBP->cmd = svcCFACmdSetBtOnOff;
                        cmdPBP->data.bValue = fOn;
                        err = SysAppLaunch(cardNo, dbID, 0, 
sysAppLaunchCmdPanelCalledFromApp,
                                        (MemPtr)cmdPBP, &result);
                }
        }
}


On Thu, Sep 11, 2008 at 10:32 PM, Harald Schlangmann
<[EMAIL PROTECTED]> wrote:
> Thanks Jeff, using the front end seems to be the only way... Any other
> pointers how to launch the panel and using "command blocks" appreciated.
>
> Grüße, Harald
>
> -
> Harald Schlangmann
> Antwerpener Str. 52, 50672 Köln, Germany
> Handy: 0171-7663089
> [EMAIL PROTECTED]
> http://www.gps-laptimer.de
>
>
> -----Ursprüngliche Nachricht-----
> Von: Jeff Loucks [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 11. September 2008 09:35
> An: Palm Developer Forum
> Betreff: Re: AW: Bluetooth switch on or off
>
> See BtPrefsPnlTypes.h. You can launch the Bluetooth panel with a
> command block to turn on/off, etc.
>
> On Wed, Sep 10, 2008 at 10:49 PM, Harald Schlangmann
> <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> as Bluetooth app is able to turn on and off (on a hardware basis), it
> should
>> be possible by other apps too... The reason I was looking for a way to
>> acomplish this programatically, are bugs in the bluetooth stack (Treo
> 650).
>> From time to time connection to a GPS mouse breaks and cannot be
>> reconnected. Either turning on and off the whole device - or turning on
> and
>> off the bluetooth device is the only way to make it operable again.
>>
>> Grüße, Harald
>>
>> -
>> Harald Schlangmann
>> http://www.gps-laptimer.de
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Eric Bresie [mailto:[EMAIL PROTECTED]
>> Gesendet: Donnerstag, 11. September 2008 04:35
>> An: Palm Developer Forum
>> Betreff: Re: AW: Bluetooth switch on or off
>>
>> If I am not mistaken, the Open and Close are for loading and unloading
>> the library.
>>
>> From the API Reference, I find "The user can turn the radio on and off
>> with a setting in the preferences panel."
>>
>> You might look at the preference reference manual...
>>
>> http://www.accessdevnet.com/docs/palmos/PalmOSReference/Preferences.html
>>
>> Or maybe with the BlueToothGeneral preferences with
>>
>>
> http://www.accessdevnet.com/docs/palmos/PalmOSReference/BtLibRef_Mgt.html#10
>> 29612
>>
>> Eric
>>
>> On Wed, Sep 10, 2008 at 9:19 PM, Ben Rittgers <[EMAIL PROTECTED]> wrote:
>>> I think you are not supposed to turn it off programmaticly because you
>> will
>>> introduce delay if the user switches to another application which uses
>>> Bluetooth.  It's like with the net library API call.  That allows someone
>> to
>>> browse on the browser than send an e-mail without reconnecting.  If your
>>> connection is your Bluetooth enabled cell phone then is not desirable to
>>> shut off that connection when they exit your application.
>>>
>>> BtLibClose is sufficient to turn off BT for your application.  That way
>> you
>>> don't break the send command functionality.
>>>
>>> Benjamin Rittgers
>>> http://writerbenjamin.com
>>> [EMAIL PROTECTED]
>>>
>>> Harald Schlangmann wrote:
>>>>
>>>> In my oppinion, neither BtLibOpen turns BT on nor does BtLibClose turn
> it
>>>> off. It is just about the programmatic connection to the physical
> device.
>>>> I
>>>> would be interested in a way to turn on / off the hardware (as it is
> done
>>>> in
>>>> the Bluetooth app) too...
>>>>
>>>> Grüße, Harald
>>>>
>>>> -
>>>> Harald Schlangmann
>>>> http://www.gps-laptimer.de
>>>>
>>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: John Wilund [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 10.
>>>> September 2008 12:57
>>>> An: Palm Developer Forum
>>>> Betreff: Re: Bluetooth switch on or off
>>>>
>>>>> Hello,
>>>>> is there any way how to switch bluetooth programatically on or off? The
>>>>> only way I have found is BtLibOpen to turn on...
>>>>>
>>>>> Thanks in advance.
>>>>> Hynek Sladky
>>>>
>>>> Try BtLibClose!!!
>>>>
>>>>
>>>>
>>
> http://www.accessdevnet.com/docs/palmos/PalmOSReference/BtLibRef_Mgt.html#10
>>>> 28751
>>>>
>>>> /John
>>>>
>>>
>>> --
>>> For information on using the ACCESS Developer Forums, or to unsubscribe,
>>> please see http://www.access-company.com/developers/forums/
>>>
>>
>>
>>
>> --
>> Eric Bresie
>> [EMAIL PROTECTED]
>>
>> --
>> For information on using the ACCESS Developer Forums, or to unsubscribe,
>> please see http://www.access-company.com/developers/forums/
>>
>>
>>
>> --
>> For information on using the ACCESS Developer Forums, or to unsubscribe,
> please see http://www.access-company.com/developers/forums/
>>
>
>
>
> --
> [Jeff Loucks, Gig Harbor, WA, USA]
>
> --
> For information on using the ACCESS Developer Forums, or to unsubscribe,
> please see http://www.access-company.com/developers/forums/
>
>
>
> --
> For information on using the ACCESS Developer Forums, or to unsubscribe, 
> please see http://www.access-company.com/developers/forums/
>



-- 
[Jeff Loucks, Gig Harbor, WA, USA]

-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to