I've been teaching myself how to write programs in C for BLE devices using the BlueZ API. However, I seem to be stumped on one particular aspect of the sockaddr_l2 struct. The definition I am using is the following:
struct sockaddr_l2 {
sa_family_t l2_family;
unsigned short l2_psm;
bdaddr_t l2_bdaddr;
unsigned short l2_cid;
uint8_t l2_bdaddr_type;
};
Now for the part I don't understand: what is the difference between l2_psm and l2_cid? This is what I've gathered so far:
PSM stands for "Protocol Service Multiplexers", and are the L2CAP connection's "port". Source: Bluetooth for Programmers, by Albert Huang
CID stands for "Channel Identifier", and are local names representing a logical channel end-point on the device. Source: http://ecee.colorado.edu/~ecen4242/marko/Bluetooth/Bluetooth/SPECIFICATION/L2CAP.html
Now I'm sure the answer is in those definitions, but I just can't seem to wrap my head around the definition of CID. Can anyone explain to me the differences between PSM and CID in a more comprehensive manner?
Thanks :)