Hello Dojo,
I am creating a matrix in a driver and found that on initial element creation, using the MatrixHelperForMatrix, the matrix will update and display all the crosspoints correctly. But after restarting the element and setting the same crosspoints again, they no longer show up. The crosspoints buffer and serialized data parameters all have the correct connections as well. The only way I have been able to get the crosspoints to show up is by disconnecting all connections from the outputs and the reapply them.
Is that the intended way to handle this scenario on element restart?
Below is the method I created to fill in the Matrix using the helper class:
private void ParseCrosspointsResposne(SLProtocolExt protocol, string responseData)
{
var parsedData = JsonConvert.DeserializeObject<NatxCrosspoints>(responseData);
var maxInput = parsedData.Value.Inputs.Max(x => x.Key);
var maxOutput = parsedData.Value.Outputs.Max(x => x.Key);
Matrix matrix = matrixStorage.GetMatrix(protocol);
matrix.DisplayedInputs = maxInput;
matrix.DisplayedOutputs = maxOutput;
for (var i = 0; i < maxInput; i++)
{
matrix.Inputs[i].Label = "Input " + i;
}
for (var i = 0; i < maxOutput; i++)
{
matrix.Outputs[i].Label = "Output " + i;
matrix.Outputs[i].DisconnectAll(); // Feel like this isn't needed
}
matrix.ApplyChanges(protocol); // Feel like this isn't needed
foreach (var input in parsedData.Value.Inputs)
{
var inputIndex = input.Key - 1;
matrix.Inputs[inputIndex].Label = input.Value.Label;
matrix.Inputs[inputIndex].IsEnabled = true;
}
foreach (var output in parsedData.Value.Outputs)
{
var outputIndex = output.Key;
var matrixIndex = outputIndex - 1;
matrix.Outputs[matrixIndex].Label = output.Value.Label;
matrix.Outputs[matrixIndex].IsEnabled = true;
matrix.Outputs[matrixIndex].ToolTip = output.Value.Comment;
if (parsedData.Value.State.ContainsKey(outputIndex))
{
matrix.Outputs[matrixIndex].Connect(parsedData.Value.State[outputIndex].Select(x => x - 1));
}
}
matrix.ApplyChanges(protocol);
}
Many thanks in advance.

Hello Tamara, I could not find the ProcessDataFromDevice method in the helper class or in the help so not sure what that is referring to, but I have added the method I am using to populate the matrix. For more context, I receive all the crosspoints at once via an HTTP response from the device.
Hello Gabriel,
I believe this depends on how the ProcessDataFromDevice method is triggered and implemented. Could you provide a few more details so we can better understand the behavior?