private IotRequest(IotReceiveFilter filter) { this.filter = filter; HeaderHex = filter.Header; Header = EncodingHelper.HexToBytes(HeaderHex); }
public IReceiveFilter <IotRequest> CreateFilter(IAppServer appServer, IAppSession appSession, IPEndPoint remoteEndPoint) { var opts = appServer.Config.Options; var filter = new IotReceiveFilter(opts["header"], Convert.ToInt32(opts["cryptoKey"], 16)); appSession.Items["filter"] = filter; return(filter); }
public static IotRequest CreateRequest(IotReceiveFilter filter, string mac, string command, string dataHex = "") { var request = new IotRequest(filter); request.Device = IotDevice.Load(mac); request.SessionId = request.Device.Mac.Right(4); request.Command = new IotCommand(command, dataHex); request.Key = request.Command.Key; request.Length = request.Command.Data.Length + 12; return(request); }
public IotRequest(IotReceiveFilter filter, byte[] body) : this(filter) { EncryptedBody = body; LoadData(); }