Skip to content

Commit b396b7d

Browse files
committed
Fix Camera.ImageArray bug when processing colour image data
1 parent 304e5d9 commit b396b7d

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

Remote Server/ServerForm.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5112,7 +5112,6 @@ private void ReturnImageArray(RequestData requestData)
51125112
switch (deviceResponse.Rank)
51135113
{
51145114
case 2:
5115-
case 3:
51165115
if (base64HandoffRequested) // Handle base64 hand-off processing
51175116
{
51185117
LogMessage1(requestData, requestData.Elements[URL_ELEMENT_METHOD], string.Format("Base64Encoded - Preparing base64 hand off response"));
@@ -5134,6 +5133,28 @@ private void ReturnImageArray(RequestData requestData)
51345133
responseClass.Value = (int[,])deviceResponse;
51355134
}
51365135
break;
5136+
case 3:
5137+
if (base64HandoffRequested) // Handle base64 hand-off processing
5138+
{
5139+
LogMessage1(requestData, requestData.Elements[URL_ELEMENT_METHOD], string.Format("Base64Encoded - Preparing base64 hand off response"));
5140+
responseClass = new Base64ArrayHandOffResponse() // Create a populated response class with array dimensions but that doesn't have a "Value" member
5141+
{
5142+
ClientTransactionID = requestData.ClientTransactionID,
5143+
ServerTransactionID = requestData.ServerTransactionID,
5144+
Rank = deviceResponse.Rank,
5145+
Type = (int)SharedConstants.ImageArrayElementTypes.Int,
5146+
Dimension0Length = deviceResponse.GetLength(0)
5147+
};
5148+
if (responseClass.Rank > 1) responseClass.Dimension1Length = deviceResponse.GetLength(1); // Set higher array dimensions if present
5149+
if (responseClass.Rank > 2) responseClass.Dimension2Length = deviceResponse.GetLength(2);
5150+
LogMessage1(requestData, requestData.Elements[URL_ELEMENT_METHOD], string.Format("Base64Encoded - Completed base64 hand off response"));
5151+
}
5152+
else // Normal JSON encoding of the array elements
5153+
{
5154+
responseClass = new IntArray3DResponse(requestData.ClientTransactionID, requestData.ServerTransactionID);
5155+
responseClass.Value = (int[,,])deviceResponse;
5156+
}
5157+
break;
51375158

51385159
default:
51395160
throw new InvalidParameterException("ReturnImageArray received array of Rank " + deviceResponse.Rank + ", this is not currently supported.");

0 commit comments

Comments
 (0)