KDK_BLUETOOTH_GET_LINK_POLICY(3)

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

okay so bestie, we're in the Library Functions Manual today and this page is literally just one tiny function that goes and grabs the Bluetooth link policy for you. that's it. that's the whole vibe. let's get into it 🫶


🌸 NAME 🌸

kdk_bluetooth_get_link_policy — 获取蓝牙的链接策略

(yes the description is in Chinese, and yes it means "get the Bluetooth link policy." we love a bilingual icon 💅)


✨ SYNOPSIS ✨

#include <libkybluetooth.h>

extern char* kdk_bluetooth_get_link_policy(int id);

Link with -lkybluetooth.

so like, you gotta #include the header, you gotta link against -lkybluetooth, and then the function is right there waiting for you. extern, char*, one int argument. simple. elegant. ate. 🔥


🦋 DETAILED DESCRIPTION 🦋

The main function of the interface is to obtain the link policy of Bluetooth.

The argument id is the device ID of Bluetooth.

that's the tea ☕ — you hand it a device ID, it hands you back the link policy. the id is specifically the Bluetooth device ID, so don't be out here passing your student ID or whatever, bestie 😭


👑 RETURN VALUE 👑

  • on success — returns the Bluetooth link policy, and it's a char*. and listen, bestie, that string? it's yours to clean up. the returned string needs to be released by free. no cap. if you don't free it, that's a leak and the vibe check will fail 🙈
  • on error — returns NULL.
fr fr do not forget the free. the manpage said it, i said it, the ancestors said it.

🍓 EXAMPLES 🍓

here's the whole demo program, copied exactly, no edits, no notes:

#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;
}

see how kdk_bluetooth_get_link_policy(id[i]) shows up in there? that's our girl, doing her one job in the middle of a whole lineup of getters 🌈


🌈 CONFORMING TO 🌈

These functions are as per the withdrawn POSIX.1e draft specification.

and these ones right here 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_mode()
  • kdk_bluetooth_get_bus()
  • kdk_bluetooth_get_scomtu()
  • kdk_bluetooth_get_alcmtu()
  • kdk_bluetooth_get_packettype()
  • kdk_bluetooth_get_features()
withdrawn spec, so like… it's giving "retired but still iconic." still works, still valid, just don't @ the standards body about it 💀

💜 SEE ALSO 💜

go read these next, bestie, they're the whole friend group:


okay that's the whole page, you're officially educated 🎀 this came out of the Linux Programmer's Manual and it's dated Fri Aug 25 2023 — so this is the KDK_BLUETO...LINK_POLICY(3) page, no cap, go free your strings and slay 💅✨🦋

📦 where this page comes from