public override ARESULT Initialize(Dictionary <string, object> arguments) { service = arguments["service"] as CellService; device = arguments["device"] as IDevice; // 读取配置信息 if (!device.Read(ReadMode.IrCameraParameters, null, out object outData, out _)) { return(ARESULT.E_INVALIDARG); } irCameraParameters = outData as Repository.Entities.Configuration.IrCameraParameters; tempertureDuration = 1000 / irCameraParameters.temperatureFrameRate; // 声明事件处理函数 onReceiveTemperature = (arguments) => { if (arguments[0] == device) { temperature = Arrays.Clone(arguments[1] as float[], temperature); } }; onReceiveImage = (arguments) => { if (arguments[0] == device) { image = Arrays.Clone(arguments[1] as byte[], image); } }; return(base.Initialize(arguments)); }
public override ARESULT Initialize(Dictionary <string, object> arguments) { // TODO: delete 读取配置信息 configuration = Repository.Repository.LoadConfiguation(); cell = arguments["cell"] as CellService; device = arguments["device"] as IDevice; device.Handler += OnDeviceEvent; // 读取配置信息 if (!device.Read(ReadMode.IrCameraParameters, null, out object outData, out _)) { return(ARESULT.E_INVALIDARG); } irCameraParameters = outData as Configuration.IrCameraParameters; // 声明事件处理函数 onReceiveTemperature = (args) => { if ((args[0] == cell) && (args[1] == device)) { temperature = Arrays.Clone(args[2] as PinnedBuffer <float>, temperature, sizeof(float)); } }; onReceiveIrImage = (args) => { if ((args[0] == cell) && (args[1] == device)) { irImage = Arrays.Clone(args[2] as PinnedBuffer <byte>, irImage, sizeof(byte)); } }; onReceiveImage = (args) => { if ((args[0] == cell) && (args[1] == device)) { image = Arrays.Clone(args[2] as PinnedBuffer <byte>, image, sizeof(byte)); } }; onAlarm = (args) => { if ((args[0] == cell) && (args[1] == device)) { OnAlarm(args); } }; return(base.Initialize(arguments)); }
public override ARESULT Initialize(Dictionary <string, object> arguments) { device = arguments["device"] as IDevice; uri = arguments["uri"] as string; width = (int)arguments["width"]; height = (int)arguments["height"]; frameRate = (int)arguments["frameRate"]; eventName = arguments["eventName"] as string; duration = 1000 / frameRate; onReceiveImage = (arguments) => { if (arguments[0] == device) { image = Arrays.Clone(arguments[1] as byte[], image); } }; return(base.Initialize(arguments)); }
public override ARESULT Initialize(Dictionary <string, object> arguments) { cell = arguments["cell"] as CellService; device = arguments["device"] as IDevice; uri = arguments["uri"] as string; width = (int)arguments["width"]; height = (int)arguments["height"]; frameRate = (int)arguments["frameRate"]; eventName = arguments["eventName"] as string; duration = 1000 / frameRate; onReceiveImage = (args) => { if ((args[0] == cell) && (args[1] == device)) { image = Arrays.Clone(args[2] as PinnedBuffer <byte>, image, sizeof(byte)); } }; return(base.Initialize(arguments)); }