[Winsock BT] How to get phonebook using socket API
Hello,
I am writing an app to get phonebook from device.
I've connect to a device has PBAP service.
But after that, i don't know how to pull the phonebook to my local PC.
Any feedback is appreciated.
ULONG ulRetCode = 0;
int iCxnCount = 0;
char szData[CXN_TRANSFER_DATA_LENGTH] = {0};
SOCKET LocalSocket = INVALID_SOCKET;
SOCKADDR_BTH SockAddrBthServer = {0};
// Setting address family to AF_BTH indicates winsock2 to use Bluetooth sockets
// Port should be set to 0 if ServiceClassId is spesified.
SockAddrBthServer.addressFamily = AF_BTH;
SockAddrBthServer.btAddr = (BTH_ADDR) ululRemoteAddr;
SockAddrBthServer.serviceClassId = PhonebookAccessPseServiceClass_UUID;
// Valid ports are 1 - 31
SockAddrBthServer.port = 0;
LocalSocket = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
connect(LocalSocket, (struct sockaddr *) &SockAddrBthServer, sizeof(SOCKADDR_BTH))
// what's the right request command??
send(LocalSocket, Command, strlen(Command)*sizeof(wchar_t)+1, 0);
recv(LocalSocket, recvbuf, recvbuflen, 0);
// Prepare all necessary command
char ConnectCommand[255] = {
0x80, //0x00,0x03};
0x00,0x1a, // 2 packet length
0x10, // 1 version number(1.0)
0x00, // 1 connect flag (must be 0 in sending side)
0x08,0x00, // 2 Maximum OBEX packet length
0x46, //Target header identifier
0x00,0x13, // length of Target header identifier
0x79,0x61,0x35,0xf0,0xf0,0xc5,0x11,0xd8,0x09,0x66,0x08,0x00,0x20,0x0c,0x9a,0x66 //PBAP UUID
unsigned char GetCommand[] = {
0x83,
0x00,0x5d,
0xcb, // HI for ConnectionId header
0x00,0x00,0x00,0x01, // Connection ID
0x01, // HI for Name header
0x00,0x2b, // length of Name header
0x00,0x53,0x00,0x49,0x00,0x4d,0x00,0x31,0x00,0x2f,0x00,0x74,0x00,0x65,0x00,0x6c,0x00,0x65,0x00,0x63,0x00,0x6f,0x00,0x6d,0x00,0x2f,0x00,0x70,0x00,0x62,0x00,0x2e,0x00,0x76,0x00,0x63,0x00,0x66,0x00,0x00, // SIM1\telecom\pb.vcf
0x42, // HI for Type header
0x00,0x12, // length of empty Type header
0x78,0x2d,0x62,0x74,0x2f,0x70,0x68,0x6f,0x6e,0x65,0x62,0x6f,0x6f,0x6b,0x00, // x-bt/phonebook
0x4c, // HI for App.Parameter header
0x00,0x18, // length of App.Parameter header
0x06,0x08,0x00,0x00,0x00,0x3f,0xff,0xff,0xff,0xff,0x07,0x01,0x00,0x04,0x02,0xff,0xff,0x05,0x02,0x00,0x00
unsigned char ContinueGetCommand[] = {
0x83,
0x00,0x03
//set to root
unsigned char SetPathCommand[] = {
0x85, // opcode
0x00,0x0d, // packet length
0x02, // flag
0x00, // constants(always zero)
0xcb, // HI of ConnectionID
0x00,0x00,0x00,0x02, // ConnectionID (diff at each connect)
0x01, // HI of Name
0x00,0x03 // length of Name
//set to telecom
unsigned char SetPathCommand2[] = {
0x85,
0x00,0x1d,
0x02,0x00,
0xcb,
0x00,0x00,0x00,0x02,
0x01,
0x00,0x13,
0x00,0x74,0x00,0x65,0x00,0x6c,0x00,0x65,0x00,0x63,0x00,0x6f,0x00,0x6d,0x00,0x00
//set to PB
unsigned char SetPathCommand3[] = {
0x85,
0x00,0x13,
0x02,0x00,
0xcb,
0x00,0x00,0x00,0x02,
0x01,
0x00,0x09,
0x00,0x70,0x00,0x62,0x00,0x00
//vcard-listing:phonebook size
unsigned char GetVLCommand[] = {
0x83, // opcode
0x00,0x2f, // packet length
0xcb, // HI of ConnectionID
0x00,0x00,0x00,0x02, // ConnectionID
0x42, // HI of Type
0x00,0x16, // length of Type
0x78,0x2d,0x62,0x74,0x2f,0x76,0x63,0x61,0x72,0x64,0x2d,0x6c,0x69,0x73,0x74,0x69,0x6e,0x67,0x00,
0x01, // HI of Name
0x00,0x03, // length of Name
0x4c, // App. Parameter
0x00,0x0e, // length of App.Parameter
0x01,0x01,0x01,0x04,0x02,0x00,0x00,0x05,0x02,0x00,0x01
//vcard-listing
unsigned char GetVLCommand2[] = {
0x83,
0x00,0x2f,
0xcb,
0x00,0x00,0x00,0x02,
0x42,
0x00,0x16,
0x78,0x2d,0x62,0x74,0x2f,0x76,0x63,0x61,0x72,0x64,0x2d,0x6c,0x69,0x73,0x74,0x69,0x6e,0x67,0x00,
0x01,
0x00,0x03,
0x4c,
0x00,0x0e,
0x01,0x01,0x01,0x04,0x02,0xff,0xff,0x05,0x02,0x00,0x00
//get vcf
unsigned char GetVCFCommand[] = {
0x83,
0x00,0x39,
0xcb,
0x00,0x00,0x00,0x02,
0x01,
0x00,0x13,
0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x2e,0x00,0x76,0x00,0x63,0x00,0x66,0x00,0x00, //000.vcf
0x42,
0x00,0x0e,
0x78,0x2d,0x62,0x74,0x2f,0x76,0x63,0x61,0x72,0x64,0x00,
0x4c,
0x00,0x10,
0x06,0x08,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x84,0x07,0x01,0x00
unsigned char DisconnectCommand[] = {
0x81,
0x00,0x08,
0xcb,
0x00,0x00,0x00,0x02
Successfully download phonebook from Htc M7
Similar Messages
-
In ABAP HR how to get job using position
In ABAP HR how to get job using position (Using Infotype 1001)
Hi anilkumar,
1. u have the position
u want the Job
2. In hrp1001 table
OTYPE = 'S' (for position)
OBJID = POSITION (AS ABOVE)
SCLAS = 'C' (for finding job)
<b> SOBID = XXXXXX (here u will get the JOB)</b>
regards,
amit m. -
How to get image using Http and how to save in Smulator
Hi guys,
Am working in black berry bold. i dont know how to get image using htp connection and one more thing i need to save this image in side simulator directory............. what are the specific API i should...
Guide me.........If you want the input image size you need to pass it in as parameters.
A discussion thread on this topic is:
http://forums.adobe.com/thread/29948
-- Daniel R. <[email protected]> http://danielr.neophi.com/ -
Hi out there. To capture a screen shot one uses: Command-Shift-3 or 4. I have done this for a long time. Now suddenly neither screen shot command works anymore. Suggestions how to get this useful function back? Thanks, Georgx
Command-Shift-3 and 4 works just fine on several Macs that I have here.
Try restarting your Mac....or post in the specific support area for your Mac model....for more advice.
https://discussions.apple.com/index.jspa -
How to Transfer files using socket remote method invocation?
hello guys,
i am working on java sockets...and i need to send and receive files though Java RMI. how will i go with it....
Please do help me in this regard
Edited by: sandeep_genevsoftech on Apr 4, 2008 4:32 AMI am also developing a similar application of file transfer but using sockets in place of RMI.The file gets transfered if i run client and server on same m/c(as localhost),but shows "access denied" if run on different m/c.I suppose some security policies need to be set.Can anybody help?
-
Hi,
I have this xml file stored in operator.xml
<Operator>
<Customer>
<Name>sam</Name>
<Street>albert str.</Street>
<ZipCode>45454</ZipCode>
<City>NY</City>
<Country>USA</Country>
<EMailAddress>[email protected]</EMailAddress>
<MeterNumber>1000</MeterNumber>
<MeasuringUnit>kWh</MeasuringUnit>
<Reading>
<Month>1</Month>
<Value>900</Value>
</Reading>
<Reading>
<Month>2</Month>
<Value>725</Value>
</Reading>
<Reading>
<Month>3</Month>
<Value>950</Value>
</Reading>
</Customer>
</Operator>I have the following getter statements in my code:
String name=req.getName();
int month=req.getMonth();Now, I want to get value for particular customer (by checking name for equality with getter) and for particular month( by checking for equality with getter).
I have written the following statements:
final String filename="operator.xml";
SAXBuilder builder=new SAXBuilder(true);
Document doc=builder.build(filename);
Element root=doc.getRootElement();How to proceed further using JDOM. I am confused with getChild(), getChildText() etc.,
thanks,Obtain values with the JDom XPath class selectSingleNode and selectNodes methods.
SAXBuilder saxBuilder=new SAXBuilder("org.apache.xerces.parsers.SAXParser");
org.jdom.Document jdomDocument=saxBuilder.build(new File("c:/input.xml"));
org.jdom.Element zipcodeNode= (org.jdom.Element)(XPath.selectSingleNode(jdomDocument,"/Operator//Customer/zipCode")); -
How to get InitialContextFactory using RMI/IIOP without using weblogic.jar
Hi Robert
I know this is an old post. but I am interested in knowing how to get the
initial context using RMI/IIOP without the use weblogic specific classes
like weblogic.jndi.WLInitialContextFactory . If you have a code snippet that
you can provide as an example, it would be just great.
thanx in advance
Daya Sharma
See comments inline...
Stewart Wachs wrote:
I would like to get an initial context to Weblogic JNDI from a client.
code snippet:
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFacorty");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
try {
Context ctx = new InitialContext(ht);
catch(...) {
This works fine when I include weblogic.jar (and other dependend weblogic
jar's) in the classpath.
Is there a way to access WL JNDI from a client without the weblogicclasses
in the classpath?If you are using WLS 6.1, you could use RMI/IIOP to do this but in general,
the
answer is no, you will need at least some of the weblogic classes on the
client.
If not, is there a lightweight jar available for distribution for client
JNDI connectivity?This is something in the works. In addition, a colleague and I are working
on
a white paper that describes the "Thin Client Options with WebLogic Server"
that we hope to make available in the not too distant future...
Are there any licencing issues with distributing the weblogic classes to
clients that need to access WL JNDI?No. WLS is licensed by the server so you are free to distribute
weblogic.jar
to your clients.
Hope this helps,
RobertTake a look at the RMI/IIOP section of our whitepaper "Small Footprint
Client options for BEA WebLogic Server" at:
http://dev2dev.bea.com/resourcelibrary/whitepapers.jsp?highlight=whitepapers
Daya Sharma wrote:
Hi Robert
I know this is an old post. but I am interested in knowing how to get the
initial context using RMI/IIOP without the use weblogic specific classes
like weblogic.jndi.WLInitialContextFactory . If you have a code snippet that
you can provide as an example, it would be just great.
thanx in advance
Daya Sharma
See comments inline...
Stewart Wachs wrote:
I would like to get an initial context to Weblogic JNDI from a client.
code snippet:
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFacorty");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
try {
Context ctx = new InitialContext(ht);
catch(...) {
This works fine when I include weblogic.jar (and other dependend weblogic
jar's) in the classpath.
Is there a way to access WL JNDI from a client without the weblogic
classes
in the classpath?
If you are using WLS 6.1, you could use RMI/IIOP to do this but in general,
the
answer is no, you will need at least some of the weblogic classes on the
client.
If not, is there a lightweight jar available for distribution for client
JNDI connectivity?
This is something in the works. In addition, a colleague and I are working
on
a white paper that describes the "Thin Client Options with WebLogic Server"
that we hope to make available in the not too distant future...
Are there any licencing issues with distributing the weblogic classes to
clients that need to access WL JNDI?
No. WLS is licensed by the server so you are free to distribute
weblogic.jar
to your clients.
Hope this helps,
Robert -
How to get or use "kTextFrameOversetChangeMsg" as serviceid?
Hi all
I've developed a small plugin for handling textframe overflow. I've used service ids "kBeforeSaveDocSignalResponderService", "kBeforeSaveAsDocSignalResponderService". But actually I've to run it, only when overflow occurs.
Steven suggested to use "kTextFrameOversetChangeMsg". I tried, but I dont know exactly how to use it as service id. Could anyone suggest on this?
thanks in advance
A.HakkimThank u both. Pls suggest me how to get serviceid from "kTextFrameOversetChangedMsg".
-
How to get and use mouse information?
I want to write a simple program for getting mouse location, and if the location of the mouse is within an area, then a red dot show on the screen.
Could anyone please teach me how to get mouse location?
Thankshttp://java.sun.com/docs/books/tutorial/uiswing/events/mouselistener.html
http://java.sun.com/docs/books/tutorial/uiswing/events/mousemotionlistener.html
http://java.sun.com/docs/books/tutorial/uiswing/events/mousewheellistener.html
Doh! Too slow!
Message was edited by:
DrLaszloJamf -
How to get the GP Denpedencies(API) for NWDS CE7.1 EHP1
Hi Frndz...
I have 3 Qun's..
1) How to get GP API in EHP1 NWDS7.1 in NWDS 7.0 we can get by D/L gp_api_nw04s.zip,gp_TopLevelDCs.zip and xtracting these to
Location to Extract gp_api_nw04s.zip=>
C:\Program Files\SAP\IDE\IDE70\eclipse\plugins\com.sap.tc.ap_2.0.0\comp\CAF\DCs\sap.com\caf\eu\gp
Location to Extract gp_TopLevelDcs.zip=>
C:\Program Files\SAP\IDE\IDE70\eclipse\plugins\com.sap.tc.ap_2.0.0\comp\CAF\SCs\sap.com\CAF\_comp\TopLevelDCs
i done the same thing like above for NWDS 7.1(EHP1) but am not getting the GP Dependcies for development.How can i resolve this.
2) When am deploying the app with CE7.1(EHP1) app is deploying well but when output coming on browser its giving error , n i changed the browser settings in NWDS to all options but no use.
3)Am doing CO in which i have two action buttons(result states)for this am going like this
In getDescription()
IGPCOResultStateInfo success = technicalDescription.addResultState("Success");
success.setDescriptionKey("Success_desc");
IGPCOResultStateInfo reject = technicalDescription.addResultState("Reject ");
reject .setDescriptionKey("Success_desc");
In complete()
executionContext.setResultState("Success");
executionContext.setResultState("Reject");
executionContext.processingComplete();
but after creating the action-->CO am finding only Success Result State only(no Reject Result State), anybody tell me what wrong am doing.
In my case i have to Result states Accept n Deny , if Approver1 clicks on Accept button flow has goes to Approver2 if not it should goto initiator how zit ??.If anybody have idea plz share with me .not answered
-
How to get iterator used on jsff from button clicked on jspx
Hi All,
I am using jdeveloper 11.1.1.5.
I have a bounded task flow and inside that I have a jsff and I have added one iterator in its bindings. Now I have dragged that jsff on my jspx page as a region.
I have a button on my jspx page I want to find the iterator of the jsff on button click.
How to find it.
Please help.
-- NavinKThanks Timo for your reply.
Does that mean We have to add the same iterator in the bindings of jspx as well ?
In my case I have added the iterator to my jspx page but I am getting the error described in InputText value is not getting updated in Iterator
Please help.
--NavinK -
How I get started using voice input with mac mail?
Just got a new Imac. have had Apple computers for a long time. Want to start using voice input with mail. How do I get started?
Apple's voice input options are the following:
Dictation
This allows you to speak a phrase and have the system enter it as text in any text field, be it a name and address form or a text editor like Pages or Word. The settings for this service are in the Dictation system preferences, and by default you activate it by pressing the Fn key twice in a row and then speak the desired phrase after you hear the bing sounds.
Speakable Items
This option allows you to somewhat control the Mac's interface elements by speaking key phrases to the system. This option is enabled in the Accessibility system preferences, and is at the bottom of the listed services. In here you can turn on the service and calibrate it to properly hear your voice, set a "listening key" (similar to the Fn key for Dictation), and then enable various command libraries. -
How to get bytes[] using jni functions
I am new to JNI and have a question. I have a java class which returns back bytes[]
I have the class jclass for the object and the jmethodid bytesMethodID which is mapped like this:
bytesMethodID = (*env)->GetMethodID(env, objcls, "bytes", "()[B");
now in the c impementation I have a stuct pointer
DESIGN_STRUCT *str= NULL;
How do I assign the bytes[] into this struct pointer? If I do the following:
str = (*env)->CallObjectMethod(env, obj, bytesMethod());
I get a "assignment from incompatible pointer type" if I change that to:
str = (*env)->CallBytesMethod(env, obj, bytesMethod());]
I get a "assignment makes pointer from integer without a cast"
My question is what JNI function do i use to get back a byte[]
Any help and pointers greatly appreciated.
Thanks,You should use CallObjectMethod() and cast the return value to a jbyteArray. Then you need to use a function like GetByteArrayElements() to actually retrieve the individual elements in that array.
God bless,
-Toby Reyelts
Check out the free, open-source, JNI toolkit, Jace - http://jace.reyelts.com/jace. -
HOw to get DatabaseMetaData using JPA
hi;
I am using ejb3 , jpa for database connectivity .is there any way to get the metadata about the database in JPA.
ie:- in JDBC we can use DatabaseMetaData for getting this. HOw can we get the Database Meta Data by using JPA.
Regards
IrshadIn addition to Gurvinder references, go over the productCatalog.xml or customCatalog.xml file to know the properties in each item-descriptor of ProductCatalog.
In your requirement skuid is same as repositoryId.
If you are using in jsp then use SKULookUp droplet to get the sku repositoryItem.
If you need it in java code then use catalogTools.findSKU(String skuid).
Peace
Shaik -
How to get SLA using Calendar rules?
How can I add 24hrs to the time using the calendar rules? For Example, If the Monday's date is given I need to get Tuesday's date as SLA. If I give Friday's date I need to get Monday's date as SLA. I have tried using
CalendarRule.computeDate(time,interval).
CalendarRule.add(time,interval).It works fine for the first senario.but not for the second senario. Could please help me how to achive this. The above senario should also count the user defined holidays.
Please help me with regards.
Thanks in advance
- NarasimhaHi,
Plz write the following logic it will help you
sla = 1;
Time start;
start = 'now';
Int count;
count = 0;
if(sla > 0) {
while (count < sla) {
if(calendarRule.isHoliday(time : start) == false &&
calendarRule.isWorkDate(time : start) == true) {
count = count + 1;
start = start + '1d';
start = start - '1d';
logMessage("inal Due Date for SLA (" + sla + " Day/s) is " + start.format("dd/MM/yyyy"));
I have hard coded the start time as well as sla. Please make the necessary changes.
Bibhu
Edited by: Bibhuti Bhusan on Sep 22, 2010 3:35 AM
Maybe you are looking for
-
Not able to start a DB tunnel in windows
Hi, When I try to open the DB tunnel as shown in the below diagram in window OS, I am getting the error as shown in (same) below diagram. can you please tell me what is the error in this ?
-
I know this is probably going to be for nothing since I doubt many people have been doing custom portfolios using flex yet but I have an extremely annoying problem I was hoping to get help with. I had to create my own version of the Revolve layout b
-
On realising every second post in this forum is inquiring about how to put DVD's onto iPods i thought i'd post the Videora conversion guide link. This is a very simple guide on how to rip DVD's to MPEG-4 or H.264. http://www.videora.com/en-us/Convert
-
Importing iTunes Library from Older iBook to New iMac
My old iBook (700 MHz G3) had a severe hard drive failure, but I did manage to transfer via firewire the entire MUSIC folder and the entire PICTURES folder, as well other data I needed. The question remains: How do I import the iTunes Library from th
-
Need to block all unknown and blocked numbers