-
Notifications
You must be signed in to change notification settings - Fork 80
/
control_protocol_resource.cpp
2052 lines (1688 loc) · 120 KB
/
control_protocol_resource.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "nmos/control_protocol_resource.h"
#include "cpprest/base_uri.h"
#include "nmos/control_protocol_state.h" // for nmos::experimental::control_classes definitions
#include "nmos/json_fields.h"
namespace nmos
{
namespace details
{
web::json::value make_nc_method_result(const nc_method_result& method_result)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::status, method_result.status }
});
}
web::json::value make_nc_method_result_error(const nc_method_result& method_result, const utility::string_t& error_message)
{
auto result = make_nc_method_result(method_result);
if (!error_message.empty()) { result[nmos::fields::nc::error_message] = web::json::value::string(error_message); }
return result;
}
web::json::value make_nc_method_result(const nc_method_result& method_result, const web::json::value& value)
{
auto result = make_nc_method_result(method_result);
result[nmos::fields::nc::value] = value;
return result;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncelementid
web::json::value make_nc_element_id(uint16_t level, uint16_t index)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::level, level },
{ nmos::fields::nc::index, index }
});
}
web::json::value make_nc_element_id(const nc_element_id& id)
{
return make_nc_element_id(id.level, id.index);
}
nc_element_id parse_nc_element_id(const web::json::value& id)
{
return { uint16_t(nmos::fields::nc::level(id)), uint16_t(nmos::fields::nc::index(id)) };
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#nceventid
web::json::value make_nc_event_id(const nc_event_id& id)
{
return make_nc_element_id(id);
}
nc_event_id parse_nc_event_id(const web::json::value& id)
{
return parse_nc_element_id(id);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncmethodid
web::json::value make_nc_method_id(const nc_method_id& id)
{
return make_nc_element_id(id);
}
nc_method_id parse_nc_method_id(const web::json::value& id)
{
return parse_nc_element_id(id);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncpropertyid
web::json::value make_nc_property_id(const nc_property_id& id)
{
return make_nc_element_id(id);
}
nc_property_id parse_nc_property_id(const web::json::value& id)
{
return parse_nc_element_id(id);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncclassid
web::json::value make_nc_class_id(const nc_class_id& class_id)
{
using web::json::value;
auto nc_class_id = value::array();
for (const auto class_id_item : class_id) { web::json::push_back(nc_class_id, class_id_item); }
return nc_class_id;
}
nc_class_id parse_nc_class_id(const web::json::array& class_id_)
{
nc_class_id class_id;
for (auto& element : class_id_)
{
class_id.push_back(element.as_integer());
}
return class_id;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncmanufacturer
web::json::value make_nc_manufacturer(const utility::string_t& name, const web::json::value& organization_id, const web::json::value& website)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::name, name },
{ nmos::fields::nc::organization_id, organization_id },
{ nmos::fields::nc::website, website }
});
}
web::json::value make_nc_manufacturer(const utility::string_t& name, nc_organization_id organization_id, const web::uri& website)
{
using web::json::value;
return make_nc_manufacturer(name, organization_id, value::string(website.to_string()));
}
web::json::value make_nc_manufacturer(const utility::string_t& name, nc_organization_id organization_id)
{
using web::json::value;
return make_nc_manufacturer(name, organization_id, value::null());
}
web::json::value make_nc_manufacturer(const utility::string_t& name)
{
using web::json::value;
return make_nc_manufacturer(name, value::null(), value::null());
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncproduct
// brand_name can be null
// uuid can be null
// description can be null
web::json::value make_nc_product(const utility::string_t& name, const utility::string_t& key, const utility::string_t& revision_level,
const web::json::value& brand_name, const web::json::value& uuid, const web::json::value& description)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::name, name },
{ nmos::fields::nc::key, key },
{ nmos::fields::nc::revision_level, revision_level },
{ nmos::fields::nc::brand_name, brand_name },
{ nmos::fields::nc::uuid, uuid },
{ nmos::fields::nc::description, description }
});
}
web::json::value make_nc_product(const utility::string_t& name, const utility::string_t& key, const utility::string_t& revision_level,
const utility::string_t& brand_name, const nc_uuid& uuid, const utility::string_t& description)
{
using web::json::value;
return make_nc_product(name, key, revision_level, value::string(brand_name), value::string(uuid), value::string(description));
}
web::json::value make_nc_product(const utility::string_t& name, const utility::string_t& key, const utility::string_t& revision_level,
const utility::string_t& brand_name, const nc_uuid& uuid)
{
using web::json::value;
return make_nc_product(name, key, revision_level, value::string(brand_name), value::string(uuid), value::null());
}
web::json::value make_nc_product(const utility::string_t& name, const utility::string_t& key, const utility::string_t& revision_level,
const utility::string_t& brand_name)
{
using web::json::value;
return make_nc_product(name, key, revision_level, value::string(brand_name), value::null(), value::null());
}
web::json::value make_nc_product(const utility::string_t& name, const utility::string_t& key, const utility::string_t& revision_level)
{
using web::json::value;
return make_nc_product(name, key, revision_level, value::null(), value::null(), value::null());
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncdeviceoperationalstate
// device_specific_details can be null
web::json::value make_nc_device_operational_state(nc_device_generic_state::state generic_state, const web::json::value& device_specific_details)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::generic_state, generic_state },
{ nmos::fields::nc::device_specific_details, device_specific_details }
});
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncdescriptor
// description can be null
web::json::value make_nc_descriptor(const web::json::value& description)
{
using web::json::value_of;
return value_of({ { nmos::fields::nc::description, description } });
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncblockmemberdescriptor
// description can be null
// user_label can be null
web::json::value make_nc_block_member_descriptor(const web::json::value& description, const utility::string_t& role, nc_oid oid, bool constant_oid, const nc_class_id& class_id, const web::json::value& user_label, nc_oid owner)
{
using web::json::value;
auto data = make_nc_descriptor(description);
data[nmos::fields::nc::role] = value::string(role);
data[nmos::fields::nc::oid] = oid;
data[nmos::fields::nc::constant_oid] = value::boolean(constant_oid);
data[nmos::fields::nc::class_id] = make_nc_class_id(class_id);
data[nmos::fields::nc::user_label] = user_label;
data[nmos::fields::nc::owner] = owner;
return data;
}
web::json::value make_nc_block_member_descriptor(const utility::string_t& description, const utility::string_t& role, nc_oid oid, bool constant_oid, const nc_class_id& class_id, const utility::string_t& user_label, nc_oid owner)
{
using web::json::value;
return make_nc_block_member_descriptor(value::string(description), role, oid, constant_oid, class_id, value::string(user_label), owner);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncclassdescriptor
// description can be null
// fixedRole can be null
web::json::value make_nc_class_descriptor(const web::json::value& description, const nc_class_id& class_id, const nc_name& name, const web::json::value& fixed_role, const web::json::value& properties, const web::json::value& methods, const web::json::value& events)
{
using web::json::value;
auto data = make_nc_descriptor(description);
data[nmos::fields::nc::class_id] = make_nc_class_id(class_id);
data[nmos::fields::nc::name] = value::string(name);
data[nmos::fields::nc::fixed_role] = fixed_role;
data[nmos::fields::nc::properties] = properties;
data[nmos::fields::nc::methods] = methods;
data[nmos::fields::nc::events] = events;
return data;
}
web::json::value make_nc_class_descriptor(const utility::string_t& description, const nc_class_id& class_id, const nc_name& name, const utility::string_t& fixed_role, const web::json::value& properties, const web::json::value& methods, const web::json::value& events)
{
using web::json::value;
return make_nc_class_descriptor(value::string(description), class_id, name, value::string(fixed_role), properties, methods, events);
}
web::json::value make_nc_class_descriptor(const utility::string_t& description, const nc_class_id& class_id, const nc_name& name, const web::json::value& properties, const web::json::value& methods, const web::json::value& events)
{
using web::json::value;
return make_nc_class_descriptor(value::string(description), class_id, name, value::null(), properties, methods, events);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncenumitemdescriptor
// description can be null
web::json::value make_nc_enum_item_descriptor(const web::json::value& description, const nc_name& name, uint16_t val)
{
using web::json::value;
auto data = make_nc_descriptor(description);
data[nmos::fields::nc::name] = value::string(name);
data[nmos::fields::nc::value] = val;
return data;
}
web::json::value make_nc_enum_item_descriptor(const utility::string_t& description, const nc_name& name, uint16_t val)
{
using web::json::value;
return make_nc_enum_item_descriptor(value::string(description), name, val);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#nceventdescriptor
// description can be null
// id = make_nc_event_id(level, index)
web::json::value make_nc_event_descriptor(const web::json::value& description, const nc_event_id& id, const nc_name& name, const utility::string_t& event_datatype, bool is_deprecated)
{
using web::json::value;
auto data = make_nc_descriptor(description);
data[nmos::fields::nc::id] = make_nc_event_id(id);
data[nmos::fields::nc::name] = value::string(name);
data[nmos::fields::nc::event_datatype] = value::string(event_datatype);
data[nmos::fields::nc::is_deprecated] = value::boolean(is_deprecated);
return data;
}
web::json::value make_nc_event_descriptor(const utility::string_t& description, const nc_event_id& id, const nc_name& name, const utility::string_t& event_datatype, bool is_deprecated)
{
using web::json::value;
return make_nc_event_descriptor(value::string(description), id, name, event_datatype, is_deprecated);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncfielddescriptor
// description can be null
// type_name can be null
// constraints can be null
web::json::value make_nc_field_descriptor(const web::json::value& description, const nc_name& name, const web::json::value& type_name, bool is_nullable, bool is_sequence, const web::json::value& constraints)
{
using web::json::value;
auto data = make_nc_descriptor(description);
data[nmos::fields::nc::name] = value::string(name);
data[nmos::fields::nc::type_name] = type_name;
data[nmos::fields::nc::is_nullable] = value::boolean(is_nullable);
data[nmos::fields::nc::is_sequence] = value::boolean(is_sequence);
data[nmos::fields::nc::constraints] = constraints;
return data;
}
web::json::value make_nc_field_descriptor(const utility::string_t& description, const nc_name& name, const utility::string_t& type_name, bool is_nullable, bool is_sequence, const web::json::value& constraints)
{
using web::json::value;
return make_nc_field_descriptor(value::string(description), name, value::string(type_name), is_nullable, is_sequence, constraints);
}
web::json::value make_nc_field_descriptor(const utility::string_t& description, const nc_name& name, bool is_nullable, bool is_sequence, const web::json::value& constraints)
{
using web::json::value;
return make_nc_field_descriptor(value::string(description), name, value::null(), is_nullable, is_sequence, constraints);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncmethoddescriptor
// description can be null
// id = make_nc_method_id(level, index)
// sequence<NcParameterDescriptor> parameters
web::json::value make_nc_method_descriptor(const web::json::value& description, const nc_method_id& id, const nc_name& name, const utility::string_t& result_datatype, const web::json::value& parameters, bool is_deprecated)
{
using web::json::value;
auto data = make_nc_descriptor(description);
data[nmos::fields::nc::id] = make_nc_method_id(id);
data[nmos::fields::nc::name] = value::string(name);
data[nmos::fields::nc::result_datatype] = value::string(result_datatype);
data[nmos::fields::nc::parameters] = parameters;
data[nmos::fields::nc::is_deprecated] = value::boolean(is_deprecated);
return data;
}
web::json::value make_nc_method_descriptor(const utility::string_t& description, const nc_method_id& id, const nc_name& name, const utility::string_t& result_datatype, const web::json::value& parameters, bool is_deprecated)
{
using web::json::value;
return make_nc_method_descriptor(value::string(description), id, name, result_datatype, parameters, is_deprecated);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncparameterdescriptor
// description can be null
// type_name can be null
web::json::value make_nc_parameter_descriptor(const web::json::value& description, const nc_name& name, const web::json::value& type_name, bool is_nullable, bool is_sequence, const web::json::value& constraints)
{
using web::json::value;
auto data = make_nc_descriptor(description);
data[nmos::fields::nc::name] = value::string(name);
data[nmos::fields::nc::type_name] = type_name;
data[nmos::fields::nc::is_nullable] = value::boolean(is_nullable);
data[nmos::fields::nc::is_sequence] = value::boolean(is_sequence);
data[nmos::fields::nc::constraints] = constraints;
return data;
}
web::json::value make_nc_parameter_descriptor(const utility::string_t& description, const nc_name& name, bool is_nullable, bool is_sequence, const web::json::value& constraints)
{
using web::json::value;
return make_nc_parameter_descriptor(value::string(description), name, value::null(), is_nullable, is_sequence, constraints);
}
web::json::value make_nc_parameter_descriptor(const utility::string_t& description, const nc_name& name, const utility::string_t& type_name, bool is_nullable, bool is_sequence, const web::json::value& constraints)
{
using web::json::value;
return make_nc_parameter_descriptor(value::string(description), name, value::string(type_name), is_nullable, is_sequence, constraints);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncpropertydescriptor
// description can be null
// constraints can be null
web::json::value make_nc_property_descriptor(const web::json::value& description, const nc_property_id& id, const nc_name& name, const web::json::value& type_name,
bool is_read_only, bool is_nullable, bool is_sequence, bool is_deprecated, const web::json::value& constraints)
{
using web::json::value;
auto data = make_nc_descriptor(description);
data[nmos::fields::nc::id] = make_nc_property_id(id);
data[nmos::fields::nc::name] = value::string(name);
data[nmos::fields::nc::type_name] = type_name;
data[nmos::fields::nc::is_read_only] = value::boolean(is_read_only);
data[nmos::fields::nc::is_nullable] = value::boolean(is_nullable);
data[nmos::fields::nc::is_sequence] = value::boolean(is_sequence);
data[nmos::fields::nc::is_deprecated] = value::boolean(is_deprecated);
data[nmos::fields::nc::constraints] = constraints;
return data;
}
web::json::value make_nc_property_descriptor(const utility::string_t& description, const nc_property_id& id, const nc_name& name, const utility::string_t& type_name,
bool is_read_only, bool is_nullable, bool is_sequence, bool is_deprecated, const web::json::value& constraints)
{
using web::json::value;
return nmos::details::make_nc_property_descriptor(value::string(description), id, name, value::string(type_name), is_read_only, is_nullable, is_sequence, is_deprecated, constraints);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncdatatypedescriptor
// description can be null
// constraints can be null
web::json::value make_nc_datatype_descriptor(const web::json::value& description, const nc_name& name, nc_datatype_type::type type, const web::json::value& constraints)
{
using web::json::value;
auto data = make_nc_descriptor(description);
data[nmos::fields::nc::name] = value::string(name);
data[nmos::fields::nc::type] = type;
data[nmos::fields::nc::constraints] = constraints;
return data;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncdatatypedescriptorenum
// description can be null
// constraints can be null
// items: sequence<NcEnumItemDescriptor>
web::json::value make_nc_datatype_descriptor_enum(const web::json::value& description, const nc_name& name, const web::json::value& items, const web::json::value& constraints)
{
auto data = make_nc_datatype_descriptor(description, name, nc_datatype_type::Enum, constraints);
data[nmos::fields::nc::items] = items;
return data;
}
web::json::value make_nc_datatype_descriptor_enum(const utility::string_t& description, const nc_name& name, const web::json::value& items, const web::json::value& constraints)
{
using web::json::value;
return make_nc_datatype_descriptor_enum(value::string(description), name, items, constraints);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncdatatypedescriptorprimitive
// description can be null
// constraints can be null
web::json::value make_nc_datatype_descriptor_primitive(const web::json::value& description, const nc_name& name, const web::json::value& constraints)
{
return make_nc_datatype_descriptor(description, name, nc_datatype_type::Primitive, constraints);
}
web::json::value make_nc_datatype_descriptor_primitive(const utility::string_t& description, const nc_name& name, const web::json::value& constraints)
{
using web::json::value;
return make_nc_datatype_descriptor_primitive(value::string(description), name, constraints);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncdatatypedescriptorstruct
// description can be null
// constraints can be null
// fields: sequence<NcFieldDescriptor>
// parent_type can be null
web::json::value make_nc_datatype_descriptor_struct(const web::json::value& description, const nc_name& name, const web::json::value& fields, const web::json::value& parent_type, const web::json::value& constraints)
{
auto data = make_nc_datatype_descriptor(description, name, nc_datatype_type::Struct, constraints);
data[nmos::fields::nc::fields] = fields;
data[nmos::fields::nc::parent_type] = parent_type;
return data;
}
web::json::value make_nc_datatype_descriptor_struct(const utility::string_t& description, const nc_name& name, const web::json::value& fields, const utility::string_t& parent_type, const web::json::value& constraints)
{
using web::json::value;
return make_nc_datatype_descriptor_struct(value::string(description), name, fields, value::string(parent_type), constraints);
}
web::json::value make_nc_datatype_descriptor_struct(const utility::string_t& description, const nc_name& name, const web::json::value& fields, const web::json::value& constraints)
{
using web::json::value;
return make_nc_datatype_descriptor_struct(value::string(description), name, fields, value::null(), constraints);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncdatatypedescriptortypedef
// description can be null
// constraints can be null
web::json::value make_nc_datatype_typedef(const web::json::value& description, const nc_name& name, bool is_sequence, const utility::string_t& parent_type, const web::json::value& constraints)
{
using web::json::value;
auto data = make_nc_datatype_descriptor(description, name, nc_datatype_type::Typedef, constraints);
data[nmos::fields::nc::parent_type] = value::string(parent_type);
data[nmos::fields::nc::is_sequence] = value::boolean(is_sequence);
return data;
}
web::json::value make_nc_datatype_typedef(const utility::string_t& description, const nc_name& name, bool is_sequence, const utility::string_t& parent_type, const web::json::value& constraints)
{
using web::json::value;
return make_nc_datatype_typedef(value::string(description), name, is_sequence, parent_type, constraints);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncpropertyconstraints
web::json::value make_nc_property_constraints(const nc_property_id& property_id, const web::json::value& default_value)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::property_id, make_nc_property_id(property_id) },
{ nmos::fields::nc::default_value, default_value }
});
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncpropertyconstraintsnumber
web::json::value make_nc_property_constraints_number(const nc_property_id& property_id, const web::json::value& default_value, const web::json::value& minimum, const web::json::value& maximum, const web::json::value& step)
{
using web::json::value;
auto data = make_nc_property_constraints(property_id, default_value);
data[nmos::fields::nc::minimum] = minimum;
data[nmos::fields::nc::maximum] = maximum;
data[nmos::fields::nc::step] = step;
return data;
}
web::json::value make_nc_property_constraints_number(const nc_property_id& property_id, uint64_t default_value, uint64_t minimum, uint64_t maximum, uint64_t step)
{
using web::json::value;
return make_nc_property_constraints_number(property_id, value(default_value), value(minimum), value(maximum), value(step));
}
web::json::value make_nc_property_constraints_number(const nc_property_id& property_id, uint64_t minimum, uint64_t maximum, uint64_t step)
{
using web::json::value;
return make_nc_property_constraints_number(property_id, value::null(), minimum, maximum, step);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncpropertyconstraintsstring
web::json::value make_nc_property_constraints_string(const nc_property_id& property_id, const web::json::value& default_value, const web::json::value& max_characters, const web::json::value& pattern)
{
using web::json::value;
auto data = make_nc_property_constraints(property_id, default_value);
data[nmos::fields::nc::max_characters] = max_characters;
data[nmos::fields::nc::pattern] = pattern;
return data;
}
web::json::value make_nc_property_constraints_string(const nc_property_id& property_id, const utility::string_t& default_value, uint32_t max_characters, const nc_regex& pattern)
{
using web::json::value;
return make_nc_property_constraints_string(property_id, value::string(default_value), max_characters, value::string(pattern));
}
web::json::value make_nc_property_constraints_string(const nc_property_id& property_id, uint32_t max_characters, const nc_regex& pattern)
{
using web::json::value;
return make_nc_property_constraints_string(property_id, value::null(), max_characters, value::string(pattern));
}
web::json::value make_nc_property_constraints_string(const nc_property_id& property_id, uint32_t max_characters)
{
using web::json::value;
return make_nc_property_constraints_string(property_id, value::null(), max_characters, value::null());
}
web::json::value make_nc_property_constraints_string(const nc_property_id& property_id, const nc_regex& pattern)
{
using web::json::value;
return make_nc_property_constraints_string(property_id, value::null(), value::null(), value::string(pattern));
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncparameterconstraints
web::json::value make_nc_parameter_constraints(const web::json::value& default_value)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::default_value, default_value }
});
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncparameterconstraintsnumber
web::json::value make_nc_parameter_constraints_number(const web::json::value& default_value, const web::json::value& minimum, const web::json::value& maximum, const web::json::value& step)
{
using web::json::value;
auto data = make_nc_parameter_constraints(default_value);
data[nmos::fields::nc::minimum] = minimum;
data[nmos::fields::nc::maximum] = maximum;
data[nmos::fields::nc::step] = step;
return data;
}
web::json::value make_nc_parameter_constraints_number(uint64_t default_value, uint64_t minimum, uint64_t maximum, uint64_t step)
{
using web::json::value;
return make_nc_parameter_constraints_number(value(default_value), value(minimum), value(maximum), value(step));
}
web::json::value make_nc_parameter_constraints_number(uint64_t minimum, uint64_t maximum, uint64_t step)
{
using web::json::value;
return make_nc_parameter_constraints_number(value::null(), minimum, maximum, step);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncparameterconstraintsstring
web::json::value make_nc_parameter_constraints_string(const web::json::value& default_value, const web::json::value& max_characters, const web::json::value& pattern)
{
auto data = make_nc_parameter_constraints(default_value);
data[nmos::fields::nc::max_characters] = max_characters;
data[nmos::fields::nc::pattern] = pattern;
return data;
}
web::json::value make_nc_parameter_constraints_string(const utility::string_t& default_value, uint32_t max_characters, const nc_regex& pattern)
{
using web::json::value;
return make_nc_parameter_constraints_string(value::string(default_value), max_characters, value::string(pattern));
}
web::json::value make_nc_parameter_constraints_string(uint32_t max_characters, const nc_regex& pattern)
{
using web::json::value;
return make_nc_parameter_constraints_string(value::null(), max_characters, value::string(pattern));
}
web::json::value make_nc_parameter_constraints_string(uint32_t max_characters)
{
using web::json::value;
return make_nc_parameter_constraints_string(value::null(), max_characters, value::null());
}
web::json::value make_nc_parameter_constraints_string(const nc_regex& pattern)
{
using web::json::value;
return make_nc_parameter_constraints_string(value::null(), value::null(), value::string(pattern));
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#nctouchpointresource
web::json::value make_nc_touchpoint_resource(const nc_touchpoint_resource& resource)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::resource_type, resource.resource_type }
});
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#nctouchpointresourcenmos
web::json::value make_nc_touchpoint_resource_nmos(const nc_touchpoint_resource_nmos& resource)
{
using web::json::value;
auto data = make_nc_touchpoint_resource(resource);
data[nmos::fields::nc::id] = value::string(resource.id);
return data;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#nctouchpointresourcenmoschannelmapping
web::json::value make_nc_touchpoint_resource_nmos_channel_mapping(const nc_touchpoint_resource_nmos_channel_mapping& resource)
{
using web::json::value;
auto data = make_nc_touchpoint_resource_nmos(resource);
data[nmos::fields::nc::io_id] = value::string(resource.io_id);
return data;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#nctouchpoint
web::json::value make_nc_touchpoint(const utility::string_t& context_namespace)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::context_namespace, context_namespace }
});
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#nctouchpointnmos
web::json::value make_nc_touchpoint_nmos(const nc_touchpoint_resource_nmos& resource)
{
auto data = make_nc_touchpoint(U("x-nmos"));
data[nmos::fields::nc::resource] = make_nc_touchpoint_resource_nmos(resource);
return data;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#nctouchpointnmoschannelmapping
web::json::value make_nc_touchpoint_nmos_channel_mapping(const nc_touchpoint_resource_nmos_channel_mapping& resource)
{
auto data = make_nc_touchpoint(U("x-nmos/channelmapping"));
data[nmos::fields::nc::resource] = make_nc_touchpoint_resource_nmos_channel_mapping(resource);
return data;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncobject
web::json::value make_nc_object(const nc_class_id& class_id, nc_oid oid, bool constant_oid, const web::json::value& owner, const utility::string_t& role, const web::json::value& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints)
{
using web::json::value;
const auto id = utility::conversions::details::to_string_t(oid);
auto data = make_resource_core(id, user_label.is_null() ? U("") : user_label.as_string(), description); // required for nmos::resource
data[nmos::fields::nc::class_id] = make_nc_class_id(class_id);
data[nmos::fields::nc::oid] = oid;
data[nmos::fields::nc::constant_oid] = value::boolean(constant_oid);
data[nmos::fields::nc::owner] = owner;
data[nmos::fields::nc::role] = value::string(role);
data[nmos::fields::nc::user_label] = user_label;
data[nmos::fields::nc::touchpoints] = touchpoints;
data[nmos::fields::nc::runtime_property_constraints] = runtime_property_constraints; // level 2 runtime constraints. See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Constraints.html
return data;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncblock
web::json::value make_nc_block(const nc_class_id& class_id, nc_oid oid, bool constant_oid, const web::json::value& owner, const utility::string_t& role, const web::json::value& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints, bool enabled, const web::json::value& members)
{
using web::json::value;
auto data = details::make_nc_object(class_id, oid, constant_oid, owner, role, user_label, description, touchpoints, runtime_property_constraints);
data[nmos::fields::nc::enabled] = value::boolean(enabled);
data[nmos::fields::nc::members] = members;
return data;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncworker
web::json::value make_nc_worker(const nc_class_id& class_id, nc_oid oid, bool constant_oid, nc_oid owner, const utility::string_t& role, const web::json::value& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints, bool enabled)
{
using web::json::value;
auto data = details::make_nc_object(class_id, oid, constant_oid, owner, role, user_label, description, touchpoints, runtime_property_constraints);
data[nmos::fields::nc::enabled] = value::boolean(enabled);
return data;
}
// See https://specs.amwa.tv/nmos-control-feature-sets/branches/main/monitoring/#ncreceivermonitor
web::json::value make_receiver_monitor(const nc_class_id& class_id, nc_oid oid, bool constant_oid, nc_oid owner, const utility::string_t& role, const utility::string_t& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints, bool enabled,
nc_connection_status::status connection_status, const utility::string_t& connection_status_message, nc_payload_status::status payload_status, const utility::string_t& payload_status_message)
{
using web::json::value;
auto data = make_nc_worker(class_id, oid, constant_oid, owner, role, value::string(user_label), description, touchpoints, runtime_property_constraints, enabled);
data[nmos::fields::nc::connection_status] = value::number(connection_status);
data[nmos::fields::nc::connection_status_message] = value::string(connection_status_message);
data[nmos::fields::nc::payload_status] = value::number(payload_status);
data[nmos::fields::nc::payload_status_message] = value::string(payload_status_message);
return data;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncmanager
web::json::value make_nc_manager(const nc_class_id& class_id, nc_oid oid, bool constant_oid, const web::json::value& owner, const utility::string_t& role, const web::json::value& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints)
{
return make_nc_object(class_id, oid, constant_oid, owner, role, user_label, description, touchpoints, runtime_property_constraints);
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncdevicemanager
web::json::value make_nc_device_manager(nc_oid oid, nc_oid owner, const web::json::value& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints,
const web::json::value& manufacturer, const web::json::value& product, const utility::string_t& serial_number,
const web::json::value& user_inventory_code, const web::json::value& device_name, const web::json::value& device_role, const web::json::value& operational_state, nc_reset_cause::cause reset_cause)
{
using web::json::value;
auto data = details::make_nc_manager(nc_device_manager_class_id, oid, true, owner, U("DeviceManager"), user_label, description, touchpoints, runtime_property_constraints);
data[nmos::fields::nc::nc_version] = value::string(U("v1.0.0"));
data[nmos::fields::nc::manufacturer] = manufacturer;
data[nmos::fields::nc::product] = product;
data[nmos::fields::nc::serial_number] = value::string(serial_number);
data[nmos::fields::nc::user_inventory_code] = user_inventory_code;
data[nmos::fields::nc::device_name] = device_name;
data[nmos::fields::nc::device_role] = device_role;
data[nmos::fields::nc::operational_state] = operational_state;
data[nmos::fields::nc::reset_cause] = reset_cause;
data[nmos::fields::nc::message] = value::null();
return data;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncclassmanager
web::json::value make_nc_class_manager(nc_oid oid, nc_oid owner, const web::json::value& user_label, const utility::string_t& description, const web::json::value& touchpoints, const web::json::value& runtime_property_constraints, const nmos::experimental::control_protocol_state& control_protocol_state)
{
using web::json::value;
auto data = make_nc_manager(nc_class_manager_class_id, oid, true, owner, U("ClassManager"), user_label, description, touchpoints, runtime_property_constraints);
auto lock = control_protocol_state.read_lock();
// add control classes
data[nmos::fields::nc::control_classes] = value::array();
auto& control_classes = data[nmos::fields::nc::control_classes];
for (const auto& control_class : control_protocol_state.control_class_descriptors)
{
auto& ctl_class = control_class.second;
auto method_descriptors = value::array();
for (const auto& method_descriptor : ctl_class.method_descriptors) { web::json::push_back(method_descriptors, std::get<0>(method_descriptor)); }
const auto class_description = ctl_class.fixed_role.is_null()
? make_nc_class_descriptor(ctl_class.description, ctl_class.class_id, ctl_class.name, ctl_class.property_descriptors, method_descriptors, ctl_class.event_descriptors)
: make_nc_class_descriptor(ctl_class.description, ctl_class.class_id, ctl_class.name, ctl_class.fixed_role.as_string(), ctl_class.property_descriptors, method_descriptors, ctl_class.event_descriptors);
web::json::push_back(control_classes, class_description);
}
// add datatypes
data[nmos::fields::nc::datatypes] = value::array();
auto& datatypes = data[nmos::fields::nc::datatypes];
for (const auto& datatype_descriptor : control_protocol_state.datatype_descriptors)
{
web::json::push_back(datatypes, datatype_descriptor.second.descriptor);
}
return data;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncpropertychangedeventdata
web::json::value make_nc_property_changed_event_data(const nc_property_changed_event_data& property_changed_event_data)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::property_id, details::make_nc_property_id(property_changed_event_data.property_id) },
{ nmos::fields::nc::change_type, property_changed_event_data.change_type },
{ nmos::fields::nc::value, property_changed_event_data.value },
{ nmos::fields::nc::sequence_item_index, property_changed_event_data.sequence_item_index }
});
}
}
// command message response
// See https://specs.amwa.tv/is-12/branches/v1.0.x/docs/Protocol_messaging.html#command-response-message-type
web::json::value make_control_protocol_response(int32_t handle, const web::json::value& method_result)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::handle, handle },
{ nmos::fields::nc::result, method_result }
});
}
web::json::value make_control_protocol_command_response(const web::json::value& responses)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::message_type, ncp_message_type::command_response },
{ nmos::fields::nc::responses, responses }
});
}
// subscription response
// See https://specs.amwa.tv/is-12/branches/v1.0.x/docs/Protocol_messaging.html#subscription-response-message-type
web::json::value make_control_protocol_subscription_response(const web::json::value& subscriptions)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::message_type, ncp_message_type::subscription_response },
{ nmos::fields::nc::subscriptions, subscriptions }
});
}
// notification
// See https://specs.amwa.tv/ms-05-01/branches/v1.0.x/docs/Core_Mechanisms.html#notification-messages
// See https://specs.amwa.tv/is-12/branches/v1.0.x/docs/Protocol_messaging.html#notification-message-type
web::json::value make_control_protocol_notification(nc_oid oid, const nc_event_id& event_id, const nc_property_changed_event_data& property_changed_event_data)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::oid, oid },
{ nmos::fields::nc::event_id, details::make_nc_event_id(event_id)},
{ nmos::fields::nc::event_data, details::make_nc_property_changed_event_data(property_changed_event_data) }
});
}
web::json::value make_control_protocol_notification_message(const web::json::value& notifications)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::message_type, ncp_message_type::notification },
{ nmos::fields::nc::notifications, notifications }
});
}
// property changed notification event
// See https://specs.amwa.tv/ms-05-01/branches/v1.0.x/docs/Core_Mechanisms.html#the-propertychanged-event
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/NcObject.html#propertychanged-event
web::json::value make_property_changed_event(nc_oid oid, const std::vector<nc_property_changed_event_data>& property_changed_event_data_list)
{
using web::json::value;
auto notifications = value::array();
for (auto& property_changed_event_data : property_changed_event_data_list)
{
web::json::push_back(notifications, make_control_protocol_notification(oid, nc_object_property_changed_event_id, property_changed_event_data));
}
return make_control_protocol_notification_message(notifications);
}
// error message
// See https://specs.amwa.tv/is-12/branches/v1.0.x/docs/Protocol_messaging.html#error-messages
web::json::value make_control_protocol_error_message(const nc_method_result& method_result, const utility::string_t& error_message)
{
using web::json::value_of;
return value_of({
{ nmos::fields::nc::message_type, ncp_message_type::error },
{ nmos::fields::nc::status, method_result.status},
{ nmos::fields::nc::error_message, error_message }
});
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncobject
web::json::value make_nc_object_properties()
{
using web::json::value;
auto properties = value::array();
web::json::push_back(properties, details::make_nc_property_descriptor(U("Static value. All instances of the same class will have the same identity value"), nc_object_class_id_property_id, nmos::fields::nc::class_id, U("NcClassId"), true, false, false, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("Object identifier"), nc_object_oid_property_id, nmos::fields::nc::oid, U("NcOid"), true, false, false, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("TRUE iff OID is hardwired into device"), nc_object_constant_oid_property_id, nmos::fields::nc::constant_oid, U("NcBoolean"), true, false, false, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("OID of containing block. Can only ever be null for the root block"), nc_object_owner_property_id, nmos::fields::nc::owner, U("NcOid"), true, true, false, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("Role of object in the containing block"), nc_object_role_property_id, nmos::fields::nc::role, U("NcString"), true, false, false, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("Scribble strip"), nc_object_user_label_property_id, nmos::fields::nc::user_label, U("NcString"), false, true, false, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("Touchpoints to other contexts"), nc_object_touchpoints_property_id, nmos::fields::nc::touchpoints, U("NcTouchpoint"), true, true, true, false, value::null()));
web::json::push_back(properties, details::make_nc_property_descriptor(U("Runtime property constraints"), nc_object_runtime_property_constraints_property_id, nmos::fields::nc::runtime_property_constraints, U("NcPropertyConstraints"), true, true, true, false, value::null()));
return properties;
}
web::json::value make_nc_object_methods()
{
using web::json::value;
auto methods = value::array();
{
auto parameters = value::array();
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Property id"), nmos::fields::nc::id, U("NcPropertyId"), false, false, value::null()));
web::json::push_back(methods, details::make_nc_method_descriptor(U("Get property value"), nc_object_get_method_id, U("Get"), U("NcMethodResultPropertyValue"), parameters, false));
}
{
auto parameters = value::array();
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Property id"), nmos::fields::nc::id, U("NcPropertyId"), false, false, value::null()));
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Property value"), nmos::fields::nc::value, true, false, value::null()));
web::json::push_back(methods, details::make_nc_method_descriptor(U("Set property value"), nc_object_set_method_id, U("Set"), U("NcMethodResult"), parameters, false));
}
{
auto parameters = value::array();
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Property id"), nmos::fields::nc::id, U("NcPropertyId"), false, false, value::null()));
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Index of item in the sequence"), nmos::fields::nc::index, U("NcId"), false, false, value::null()));
web::json::push_back(methods, details::make_nc_method_descriptor(U("Get sequence item"), nc_object_get_sequence_item_method_id, U("GetSequenceItem"), U("NcMethodResultPropertyValue"), parameters, false));
}
{
auto parameters = value::array();
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Property id"), nmos::fields::nc::id, U("NcPropertyId"), false, false, value::null()));
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Index of item in the sequence"), nmos::fields::nc::index, U("NcId"), false, false, value::null()));
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Value"), nmos::fields::nc::value, true, false, value::null()));
web::json::push_back(methods, details::make_nc_method_descriptor(U("Set sequence item value"), nc_object_set_sequence_item_method_id, U("SetSequenceItem"), U("NcMethodResult"), parameters, false));
}
{
auto parameters = value::array();
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Property id"), nmos::fields::nc::id,U("NcPropertyId"), false, false, value::null()));
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Value"), nmos::fields::nc::value, true, false, value::null()));
web::json::push_back(methods, details::make_nc_method_descriptor(U("Add item to sequence"), nc_object_add_sequence_item_method_id, U("AddSequenceItem"), U("NcMethodResultId"), parameters, false));
}
{
auto parameters = value::array();
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Property id"), nmos::fields::nc::id, U("NcPropertyId"), false, false, value::null()));
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Index of item in the sequence"), nmos::fields::nc::index, U("NcId"), false, false, value::null()));
web::json::push_back(methods, details::make_nc_method_descriptor(U("Delete sequence item"), nc_object_remove_sequence_item_method_id, U("RemoveSequenceItem"), U("NcMethodResult"), parameters, false));
}
{
auto parameters = value::array();
web::json::push_back(parameters, details::make_nc_parameter_descriptor(U("Property id"), nmos::fields::nc::id, U("NcPropertyId"), false, false, value::null()));
web::json::push_back(methods, details::make_nc_method_descriptor(U("Get sequence length"), nc_object_get_sequence_length_method_id, U("GetSequenceLength"), U("NcMethodResultLength"), parameters, false));
}
return methods;
}
web::json::value make_nc_object_events()
{
using web::json::value;
auto events = value::array();
web::json::push_back(events, details::make_nc_event_descriptor(U("Property changed event"), nc_object_property_changed_event_id, U("PropertyChanged"), U("NcPropertyChangedEventData"), false));
return events;
}
// See https://specs.amwa.tv/ms-05-02/branches/v1.0.x/docs/Framework.html#ncblock
web::json::value make_nc_block_properties()
{
using web::json::value;
auto properties = value::array();
web::json::push_back(properties, details::make_nc_property_descriptor(U("TRUE if block is functional"), nc_block_enabled_property_id, nmos::fields::nc::enabled, U("NcBoolean"), true, false, false, false, value::null()));