public void RebootDevice(RebootOption option) { WireProtocol.Commands.Monitor_Reboot cmd = new WireProtocol.Commands.Monitor_Reboot(); bool fThrowOnCommunicationFailureSav = this.m_fThrowOnCommunicationFailure; this.m_fThrowOnCommunicationFailure = false; switch (option) { case RebootOption.EnterBootloader: cmd.m_flags = WireProtocol.Commands.Monitor_Reboot.c_EnterBootloader; break; case RebootOption.RebootClrOnly: cmd.m_flags = this.Capabilities.SoftReboot ? WireProtocol.Commands.Monitor_Reboot.c_ClrRebootOnly : WireProtocol.Commands.Monitor_Reboot.c_NormalReboot; break; case RebootOption.RebootClrWaitForDebugger: cmd.m_flags = this.Capabilities.SoftReboot ? WireProtocol.Commands.Monitor_Reboot.c_ClrWaitForDbg : WireProtocol.Commands.Monitor_Reboot.c_NormalReboot; break; default: cmd.m_flags = WireProtocol.Commands.Monitor_Reboot.c_NormalReboot; break; } try { m_evtPing.Reset(); SyncMessage(WireProtocol.Commands.c_Monitor_Reboot, 0, cmd); if(option != RebootOption.NoReconnect) { m_evtPing.WaitOne(5000, false); } } finally { this.m_fThrowOnCommunicationFailure = fThrowOnCommunicationFailureSav; } }
public void RebootDevice( RebootOption option ) { Commands.Monitor_Reboot cmd = new Commands.Monitor_Reboot( ); bool fThrowOnCommunicationFailureSav = m_fThrowOnCommunicationFailure; m_fThrowOnCommunicationFailure = false; switch( option ) { case RebootOption.EnterBootloader: cmd.m_flags = Commands.Monitor_Reboot.c_EnterBootloader; break; case RebootOption.RebootClrOnly: cmd.m_flags = Capabilities.SoftReboot ? Commands.Monitor_Reboot.c_ClrRebootOnly : Commands.Monitor_Reboot.c_NormalReboot; break; case RebootOption.RebootClrWaitForDebugger: cmd.m_flags = Capabilities.SoftReboot ? Commands.Monitor_Reboot.c_ClrWaitForDbg : Commands.Monitor_Reboot.c_NormalReboot; break; default: cmd.m_flags = Commands.Monitor_Reboot.c_NormalReboot; break; } try { m_evtPing.Reset( ); SyncMessage( Commands.c_Monitor_Reboot, 0, cmd ); if( option != RebootOption.NoReconnect ) { int timeout = 1000; if( m_portDefinition is PortDefinition_Tcp ) { timeout = 2000; } Thread.Sleep( timeout ); } } finally { m_fThrowOnCommunicationFailure = fThrowOnCommunicationFailureSav; } }