Example #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public CommandStatus StartStopUnit(bool immd, PowerControl pc, StartState state)
        {
            if (m_logger != null)
            {
                string args = immd.ToString() + ", " + pc.ToString() + ", " + state.ToString();
                m_logger.LogMessage(new UserMessage(UserMessage.Category.Debug, 8, "Bwg.Scsi.Device.StartStopUnit(" + args + ")"));
            }

            using (Command cmd = new Command(ScsiCommandCode.StartStopUnit, 6, 0, Command.CmdDirection.None, 30))
            {
                if (immd)
                    cmd.SetCDB8(1, 1) ;

                byte b = (byte)(((byte)pc << 4) | ((byte)state)) ;
                cmd.SetCDB8(4, b) ;

                CommandStatus st = SendCommand(cmd);
                if (st != CommandStatus.Success)
                    return st;
            }
            return CommandStatus.Success; 
        }