Skip to content

Commit

Permalink
refactor: metadata updates via bus not rest
Browse files Browse the repository at this point in the history
Signed-off-by: Iain Anderson <[email protected]>
  • Loading branch information
iain-anderson committed May 9, 2023
1 parent 68aca96 commit f74adf7
Show file tree
Hide file tree
Showing 20 changed files with 623 additions and 799 deletions.
12 changes: 5 additions & 7 deletions include/edgex/edgex.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020
* Copyright (c) 2018-2023
* IoTech Ltd
*
* SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -38,7 +38,7 @@ typedef struct edgex_resourceoperation
{
char *deviceResource;
char *defaultValue;
devsdk_nvpairs *mappings;
iot_data_t *mappings;
struct edgex_resourceoperation *next;
} edgex_resourceoperation;

Expand Down Expand Up @@ -87,9 +87,6 @@ typedef struct edgex_deviceprofile
{
char *name;
char *description;
uint64_t created;
uint64_t modified;
uint64_t origin;
char *manufacturer;
char *model;
devsdk_strings *labels;
Expand All @@ -109,12 +106,13 @@ typedef struct edgex_blocklist
typedef struct edgex_watcher
{
char *name;
devsdk_nvpairs *identifiers;
iot_data_t *identifiers;
struct edgex_watcher_regexes_t *regs;
edgex_blocklist *blocking_identifiers;
iot_data_t *blocking_identifiers;
char *profile;
edgex_device_adminstate adminstate;
struct edgex_device_autoevents *autoevents;
bool enabled;
struct edgex_watcher *next;
} edgex_watcher;

Expand Down
8 changes: 8 additions & 0 deletions src/c/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
#define EDGEX_DEV_TOPIC_RESPONSE "response"
#define EDGEX_DEV_TOPIC_EVENT "events/device"
#define EDGEX_DEV_TOPIC_METRIC "telemetry"
#define EDGEX_DEV_TOPIC_ADD_DEV "system-events/core-metadata/device/add"
#define EDGEX_DEV_TOPIC_DEL_DEV "system-events/core-metadata/device/delete"
#define EDGEX_DEV_TOPIC_UPDATE_DEV "system-events/core-metadata/device/update"
#define EDGEX_DEV_TOPIC_ADD_PW "system-events/core-metadata/provisionwatcher/add"
#define EDGEX_DEV_TOPIC_DEL_PW "system-events/core-metadata/provisionwatcher/delete"
#define EDGEX_DEV_TOPIC_UPDATE_PW "system-events/core-metadata/provisionwatcher/update"
#define EDGEX_DEV_TOPIC_DEVICESERVICE "system-events/core-metadata/deviceservice/update"
#define EDGEX_DEV_TOPIC_UPDATE_PROFILE "system-events/core-metadata/deviceprofile/update"

/* Query parameters */

Expand Down
11 changes: 8 additions & 3 deletions src/c/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,18 @@ char *edgex_bus_mktopic (edgex_bus_t *bus, const char *type, const char *param)
char *result;
size_t len = strlen (bus->prefix) + strlen (type) + strlen (bus->svcname) + strlen (param) + 4;
result = malloc (len);
strcpy (result, bus->prefix);
strcat (result, "/");
if (strlen (type))
{
sprintf (result, "%s/%s/%s/%s", bus->prefix, type, bus->svcname, param);
strcat (result, type);
strcat (result, "/");
}
else
strcat (result, bus->svcname);
if (strlen (param))
{
sprintf (result, "%s/%s/%s", bus->prefix, bus->svcname, param);
strcat (result, "/");
strcat (result, param);
}
return result;
}
Expand Down
203 changes: 0 additions & 203 deletions src/c/callback2.c

This file was deleted.

24 changes: 0 additions & 24 deletions src/c/callback2.h

This file was deleted.

Loading

0 comments on commit f74adf7

Please sign in to comment.