KDK_BLUETOOTH_GET_LINK_MODE(3)

📦 version 3.0.1.4, in arch rolling, ubuntu resolute, ubuntu stonking

okay bestie, sit down, hydrate, and let me tell you about kdk_bluetooth_get_link_mode(3) — it lives in the Library Functions Manual and it's literally the girl who tells you what link mode your Bluetooth device is vibing in 🦋


🎀 NAME 🎀

kdk_bluetooth_get_link_mode — 获取蓝牙的链接模式 (aka: go get the Bluetooth link mode, no cap)


✨ SYNOPSIS ✨

#include <libkybluetooth.h>

extern char* kdk_bluetooth_get_link_mode(int id);

Link with -lkybluetooth.


🌸 DETAILED DESCRIPTION 🌸

The main function of this interface — the whole entire point of her existence — is to obtain the link mode of Bluetooth. That's it. That's the job. She's focused, she's employed, she's iconic 👑

The argument id is the device ID of Bluetooth. So you hand her a device ID and she hands you the tea on that device's link mode. periodt.


💅 RETURN VALUE 💅

  • On success, returns the Bluetooth link mode, of type char*. ⚠️ Important, bestie: the returned string needs to be released by free. She is giving you a gift and you are responsible for the gift's cleanup. Don't just leave it lying around, that's a memory leak and it's giving messy 🙈
  • On error, returns NULL. So always vibe check your return value before you use it, fr fr.

🌈 EXAMPLES 🌈

Here's the full demo, copied exactly because I would never do her dirty by paraphrasing code:

#include "libkybluetooth.h"
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i = 0;
    char *manufacturer = " ";
    char *version = " ";
    char *name = " ";
    char *address = " ";
    char *link_mode  =" ";
    char *link_policy =" ";
    char *scomtu = " ";
    char *alcmtu = " ";
    char *packettype = " ";
    char *features = " ";
    char *bus = " ";
    int **id = kdk_bluetooth_get_device_id();
    do
    {
        printf("id = %d0,id[i]);
        manufacturer = kdk_bluetooth_get_manufacturer(i);
        printf("manufacturer: %s0, manufacturer);
        free(manufacturer);
        version = kdk_bluetooth_get_dev_version(i);
        printf("version: %s0, version);
        free(version);
        name = kdk_bluetooth_get_name(id[i]);
        printf("name: %s0, name);
        address = kdk_bluetooth_get_address(id[i]);
        printf("address: %s0, address);
        link_mode = kdk_bluetooth_get_link_mode(id[i]);
        printf("link_mode: %s0, link_mode);
        link_policy = kdk_bluetooth_get_link_policy(id[i]);
        printf("link_policy: %s0, link_policy);
        scomtu = kdk_bluetooth_get_scomtu(id[i]);
        printf("scomtu: %s0, scomtu);
        alcmtu = kdk_bluetooth_get_alcmtu(id[i]);
        printf("alcmtu: %s0, alcmtu);
        packettype = kdk_bluetooth_get_packettype(id[i]);
        printf("packettype: %s0, packettype);
        features = kdk_bluetooth_get_features(id[i]);
        printf("features: %s0, features);
        bus = kdk_bluetooth_get_bus(id[i]);
        printf("bus: %s0, bus);
        i++;
    }while(id[i]);
    return 0;
}

Notice how she's the main character of the middle section there — link_mode = kdk_bluetooth_get_link_mode(id[i]); and then the printf right after. Chef's kiss 🍓


👑 CONFORMING TO 👑

These functions are as per the withdrawn POSIX.1e draft specification. Yes, withdrawn. She's vintage, she's a draft, she's still serving.

The following functions are Linux extensions:

  • kdk_bluetooth_get_device_id()
  • kdk_bluetooth_get_manufacturer()
  • kdk_bluetooth_get_dev_version()
  • kdk_bluetooth_get_name()
  • kdk_bluetooth_get_address()
  • kdk_bluetooth_get_link_policy()
  • kdk_bluetooth_get_bus()
  • kdk_bluetooth_get_scomtu()
  • kdk_bluetooth_get_alcmtu()
  • kdk_bluetooth_get_packettype()
  • kdk_bluetooth_get_features()

🦋 SEE ALSO 🦋

the whole friend group, go read their pages too, they're all slaying in their own way:


remember bestie: free that returned string, check for NULL, and you'll be fine 💖

and that's the page!! this one came from the Linux Programmer's Manual, dated Fri Aug 25 2023, and she answers to the name KDK_BLUETO...T_LINK_MODE(3). mwah, bye 🫶✨

📦 where this page comes from