public void SetCurrentStatusCallback(Action <GalileoStatus> statusCB = null) { onStatusUpdateCB = (status, statusJson, length) => { byte[] result = new byte[length]; Marshal.Copy(statusJson, result, 0, (int)length); var statusStr = Encoding.ASCII.GetString(result, 0, (int)length); statusCB?.Invoke(JsonConvert.DeserializeObject <GalileoStatus>(statusStr)); }; GalileoFunctions.SetCurrentStatusCallback(instance, onStatusUpdateCB); }