public RecieveErrorReportCommand(NukiErrorCode errorCode, NukiCommandType failedCommand) : base(NukiCommandType.ErrorReport, new FieldParserBase[] { new FieldParser <NukiErrorCode>(nameof(ErrorCode), sizeof(NukiErrorCode), (b, s, l) => errorCode), new FieldParser <NukiCommandType>(nameof(FailedCommand), sizeof(NukiCommandType), (b, s, l) => failedCommand) }) { }
private RecieveBaseCommand(NukiCommandType type, FieldParserBase[] fields) : base(type, fields.Length) { m_fields = fields; int nBytesCount = 0; foreach (var field in fields) { nBytesCount += field.ByteLength; } m_byData = new byte[nBytesCount]; }
public NukiCommandFailed(NukiCommandType requestedCmd, NukiErrorCode statusCode) { FailedCommand = requestedCmd; ErrorCode = statusCode; }
public SendBaseCommandWithContext(NukiCommandType type, IConnectionContext connectionContext, int nNumberOfFields) : base(type, nNumberOfFields) { ConnectionContext = connectionContext; }
protected RecieveBaseCommandAuthenticated(NukiCommandType type, IEnumerable <FieldParserBase> fields) : base(type, InitFields(fields)) { }
public BaseCommand(NukiCommandType type, int nNumberOfFields) { m_mapByPostion = new DataField[nNumberOfFields + 1]; AddField(nameof(CommandType), type, FieldFlags.PartOfMessage); }
/// <summary> /// Request Data (0x0001) /// </summary> /// <param name="requestedCommand">The identifier of the command to be executed by the NukiSmartlock.</param> public SendRequestDataCommand(NukiCommandType requestedCommand) : base(NukiCommandType.RequestData, 1) { AddField(nameof(ReqestedCommand), requestedCommand); }
protected RecieveBaseCommand(NukiCommandType type, IEnumerable <FieldParserBase> fields) : this(type, AddCRCField(fields)) { }
public NukiCommandException(NukiCommandType failedCommand, Exception ex) { FailedCommand = failedCommand; Exception = ex; }
public static RecieveBaseCommand Parse(IDataReader reader) { RecieveBaseCommand cmd = null; if (reader.UnconsumedBufferLength >= 2) { NukiCommandType cmdType = (NukiCommandType)reader.ReadUInt16(); switch (cmdType) { case NukiCommandType.AuthorizationID: cmd = new RecieveAuthorizationIDCommand(); break; case NukiCommandType.Challenge: cmd = new RecieveChallengeCommand(); break; case NukiCommandType.ErrorReport: cmd = new RecieveErrorReportCommand(); break; case NukiCommandType.PublicKey: cmd = new RecievePublicKeyCommand(); break; case NukiCommandType.Status: cmd = new RecieveStatusCommand(); break; case NukiCommandType.NukiStates: cmd = new RecieveNukiStatesCommand(); break; case NukiCommandType.Config: cmd = new RecieveConfigCommand(); break; case NukiCommandType.BatteryReport: cmd = new RecieveBatteryReportCommand(); break; case NukiCommandType.LogEntryCount: cmd = new RecieveLogEntryCountCommand(); break; case NukiCommandType.LogEntry: cmd = new RecieveLogEntryCommand(); break; default: Log.Error($"Command {cmdType} is not handelt!"); break; } } else { //not enough data... } return(cmd); }
public NukiCommandTimeout(NukiCommandType failedCommand, int nTimeoutTime) { FailedCommand = failedCommand; TimeoutTime = nTimeoutTime; }
public SendBaseCommand(NukiCommandType type, int nNumberOfFields) : base(type, nNumberOfFields) { }
public SendBaseCommandAuthenticated(NukiCommandType type, IConnectionContext connectionContext, int nNumberOfFields) : base(type, connectionContext, nNumberOfFields + 1) { AddField(nameof(Authenticator), CalculateAuthenticator, 32, FieldFlags.PartOfMessage); }