Skip to content

Commit

Permalink
Merge 30ed267 into eeb9639
Browse files Browse the repository at this point in the history
  • Loading branch information
gauthierm committed Dec 29, 2020
2 parents eeb9639 + 30ed267 commit de0ec35
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/services/zone-group-topology.service.ts
Expand Up @@ -118,13 +118,16 @@ export interface ZoneGroupTopologyServiceEvent {
ZonePlayerUUIDsInGroup?: string;
}


export interface ZoneGroup {
name: string;
coordinator: ZoneMember;
members: ZoneMember[];
}

interface ChannelMapSet {
[channel: string]: string;
}

interface ZoneMember {
host: string;
port: number;
Expand All @@ -134,6 +137,7 @@ interface ZoneMember {
MicEnabled: boolean;
SoftwareVersion: string;
SwGen: string;
ChannelMapSet?: ChannelMapSet;
}

/**
Expand Down Expand Up @@ -171,6 +175,7 @@ export class ZoneGroupTopologyService extends ZoneGroupTopologyServiceBase {
MicEnabled: member.MicEnabled === 1,
SoftwareVersion: member.SoftwareVersion,
SwGen: member.SWGen,
ChannelMapSet: member.ChannelMapSet ? ZoneGroupTopologyService.ParseChannelMapSet(member.ChannelMapSet) : undefined,
};
}

Expand All @@ -190,6 +195,20 @@ export class ZoneGroupTopologyService extends ZoneGroupTopologyServiceBase {
};
}

private static ParseChannelMapSet(channelMapSet: string): ChannelMapSet {
const channels = channelMapSet.split(';');
return channels.map((channel) => {
const [uuid, channelId] = channel.split(',');
return {
uuid: uuid.split(':')[0],
channelId,
};
}).reduce<ChannelMapSet>((previousChannels, channel) => ({
...previousChannels,
[channel.channelId]: channel.uuid,
}), {});
}

protected ResolveEventPropertyValue(name: string, originalValue: any, type: string): any {
const parsedValue = super.ResolveEventPropertyValue(name, originalValue, type);
if (name === 'ZoneGroupState') {
Expand Down

0 comments on commit de0ec35

Please sign in to comment.