Checking if Bluetooth is ON or OFF (Here is the Ans)
| Thu, 2004-11-04 02:42 | |
|
Hi,
Bluetooth can be turned on in series60 devices using the notifier. See my previous posting.. But however this does not work in all symbian devices as it is an undocumented api. The code below atleast will find out if the bluetooth is ON or OFF. By this way the code can notify the user to turn on the bluetooth manualy. This code works in UIQ (p900/p800) as well as in Nokia 9500. TBool GetBluetoothOn() // BTONOFF { // Create and initialise an RHostResolver RHostResolver hr; TInt res = false; TBool ret; RSocketServ socketServer; User::LeaveIfError(socketServer.Connect()); CleanupClosePushL(socketServer); res = hr.Open(socketServer, KBTAddrFamily, BTLinkManager); if (KErrNone != res) { // if not success, this means bluetooth is not on ret = EFalse; } else { ret = ETrue; // Bluetooth is already ON hr.Close(); } CleanupStack::PopAndDestroy(1); return ret; } Regards murali (WideRay Corp.) |
|






Forum posts: 28
Forum posts: 308
My Other queries are ...
1. How to check for missed calls, i.e. if there is a missed call , i want to show the hooked receiver on the top of the screen as it happens usually.
2. How to check whether keypad is locked or not .Similarly in this case i want to show the key on top of the screen as it usually happens .
3. Is there an API to find out which operator network the device is connected to (a string with the name of the network) ?
Thanks
Amit
Forum posts: 12
RAknKeyLock aKeyLock;
aKeyLock.Connect(); //init
aKeyLock.IsKeyLockEnabled(); //return TBool to check if enabled
aKeyLock.EnableKeyLock() or aKeyLock.EnableWithoutNote(); //enables keypad lock
aKeyLock.DisableKeyLock() or aKeyLock.DisableWithoutNote(); //disables keypad lock
aKeyLock.Close(); //must close the notifier
good luck
Vigen
Vigen
Forum posts: 308
I cannot understand this RNotifier framework ..
can u just give me an overview of itand what all i can do with it.
Thanks
Amit
Forum posts: 1886
to get the BT state
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
to get the BT state
possible for you indetail?
Forum posts: 214
For getting the BT settings this code works OK:
RSharedDataClient sd;
sd.Connect(0);
sd.Assign( TUid::Uid( 0x10005952 ) );
sd.GetInt( _L("Visibility"), aVisibility );
sd.GetInt( _L("PowerMode"), aPower );
but unfortunately the settings don't work. The BT Manager in phone shows the new settings correctly, but actualy the bluetooth still uses old values.
"I only know that I know nothing." (Socrates)
Forum posts: 44
Does anyone know how to turn on bluetooth without getting a note? i'm using RNotifier and it gave me a note to the user whether want to turn it on or not, well...i want to get rid of this.
and how to turn off bluetooth programmatically?
need help.....
Thanx in advance,
irma
Forum posts: 214
http://www.cs.helsinki.fi/u/mraento/symbian/reverse.html
The solution works for all Symbian 60 and 80 systems I know
"I only know that I know nothing." (Socrates)
Forum posts: 44
Forum posts: 44
Is it only ....
in the header file
#include <bteng.h>
class CBTMCMSettings;
class CMyBlueToothContainer : public CCoeControl, MCoeControlObserver
{
....
private: //data
CBTMCMSettings* iBT;
};
in the .cpp
===================
#include <bteng.h>
void CMyBlueToothContainer::EnableBlueTooth()
{
iBT->SetPowerStateL(ETrue, EFalse);
}
void CMyBlueToothContainer::DisableBlueTooth()
{
iBT->SetPowerStateL(EFalse, EFalse);
}
=======================
Is it only like this? without active object or anything else?
cause...I've tried it and when I want to enable/disable bluetooth....it's "app closed" and then the bluetooth can't be detected by other device until I restart the phone
I tried it on Nokia 6600
Thanx in advance
Irma
Forum posts: 214
btset->SetPowerStateL(ETrue,EFalse);
CleanupStack::PopAndDestroy();
"I only know that I know nothing." (Socrates)
Forum posts: 1
How to turn on Bluetooth on UIQ?
In UIQ there is no BTEng.dll and there's no btnotif.h.
Anyone has the solution?
Forum posts: 36
I Tried the dumpbin from microsoft SDK, but it is obisiously not doing what itis supposed to.
Can someone email me the headers created from that lib?
My email jkekoni@utbl.net
What the SDK version does:
Microsoft (R) COFF/PE Dumper Version 7.10.2240.8
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file c:\Symbian\8.0a\S60_2nd_FP2\epoc32\release\wins\udeb\BTENG.DLL
PE signature found
File Type: DLL
FILE HEADER VALUES
14C machine (x86)
7 number of sections
4176D342 time date stamp Thu Oct 21 00:06:10 2004
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
210E characteristics
Executable
Line numbers stripped
Symbols stripped
32 bit word machine
DLL
OPTIONAL HEADER VALUES
10B magic # (PE32)
6.00 linker version
B000 size of code
C000 size of initialized data
0 size of uninitialized data
A702 entry point (1000A702)
1000 base of code
C000 base of data
10000000 image base (10000000 to 10017FFF)
1000 section alignment
1000 file alignment
4.00 operating system version
0.00 image version
4.00 subsystem version
0 Win32 version
18000 size of image
1000 size of headers
0 checksum
2 subsystem (Windows GUI)
0 DLL characteristics
100000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
11460 [ 287] RVA [size] of Export Directory
13000 [ 140] RVA [size] of Import Directory
0 [ 0] RVA [size] of Resource Directory
0 [ 0] RVA [size] of Exception Directory
0 [ 0] RVA [size] of Certificates Directory
17000 [ 4F8] RVA [size] of Base Relocation Directory
C000 [ 1C] RVA [size] of Debug Directory
0 [ 0] RVA [size] of Architecture Directory
0 [ 0] RVA [size] of Global Pointer Directory
0 [ 0] RVA [size] of Thread Storage Directory
0 [ 0] RVA [size] of Load Configuration Directory
0 [ 0] RVA [size] of Bound Import Directory
13804 [ 6C4] RVA [size] of Import Address Table Directory
0 [ 0] RVA [size] of Delay Import Directory
0 [ 0] RVA [size] of COM Descriptor Directory
0 [ 0] RVA [size] of Reserved Directory
SECTION HEADER #1
.text name
AC8C virtual size
1000 virtual address (10001000 to 1000BC8B)
B000 size of raw data
1000 file pointer to raw data (00001000 to 0000BFFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read
RAW DATA #1
10001000: CC CC CC CC CC E9 B6 38 00 00 E9 69 54 00 00 E9 ÌÌÌÌÌé¶8..éiT..é
10001010: F1 21 00 00 E9 07 3D 00 00 E9 0F 4E 00 00 E9 6A ñ!..é.=..é.N..éj
10001020: 0E 00 00 E9 08 3B 00 00 E9 53 63 00 00 E9 70 31 ...é.;..éSc..ép1
10001030: 00 00 E9 2E 24 00 00 E9 6B 94 00 00 E9 8F 61 00 ..é.$..ék...é.a.
10001040: 00 E9 05 0F 00 00 E9 45 39 00 00 E9 A0 17 00 00 .é....éE9..é ...
10001050: E9 27 0C 00 00 E9 89 7E 00 00 E9 21 5F 00 00 E9 é'...é.~..é!_..é
...
Forum posts: 36
bteng.h
#define BT_ENG_HACK_H
// link against BTENG.LIB copied from SDK 1.2
// these are headers that are just not included
// in the SDK, so I had to reverse engineer them
//C:\Symbian\tilion\group>"c:\Program Files\Borland\CBuilder6\Bin\expdump.exe"
// C:\Symbian\Series60_1_2_B\epoc32\release\winsb\udeb\BTENG.LIB
class MBTMCMSettingsCB
{
};
class CBTMCMSettings;
class CBTMCMSettings
{
public:
static CBTMCMSettings* NewLC(MBTMCMSettingsCB *x);
static CBTMCMSettings* NewL(MBTMCMSettingsCB *x);
void SetPowerStateL(TBool a, TBool b);
void GetPowerStateL(TBool &a);
TInt GetConnectionStatus(int &a);
};
#endif
Then you need to install SDK 1.2.
Then you need to copy bteng.lib file from:
C:\Symbian\Series60_1_2_B\epoc32\relese\armi\udeb
to:
C:\Symbian\7.0s\Series60_v21\Epoc32\release\armi\udeb
and
C:\Symbian\Series60_1_2_B\epoc32\relese\armi\urel
to:
C:\Symbian\7.0s\Series60_v21\Epoc32\release\armi\urel
(and same to thumb).
You need to link againts
bteng.lib in mmp file.
And the following code will turn on BT.
The compiled code works with 6630.
settings= CBTMCMSettings::NewL( (MBTMCMSettingsCB*)NULL );
settings->SetPowerStateL(ETrue,EFalse ); // on, off is (EFalse,EFalse)
I have checked this S60V2FP1 SDK with Borland tools and tested on N6630.
I have not cheked this with emulator, but no-one has the BT/internet working with the emulator anyway.