libnm and updating wifi bitrate



Hello,

I'm coding a small utility using libnm.  I'd like the bitrate of wifi devices to update over time, just like in the "Connection Information" dialog of nm-applet.  However, the bitrate never seems to change.

The code below illustrates my problem:

#include <NetworkManager.h>
#include <unistd.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
NMClient *client;
const GPtrArray *devices;
NMDevice *device;

client = nm_client_new(NULL, NULL);
devices = nm_client_get_devices(client);
device = g_ptr_array_index(devices, 0);

while (1) {
printf("%d\n",
       nm_device_wifi_get_bitrate(NM_DEVICE_WIFI(device)));
sleep(5);
}
}

This program just prints the same number over and over again -- the value of the bitrate when the program was first started.  Meanwhile, I can open an nm-applet dialog simultaneously and watch the bitrate change merrily over time.

What am I missing?

Thank you!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]