AlpacaToolsToByteArray(Array, Int32, UInt32, UInt32, ImageArrayElementTypes, AlpacaErrors, String) Method
Alpaca Extension - Convert the array or error message to a byte array for transmission to a client
Namespace: ASCOM.Common.AlpacaAssembly: ASCOM.Common (in ASCOM.Common.dll) Version: 3.0.0-rc.1+86c25ce733aebb4d8b1b8a62e84770ea5e972bea
public static byte[] ToByteArray(
this Array imageArray,
int metadataVersion,
uint clientTransactionID,
uint serverTransactionID,
ImageArrayElementTypes requiredClientElementType,
AlpacaErrors errorNumber,
string errorMessage
)
<ExtensionAttribute>
Public Shared Function ToByteArray (
imageArray As Array,
metadataVersion As Integer,
clientTransactionID As UInteger,
serverTransactionID As UInteger,
requiredClientElementType As ImageArrayElementTypes,
errorNumber As AlpacaErrors,
errorMessage As String
) As Byte()
- 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.
- requiredClientElementType ImageArrayElementTypes
- The element type to be used in the array returned to the client. This enables the returned array to be of different type than the supplied image array (see remarks).
- 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.
ByteByte array prefixed with array metadata.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).
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.
The output element type must be of equal or greater capacity than the source array element type and must also be from the same family of types as the source array element:
Integer family (byte / Int16 / Uint16 / Int32 / Uint32 / Int64 / Uint64) or Floating point family (Single / Double).
Truncation of data is not supported by this method.
For example, an Int16 source array can be returned to the client as an Int32 array but not as a Byte array.
Supported in: 2.0