public bool SendMISC(HCICmds.MISCCmds.MISC_GenericCommand cmd)
{
bool success = true;
try
{
byte[] sourceData = m_deviceFormUtils.String2Bytes_LSBMSB(cmd.data, 16);
if (sourceData == null)
{
DisplayInvalidData(cmd.data);
return false;
}
cmd.dataLength = (byte)sourceData.Length;
byte dataLength = (byte)(cmd.dataLength + sourceData.Length);
byte[] data = new byte[dataLength + 4];
int index = 0;
bool dataErr = false;
ushort num;
try
{
num = Convert.ToUInt16((cmd.opCode).ToString(), 16);
}
catch (Exception ex)
{
m_msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, string.Format("Invalid OpCode Entry.\n '{0}'\nFormat Is 0x0000.\n\n{1}\n", cmd.opCode.ToString(), ex.Message));
return false;
}
if (m_deviceFormUtils.LoadMsgHeader(ref data, ref index, 1, num, dataLength))
{
if (sourceData.Length == 0 || !m_dataUtils.LoadDataBytes(ref data, ref index, sourceData, ref dataErr))
TransmitCmd(cmd.cmdName, num, data);
}
if (dataErr)
success = HandleDataError(cmd.cmdName);
}
catch (Exception ex)
{
success = HandleException(cmd.cmdName, ex.Message);
}
return success;
}