Exemplo n.º 1
0
 public SendLockActionCommand(NukiLockAction lockAction, NukiLockActionFlags flags, IConnectionContext connectionContext) :
     base(NukiCommandType.LockAction, connectionContext, 4)
 {
     AddField(nameof(LockAction), lockAction);
     AddField(nameof(UniqueClientID), connectionContext.UniqueClientID);
     AddField(nameof(Flags), flags);
     AddField(nameof(SmartLockNonce), connectionContext.SmartLockNonce);
 }
Exemplo n.º 2
0
        public async Task <INukiReturnMessage> SendLockAction(NukiLockAction lockAction, NukiLockActionFlags flags = NukiLockActionFlags.None)
        {
            RecieveStatusCommand retCmd = null;

            try
            {
                using (var lockHandle = await Locker.Lock())
                {
                    if (lockHandle.Successfull && await Challenge())
                    {
                        Log.Debug("Send SendLockAction command...");
                        retCmd = await m_UGDIO.Send <RecieveStatusCommand>(new SendLockActionCommand(lockAction, flags, this));
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                Update(new NukiCommandException(NukiCommandType.LockAction, ex));
            }
            return(retCmd);
        }