private void InitializeData(UInt32 playoutId, UInt64 timelinePosition) { _key = new AcspPackKey(Byte12Data.GoodRequest, Byte13NodeNames.UpdateTimelineRequest); // for now we are going with a FIXED-length schema where we do not have any of the variable-length AcspTimelineExtension involved _packLength = new AcspBerLength(36); // RequestId(4), PlayoutId(4), TimelinePosition(8), RateNumerator(8), RateDenominator(8), ExtensionCount(4) _requestId = new AcspRequestId(); ConvertPlayoutIdToByteArray(playoutId); ConvertTimelinePositionToByteArray(timelinePosition); // UInt64 numerator = 24; // assuming a default edit rate of 24:1 for the default constructor UInt64 numerator = 25; // TEMPORARILY overriding the edit unit for a specific test scenario ConvertRateNumeratorToByteArray(numerator); UInt64 denominator = 1; // assuming a default edit rate of 24:1 for the default constructor ConvertRateDenominatorToByteArray(denominator); UInt32 extensionCount = 0; // assuming zero extension counts in this vanilla implementation ConvertExtensionCountToByteArray(extensionCount); }
private void InitializeData(String inputUrl, UInt32 inputId) { _key = new AcspPackKey(Byte12Data.GoodRequest, Byte13NodeNames.SetRplLocationRequest); // Calculate required length of the value part of the packArray // which is 4 bytes for RequestId, 4 bytes for PlayoutId, and a // variable amount for the length of the ResourceUrl int length = 4 + 4 + inputUrl.Length; _packLength = new AcspBerLength(length); // Generate the new RequestId _requestId = new AcspRequestId(); // Set the Playout ID _playoutId = BitConverter.GetBytes(inputId); if (BitConverter.IsLittleEndian) { Array.Reverse(_playoutId); } // Set the Resource URL // Note that per SMPTE 430-10:2010, this field is supposed to be of type "URL", which may be different than expected UTF8 _resourceUrl = Encoding.UTF8.GetBytes(inputUrl); }
private void InitializeAnnounceRequestData() { _key = new AcspPackKey(Byte12Data.GoodRequest, Byte13NodeNames.AnnounceRequest); _requestId = new AcspRequestId(); _currentTime = DateTimeOffset.UtcNow; _currentEpochTime = _currentTime.ToUnixTimeSeconds(); _deviceDescription = "Proludio AcsListener Test Device Description"; _valueLength = _deviceDescription.Length + 4 + 8; _packLength = new AcspBerLength(_valueLength); }
private void InitializeData(UInt32 leaseDurationSeconds) { _key = new AcspPackKey(Byte12Data.GoodRequest, Byte13NodeNames.GetNewLeaseRequest); _packLength = new AcspBerLength(8); // 4 bytes for RequestId, 4 bytes for LeaseDuration _requestId = new AcspRequestId(); _leaseDuration = BitConverter.GetBytes(leaseDurationSeconds); if (BitConverter.IsLittleEndian) { Array.Reverse(_leaseDuration); } }
private void InitializeData(bool outputMode) { _key = new AcspPackKey(Byte12Data.GoodRequest, Byte13NodeNames.SetOutputModeRequest); _packLength = new AcspBerLength(5); // 4 bytes for RequestId, 1 byte for OutputMode _requestId = new AcspRequestId(); int temp = 0; if (outputMode == true) { temp = 1; } _outputMode = (Byte)temp; }
/// <summary> /// The AnnounceResponse constructor expects a byte array of at least 21 elements, /// 4 bytes for RequestID, 8 bytes for EpochTime, 4 bytes for DeviceDescriptionLength, and a /// minimum of 5 bytes for the KL (key and length) parts of the StatusResponse KLV. The /// DeviceDescription and StatusMessage (the V in the KLV) are of variable length and will add to the /// 21 byte minimum. /// </summary> /// <param name="inputArray">Byte pack that is decoded in to the Announce Response</param> public AcspAnnounceResponse(Byte[] inputArray) { if (inputArray.Length < 21) { throw new ArgumentOutOfRangeException("Error: was expecting at least a 21-byte array for AnnounceResponse constructor"); } // Take 4-byte slice and convert to UInt32 for RequestId int i = 0; Byte[] data = new Byte[4]; Array.Copy(inputArray, 0, data, 0, data.Length); i = i + data.Length; _requestId = new AcspRequestId(data); // Take 8 byte slice and convert to Int64 for CurrentTime data = new Byte[8]; Array.Copy(inputArray, i, data, 0, data.Length); i = i + data.Length; if (BitConverter.IsLittleEndian) { Array.Reverse(data); } _currentTime = BitConverter.ToInt64(data, 0); // Take 4 byte slice and convert to AcspBerLength data = new Byte[4]; Array.Copy(inputArray, i, data, 0, data.Length); i = i + data.Length; _deviceDescriptionLength = new AcspBerLength(data); // Take variable-length byte slice and convert UTF-8 string int length = _deviceDescriptionLength.Length; if (length > 0) { data = new Byte[length]; Array.Copy(inputArray, i, data, 0, data.Length); i = i + data.Length; _deviceDescription = Encoding.UTF8.GetString(data); } // Take variable-length (but at least 5 bytes) slice and convert to AcspStatusResponse int statusLength = inputArray.Length - i; data = new Byte[statusLength]; Array.Copy(inputArray, i, data, 0, data.Length); _statusResponse = new AcspStatusResponse(data); }
private void InitializeData(byte[] inputArray) { if (inputArray.Length < 9) // Expect at least a 9-byte array for RequestId + 5 bytes minimum for StatusResponse KLV { throw new ArgumentOutOfRangeException("Error: was expecting at least a 9-byte array for UpdateTimelineResponse"); } // take a 4-byte slice and convert UInt32 for RequestId int i = 0; // indexer for inputArray Byte[] data = new Byte[4]; Array.Copy(inputArray, i, data, 0, data.Length); i = i + data.Length; _requestId = new AcspRequestId(data); // take variable-length (but at least 5 bytes) slice and convert to AcspStatusResponse int statusLength = inputArray.Length - i; data = new Byte[statusLength]; Array.Copy(inputArray, i, data, 0, data.Length); i = i + data.Length; _statusResponse = new AcspStatusResponse(data); }
private void InitializeData() { _key = new AcspPackKey(Byte12Data.GoodRequest, Byte13NodeNames.TerminateLeaseRequest); _packLength = new AcspBerLength(4); _requestId = new AcspRequestId(); }
private void InitializeData() { _key = new AcspPackKey(Byte12Data.GoodRequest, Byte13NodeNames.GetStatusRequest); _packLength = new AcspBerLength(4); // 4 bytes for the RequestId _requestId = new AcspRequestId(); }