Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BCP-008-02 support (NcSenderMonitor) #43

Merged
merged 18 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ It has support for the NMOS Control & Monitoring suite:
* MS-05-02
* IS-12
* BCP-008-01
* BCP-008-02

It also has support for IS-04 and IS-05 with some limitations:

* It does not support DND-SD discovery and the NMOS registry endpoint has to be configured in the config.json file
* It does not support the IS-05 bulk API as it only has 1 receiver currently.
* It does not support the IS-05 bulk API as it currently only runs 1 receiver and 1 sender

## Installation

Expand Down Expand Up @@ -61,5 +62,6 @@ These are the configuration keys which can be specified in the configuration fil
* [MS-05-02 NMOS Control Framework](https://specs.amwa.tv/ms-05-02)
* [BCP-002-02 NMOS Asset Distinguishing Information](https://specs.amwa.tv/bcp-002-02)
* [BCP-008-01 NMOS Receiver Status](https://specs.amwa.tv/bcp-008-01/)
* [BCP-008-02 NMOS Sender Status](https://specs.amwa.tv/bcp-008-02/)

<!-- INTRO-END -->
29 changes: 28 additions & 1 deletion code/src/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export class Configuration implements IConfiguration
public node_id: string;
public device_id: string;
public receiver_id: string;
public source_id: string;
public flow_id: string;
public sender_id: string;
public address: string;
public port: number;
public base_label: string;
Expand All @@ -30,6 +33,9 @@ export class Configuration implements IConfiguration
this.node_id = config.node_id;
this.device_id = config.device_id;
this.receiver_id = config.receiver_id;
this.source_id = config.source_id;
this.flow_id = config.flow_id;
this.sender_id = config.sender_id;
this.base_label = config.base_label;
this.address = config.address;
this.port = config.port;
Expand Down Expand Up @@ -71,6 +77,24 @@ export class Configuration implements IConfiguration
shouldWriteConfig = true;
}

if(this.source_id == null)
{
this.source_id = uuidv4().toString();
shouldWriteConfig = true;
}

if(this.flow_id == null)
{
this.flow_id = uuidv4().toString();
shouldWriteConfig = true;
}

if(this.sender_id == null)
{
this.sender_id = uuidv4().toString();
shouldWriteConfig = true;
}

if(shouldWriteConfig)
this.WriteConfig();
}
Expand Down Expand Up @@ -101,7 +125,7 @@ export class Configuration implements IConfiguration

if(this.function == null)
{
this.function = "UHD Decoder";
this.function = "UHD Encoder/Decoder";
shouldWriteConfig = true;
}

Expand Down Expand Up @@ -137,6 +161,9 @@ export interface IConfiguration
node_id: string;
device_id: string;
receiver_id: string;
source_id: string;
flow_id: string;
sender_id: string;
address: string;
port: number;
base_label: string;
Expand Down
595 changes: 544 additions & 51 deletions code/src/NCModel/Features.ts

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion code/src/NCModel/Managers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
NcTouchpointResource,
NcTouchpointResourceNmos,
NcTouchpointResourceNmosChannelMapping} from './Core';
import { ExampleDataType, ExampleControl, GainControl, NcIdentBeacon, NcReceiverMonitor, NcWorker, NcStatusMonitor, NcMethodResultCounters, NcCounter } from './Features';
import { ExampleDataType, ExampleControl, GainControl, NcIdentBeacon, NcReceiverMonitor, NcWorker, NcStatusMonitor, NcMethodResultCounters, NcCounter, NcSenderMonitor } from './Features';

export abstract class NcManager extends NcObject
{
Expand Down Expand Up @@ -699,6 +699,7 @@ export class NcClassManager extends NcManager
'1.2.1': NcIdentBeacon.GetClassDescriptor(false),
'1.2.2': NcStatusMonitor.GetClassDescriptor(false),
'1.2.2.1': NcReceiverMonitor.GetClassDescriptor(false),
'1.2.2.2': NcSenderMonitor.GetClassDescriptor(false),
'1.3': NcManager.GetClassDescriptor(false),
'1.3.1': NcDeviceManager.GetClassDescriptor(false),
'1.3.2': NcClassManager.GetClassDescriptor(false)
Expand All @@ -721,6 +722,7 @@ export class NcClassManager extends NcManager
case '1.2.1': return NcIdentBeacon.GetClassDescriptor(true);
case '1.2.2': return NcStatusMonitor.GetClassDescriptor(true);
case '1.2.2.1': return NcReceiverMonitor.GetClassDescriptor(true);
case '1.2.2.2': return NcSenderMonitor.GetClassDescriptor(true);
case '1.3': return NcManager.GetClassDescriptor(true);
case '1.3.1': return NcDeviceManager.GetClassDescriptor(true);
case '1.3.2': return NcClassManager.GetClassDescriptor(true);
Expand Down Expand Up @@ -851,6 +853,12 @@ export class NcClassManager extends NcManager
new NcEnumItemDescriptor("PartiallyHealthy", 2, "Active and partially healthy"),
new NcEnumItemDescriptor("Unhealthy", 3, "Active and unhealthy")
], null, "Connection status enum data type"),
'NcTransmissionStatus': new NcDatatypeDescriptorEnum("NcTransmissionStatus", [
new NcEnumItemDescriptor("Inactive", 0, "Inactive"),
new NcEnumItemDescriptor("Healthy", 1, "Active and healthy"),
new NcEnumItemDescriptor("PartiallyHealthy", 2, "Active and partially healthy"),
new NcEnumItemDescriptor("Unhealthy", 3, "Active and unhealthy")
], null, "Transmission status enum data type"),
'NcSynchronizationStatus': new NcDatatypeDescriptorEnum("NcSynchronizationStatus", [
new NcEnumItemDescriptor("NotUsed", 0, "Feature not in use"),
new NcEnumItemDescriptor("Healthy", 1, "Locked to a synchronization source"),
Expand All @@ -863,6 +871,12 @@ export class NcClassManager extends NcManager
new NcEnumItemDescriptor("PartiallyHealthy", 2, "Active and partially healthy"),
new NcEnumItemDescriptor("Unhealthy", 3, "Active and unhealthy")
], null, "Stream status enum data type"),
'NcEssenceStatus': new NcDatatypeDescriptorEnum("NcEssenceStatus", [
new NcEnumItemDescriptor("Inactive", 0, "Inactive"),
new NcEnumItemDescriptor("Healthy", 1, "Active and healthy"),
new NcEnumItemDescriptor("PartiallyHealthy", 2, "Active and partially healthy"),
new NcEnumItemDescriptor("Unhealthy", 3, "Active and unhealthy")
], null, "Essence status enum data type"),
'NcTouchpoint': NcTouchpoint.GetTypeDescriptor(false),
'NcTouchpointResource': NcTouchpointResource.GetTypeDescriptor(false),
'NcTouchpointNmos': NcTouchpointNmos.GetTypeDescriptor(false),
Expand Down
49 changes: 49 additions & 0 deletions code/src/NmosDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { NmosResource } from './NmosResource';
import { NmosReceiverActiveRtp } from './NmosReceiverActiveRtp';
import { NmosReceiverVideo } from './NmosReceiverVideo';
import { RegistrationClient } from './RegistrationClient';
import { NmosSender } from './NmosSender';
import { NmosSenderActiveRtp } from './NmosSenderActiveRtp';
import { NmosSenderVideo } from './NmosSenderVideo';

export class NmosDevice extends NmosResource
{
Expand All @@ -29,6 +32,9 @@ export class NmosDevice extends NmosResource
@jsonIgnore()
public receiverObjects: NmosReceiverCore[];

@jsonIgnore()
public senderObjects: NmosSender[];

public constructor(
id: string,
node_id: string,
Expand Down Expand Up @@ -58,6 +64,7 @@ export class NmosDevice extends NmosResource
};

this.receiverObjects = [];
this.senderObjects = [];

this.receivers = [];
this.senders = [];
Expand Down Expand Up @@ -112,6 +119,48 @@ export class NmosDevice extends NmosResource
return uris;
}

public AddSender(sender: NmosSender)
{
this.senderObjects.push(sender);
this.senders.push(sender.id);
}

public FindSender(id: string) : boolean
{
let sender = this.senders.find(e => e === id);
if(sender === undefined)
return false;
else
return true;
}

public FetchSender(id: string)
{
return this.senderObjects.find(e => e.id === id);
}

public FetchSenders() {
return this.senderObjects;
}

public ChangeSenderSettings(id: string, settings: NmosSenderActiveRtp)
{
let sender = this.senderObjects.find(e => e.id === id);
if(sender)
(sender as NmosSenderVideo).ChangeSenderSettings(settings);
}

public FetchSendersUris()
{
let uris: string[] = [];

this.senders.forEach( (senderId) => {
uris.push(`${senderId}/`);
});

return uris;
}

public ToJson()
{
return JSON.stringify(this, jsonIgnoreReplacer);
Expand Down
43 changes: 43 additions & 0 deletions code/src/NmosFlow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { jsonIgnoreReplacer } from "json-ignore";
import { NmosResource } from "./NmosResource";
import { RegistrationClient } from "./RegistrationClient";

export class NmosFlow extends NmosResource
{
public source_id: string;
public device_id: string;
public parents: string[];
public grain_rate: object;

public constructor(
id: string,
source_id: string,
device_id: string,
base_label: string,
parents: string[],
grain_rate_numerator: number,
grain_rate_denominator: number,
registrationClient: RegistrationClient)
{
super(id, `${base_label} flow`, registrationClient);

this.source_id = source_id;
this.device_id = device_id;
this.parents = parents;
this.grain_rate = {
"numerator": grain_rate_numerator,
"denominator": grain_rate_denominator
};
this.tags = {};
}

public ToJson()
{
return JSON.stringify(this, jsonIgnoreReplacer);
}

public ToJsonArray()
{
return JSON.stringify([this], jsonIgnoreReplacer);
}
}
50 changes: 50 additions & 0 deletions code/src/NmosFlowVideo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { jsonIgnoreReplacer } from "json-ignore";
import { RegistrationClient } from "./RegistrationClient";
import { NmosFlow } from "./NmosFlow";

export class NmosFlowVideo extends NmosFlow
{
public format: string;
public frame_width: number;
public frame_height: number;
public colorspace: string;
public interlace_mode: string;
public transfer_characteristic: string;
public media_type: string;
public components: object[];

public constructor(
id: string,
source_id: string,
device_id: string,
label: string,
parents: string[],
grain_rate_numerator: number,
grain_rate_denominator: number,
format: string,
frame_width: number,
frame_height: number,
colorspace: string,
interlace_mode: string,
transfer_characteristic: string,
media_type: string,
components: object[],
registrationClient: RegistrationClient)
{
super(id, source_id, device_id, label, parents, grain_rate_numerator, grain_rate_denominator, registrationClient);

this.format = format;
this.frame_width = frame_width;
this.frame_height = frame_height;
this.colorspace = colorspace;
this.interlace_mode = interlace_mode;
this.transfer_characteristic = transfer_characteristic;
this.media_type = media_type;
this.components = components;
}

public ToJson()
{
return JSON.stringify(this, jsonIgnoreReplacer);
}
}
Loading