mirror of
https://github.com/NeoFlock/neonucleus.git
synced 2025-09-24 09:03:32 +02:00
completed device info
This commit is contained in:
parent
9e33d5a1d2
commit
93206a536d
@ -81,7 +81,18 @@ nn_deviceInfo_t *nn_addDeviceInfo(nn_deviceInfoList_t *list, nn_address address,
|
||||
return list->info + i;
|
||||
}
|
||||
|
||||
void nn_removeDeviceInfo(nn_deviceInfoList_t *list, const char *key);
|
||||
void nn_removeDeviceInfo(nn_deviceInfoList_t *list, const char *address) {
|
||||
nn_size_t j = 0;
|
||||
for(nn_size_t i = 0; i < list->len; i++) {
|
||||
if(nn_strcmp(list->info[i].address, address) == 0) {
|
||||
nn_deleteDeviceInfo(&list->ctx, &list->info[i]);
|
||||
} else {
|
||||
list->info[j] = list->info[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
list->len = j;
|
||||
}
|
||||
|
||||
nn_bool_t nn_registerDeviceKey(nn_deviceInfo_t *deviceInfo, const char *key, const char *value) {
|
||||
if(deviceInfo->len == deviceInfo->capacity) return false;
|
||||
|
@ -820,6 +820,9 @@ int main(int argc, char **argv) {
|
||||
nn_registerDeviceKey(theRamStick, NN_DEVICEINFO_KEY_PRODUCT, "RAM 1:5");
|
||||
nn_registerDeviceKey(theRamStick, NN_DEVICEINFO_KEY_VENDOR, "NeoComputers Technologies L.L.C.");
|
||||
|
||||
nn_addDeviceInfo(list, "test", 8);
|
||||
nn_removeDeviceInfo(list, "test");
|
||||
|
||||
nn_deviceInfo_t *theCPU = nn_addDeviceInfo(list, NULL, 8);
|
||||
nn_registerDeviceKey(theCPU, NN_DEVICEINFO_KEY_CLASS, NN_DEVICEINFO_CLASS_CPU);
|
||||
nn_registerDeviceKey(theCPU, NN_DEVICEINFO_KEY_DESCRIPTION, "Processor");
|
||||
|
@ -441,7 +441,7 @@ typedef struct nn_deviceInfo_t nn_deviceInfo_t;
|
||||
nn_deviceInfoList_t *nn_newDeviceInfoList(nn_Context *ctx, nn_size_t preallocate);
|
||||
void nn_deleteDeviceInfoList(nn_deviceInfoList_t *deviceInfoList);
|
||||
nn_deviceInfo_t *nn_addDeviceInfo(nn_deviceInfoList_t *list, nn_address address, nn_size_t maxKeys);
|
||||
void nn_removeDeviceInfo(nn_deviceInfoList_t *list, const char *key);
|
||||
void nn_removeDeviceInfo(nn_deviceInfoList_t *list, const char *address);
|
||||
nn_bool_t nn_registerDeviceKey(nn_deviceInfo_t *deviceInfo, const char *key, const char *value);
|
||||
nn_deviceInfo_t *nn_getDeviceInfoAt(nn_deviceInfoList_t *list, nn_size_t idx);
|
||||
nn_size_t nn_getDeviceCount(nn_deviceInfoList_t *list);
|
||||
|
Loading…
x
Reference in New Issue
Block a user