AlpacaToolsToByteArray(Array, Int32, UInt32, UInt32, AlpacaErrors, String) Method

Alpaca Extension - Convert the array or error message to a byte array for transmission to a client

Definition

Namespace: ASCOM.Common.Alpaca
Assembly: ASCOM.Common (in ASCOM.Common.dll) Version: 3.0.0-rc.1+86c25ce733aebb4d8b1b8a62e84770ea5e972bea
C#
public static byte[] ToByteArray(
	this Array imageArray,
	int metadataVersion,
	uint clientTransactionID,
	uint serverTransactionID,
	AlpacaErrors errorNumber,
	string errorMessage
)

Parameters

imageArray  Array
The 2D or 3D source image array. (Ignored when returning an error.)
metadataVersion  Int32
Metadata version to use (Currently 1).
clientTransactionID  UInt32
Client's transaction ID.
serverTransactionID  UInt32
Device's transaction ID.
errorNumber  AlpacaErrors
Error number. 0 for success, non-zero for an error.
errorMessage  String
Error message. Empty string for success, error message for an error.

Return Value

Byte
Byte array prefixed with array metadata.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Array. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

Int32 source arrays where all elements have Int16, UInt16 or Byte values will automatically be converted to the smaller data size for transmission in order to improve performance and reduce network traffic. Int16 and UInt16 source arrays that only have Byte values will similarly be converted to the smaller data size for transmission. All other element types are transmitted as supplied.

Exceptions

InvalidValueExceptionIf only one of the error number and error message indicates an error.
InvalidValueExceptionImage array is null for a successful transaction or the array rank is <2 or >3 or the array is of type object
InvalidValueExceptionThe array element type is not supported.

Version Information

.NET Standard

Supported in: 2.0

See Also