{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Devices - Programming Devices-Udayan Kumar...

Info icon This preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Programming Devices -Udayan Kumar [email protected]
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Bluetooth Programming Refer : http://people.csail.mit.edu/albert/bluez-intro/ Book: http://www.btessentials.com Similar to TCP/IP programming
Image of page 2
Basics Bluetooth programming can be modularized into several components: Choosing a device with which to communicate Figuring out communication protocol Making an outgoing connection Accepting an incoming connection Sending data Receiving data Adapted from http://people.csail.mit.edu/albert/bluez-intro/
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
How to communicate Small number of port prompt for Service Discovery Protocol (SDP) in RFCOMM. Universally Unique Identifier (UUID) are assigned to different services in the standard. Bluetooth devices have 48 bit address. Like MAC address Requirements Internet Ports Reliable, Stream-based TCP RFCOMM 30 TCP RFCOMM or L2CAP UDP L2CAP Odd # 1-32765 Bluetooth Reliable, Datagram Best effort, datagram
Image of page 4
Programming Python is considered very good. (though I haven't tried programming using python) C programs using Bluez library
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/socket.h> #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> #include <bluetooth/hci_lib.h> int main(int argc, char **argv) { inquiry_info *ii = NULL; int max_rsp, num_rsp; int dev_id, sock, len, flags; int i; char addr[19] = { 0 }; char name[248] = { 0 };
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern