How to get device bluetooth name?
Login to reply to this topic.
mar, 2005-05-24 16:22
Joined: 2005-04-06
Forum posts: 26
hi,
is anyone know how can i get the device bluetooh name (it's name not the one who connect with it)? what method and library should i use?
all i know that the return value should be THostName.

thanks.
regards,
tantius

Share ur knowledge with everbody.so  it won't be lost if u share it.^^


mar, 2005-05-24 17:39
Joined: 2005-04-18
Forum posts: 31
Try this, I've omitted all error handling:


RSocketServ ss;
ss.Connect();

TProtocolDesc pInfo;
ss.FindProtocol(_L("BTLinkManager"), pInfo);

RHostResolver hr;
hr.Open(ss,pInfo.iAddrFamily,pInfo.iProtocol);

THostName hostname;
hr.GetHostName(hostname);

hr.Close();
ss.Close();


jeu, 2005-05-26 07:05
Joined: 2005-04-06
Forum posts: 26
i tried ur code u give me, and it crashes the program on section

hr.getHostName(hostname)

i'm needing it cause i'm doing bluetooth point to multipoint, i already get the name of one that connected to me, but i don't know my own device name. so perhaps i'm misunderstand and u could correct me, thx

regards,
tantius

Share ur knowledge with everbody.so  it won't be lost if u share it.^^

jeu, 2005-05-26 07:52
saprami (non vérifié)
Forum posts: 2037
hi
i was facing the same problem......in the open funtion status i get an error
but if i port same code on mobile 6600 then it restarts the mobile.
ifu have some solution plese tell
jeu, 2005-05-26 08:57
Joined: 2005-04-06
Forum posts: 26
i add this code to my program, and it doesn't crash anymore.

   iResolver.GetHostName(hName,iStatus);
   User::WaitForRequest(iStatus);

note : don't use the    iResolver.GetByAddress(iAddr, iEntry, iStatus);
because if you want to get the local host name, you have to run the GetHostName first. my program crashes when running GetByAddress then GetHostName. So i turn the order of the method, and it doesn't crash anymore.

Thanks alot to Gavin. ^^

to Saprami,
i usually used the User::LeaveIfError() method everytime to try to open the socket.
code example :
   User::LeaveIfError(iResolver.Open(*iSocketServ, pdesc.iAddrFamily, pdesc.iProtocol));

maybe it helps. i'm still new also in symbian. sory.

Regards,
Tantius

Share ur knowledge with everbody.so  it won't be lost if u share it.^^

mer, 2005-07-06 11:46
Joined: 2004-08-16
Forum posts: 98
But when the program executes hr.Open(ss,pInfo.iAddrFamily,pInfo.iProtocol);, it make the mobile phone restart !!!!!!!!!!!!!!!
It doesn't run to iResolver.GetHostName(hName,iStatus);.
That's to say hr.open() not iResolver.GetHostName causes the mobile phone restarts, who can tell me how to solve it ?
jeu, 2005-07-07 14:36
Joined: 2005-04-06
Forum posts: 26
gavin and i removed the error handling.

try add this :
User::LeaveIfError(iResolver.Open(*iSocketServ, pdesc.iAddrFamily, pdesc.iProtocol));

i hope it doesn't restart again.
regards,
tantius

Share ur knowledge with everbody.so  it won't be lost if u share it.^^

mar, 2005-08-09 11:21
Joined: 2005-02-11
Forum posts: 212
This will get you the bluetooth name:
Code:
RSharedDataClient sd;
sd.Connect(0);
sd.Assign( TUid::Uid( 0x10005952 ) );
TInt ret=sd.GetString( _L("LocalName"), aName );
sd.Close();

"I only know that I know nothing." (Socrates)

mer, 2005-08-17 07:31
Joined: 2004-05-26
Forum posts: 732
In which header file we can find the class RSharedDataClient?

jeu, 2005-08-18 06:26
Joined: 2005-02-11
Forum posts: 212
None  Smiley.

Code:
class RSharedDataClient {
public:
RSharedDataClient(class MSharedDataNotifyHandler *);
RSharedDataClient(void);
int Assign(class TUid) const;
int AssignToTemporaryFile(class TUid) const;
void CancelAllNotifies(void);
void CancelNotify(class TUid,class TDesC16 const *);
void Close(void);
int Connect(int);
int Flush(void) const;
int GetInt(class TDesC16 const &,int &) const;
int GetReal(class TDesC16 const &,double &) const;
int GetString(class TDesC16 const &,class TDes16 &) const;
int NotifyChange(class TUid,class TDesC16 const *);
int NotifySet(class TUid,class TDesC16 const *);
int RestoreOriginal(class TUid,class MDesC16Array const *);
int SetInt(class TDesC16 const &,int);
int SetReal(class TDesC16 const &,double);
int SetString(class TDesC16 const &,class TDesC16 const &);
void CancelFreeDiskSpaceRequest(void) const;
void RequestFreeDiskSpace(int) const;
void RequestFreeDiskSpaceLC(int) const;
int AddToValue(class TDesC16 const &,int);
void CancelAllSignals(void);
void CancelSignal(class TDesC16 const &);
int Signal(class TDesC16 const &);
private:
void *v1,*v2,*v3,*v4;
};


"I only know that I know nothing." (Socrates)

jeu, 2005-08-18 06:39
Joined: 2004-05-26
Forum posts: 732
Sorry I am confused Huh Could you please tell me whether that class is from the SDK and if please specify from which header file, because I used the code snipets that you posted , but was giving me an error like this: 'RSharedDataClient' : undeclared identifier.

jeu, 2005-08-18 06:56
Joined: 2005-02-11
Forum posts: 212
It's reverse engineered.
If you know foreign languages (russian) then read this forum:
http://club60.org/viewtopic.php?t=6229&start=0

"I only know that I know nothing." (Socrates)

jeu, 2005-08-18 08:59
Joined: 2004-05-26
Forum posts: 732
Quote from: riho
It's reverse engineered.
How can we reverse engineer Symbian OS API's?

Quote from: riho
If you know foreign languages (russian) then read this forum: http://club60.org/viewtopic.php?t=6229&start=0
Sorry I donno Russian language. Can you suggest any other English artice/site/url.

NB: I am using Series 60 SDK v2.0.

jeu, 2005-08-18 10:47
Joined: 2005-02-11
Forum posts: 212
About reverse engineering read Mika Raento website (use Google)
About english web - haven't found any, only this one.

"I only know that I know nothing." (Socrates)

ven, 2005-08-19 03:34
Joined: 2004-05-26
Forum posts: 732
Quote from: riho
About reverse engineering read Mika Raento website (use Google)

I had read the article from this url: Symbian Programming - Reverse engineering LIBs - Mika Raento.

Still one more doubt. Which LIB file did you reverse engineer to get the class details of RSharedDataClient?

ven, 2005-08-19 10:09
Joined: 2005-02-11
Forum posts: 212
I didn't in this case, I don't even know which dll has this function (probably some common one, that is already included in my project). I just include the header file to my code and use it

"I only know that I know nothing." (Socrates)


copyright 2003-2009 NewLC SARL