aboutsummaryrefslogtreecommitdiff
path: root/libarmep/service.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarmep/service.c')
-rw-r--r--libarmep/service.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/libarmep/service.c b/libarmep/service.c
index a57b2f2..77683e5 100644
--- a/libarmep/service.c
+++ b/libarmep/service.c
@@ -99,6 +99,7 @@ static void init_aep(struct aep_context *aep_context, struct aep *aep, const cha
ch->samples = 0;
strcpy(ch->supply, "none");
sprintf(ch->colour, "#%06X", rand() & 0xffffff);
+ strcpy(ch->class, "-");
}
}
@@ -148,6 +149,21 @@ void probe_close(struct aep *aep)
close(aep->fd);
}
+static void copy_public_ch_info_to_shared(struct aep_shared *aep_shared, struct aep_channel *ch)
+{
+ strncpy(aep_shared->channel_name[chan], ch->channel_name, sizeof(aep_shared->channel_name[0]));
+ aep_shared->channel_name[chan][sizeof(aep_shared->channel_name[0]) - 1] = '\0';
+ strncpy(aep_shared->channel_name_pretty[chan], ch->channel_name_pretty, sizeof(aep_shared->channel_name_pretty[0]));
+ aep_shared->channel_name_pretty[chan][sizeof(aep_shared->channel_name_pretty[0]) - 1] = '\0';
+ strncpy(aep_shared->supply[chan], ch->supply, sizeof(aep_shared->supply[0]));
+ aep_shared->supply[chan][sizeof(aep_shared->supply[0]) - 1] = '\0';
+ strncpy(aep_shared->colour[chan], ch->colour, sizeof(aep_shared->colour[0]));
+ aep_shared->colour[chan][sizeof(aep_shared->colour[0]) - 1] = '\0';
+ strncpy(aep_shared->class[chan], ch->class, sizeof(aep_shared->class[0]));
+ aep_shared->class[chan][sizeof(aep_shared->class[0]) - 1] = '\0';
+
+}
+
int service_aeps(struct aep_context *aep_context, int fd_with_rx)
{
static unsigned char zero[8] = { 0, 0, 0, 0, 0, 0, 0, 0, };
@@ -357,14 +373,7 @@ bail:
if (!ch->requested)
continue;
- strncpy(aep_context->aep_shared->channel_name[chan], ch->channel_name, sizeof(aep_context->aep_shared->channel_name[0]));
- aep_context->aep_shared->channel_name[chan][sizeof(aep_context->aep_shared->channel_name[0]) - 1] = '\0';
- strncpy(aep_context->aep_shared->channel_name_pretty[chan], ch->channel_name_pretty, sizeof(aep_context->aep_shared->channel_name_pretty[0]));
- aep_context->aep_shared->channel_name_pretty[chan][sizeof(aep_context->aep_shared->channel_name_pretty[0]) - 1] = '\0';
- strncpy(aep_context->aep_shared->supply[chan], ch->supply, sizeof(aep_context->aep_shared->supply[0]));
- aep_context->aep_shared->supply[chan][sizeof(aep_context->aep_shared->supply[0]) - 1] = '\0';
- strncpy(aep_context->aep_shared->colour[chan], ch->colour, sizeof(aep_context->aep_shared->colour[0]));
- aep_context->aep_shared->colour[chan][sizeof(aep_context->aep_shared->colour[0]) - 1] = '\0';
+ copy_public_ch_info_to_shared(aep_context->aep_shared, ch);
chan++;
aep_context->aep_shared->chans = chan;