public void Create(string name, bool force) { string addr = "AK_" + name; deviceHS = controller.GetHSDeviceByAddress(addr, out bool created, create: true, name: name); RefId = deviceHS.get_Ref(null); if (created) { DeviceTypeInfo_m.DeviceTypeInfo DT = new DeviceTypeInfo_m.DeviceTypeInfo(); DT.Device_API = DeviceTypeInfo_m.DeviceTypeInfo.eDeviceAPI.Security; DT.Device_Type = (int)DeviceTypeInfo_m.DeviceTypeInfo.eDeviceAPI.Plug_In; deviceHS.set_DeviceType_Set(hs, DT); deviceHS.set_InterfaceInstance(hs, ""); deviceHS.set_Status_Support(hs, false);//Set to True if the devices can be polled, false if not deviceHS.MISC_Set(hs, Enums.dvMISC.SHOW_VALUES); deviceHS.MISC_Set(hs, Enums.dvMISC.NO_LOG); Interface = controller.plugin.Name; Type = "Virtual"; Address = addr; //Location = "EnOcean"; //Location2 = "EnOcean"; //LastChange = DateTime.Now; } controller.UsedDevices[RefId] = this; }
public bool Create(string name, bool force, string type = "Virtual", eDeviceAPI Device_API = eDeviceAPI.Plug_In, int Device_Type = (int)eDeviceAPI.Plug_In, int Device_SubType = 0, string Device_SubType_Description = "" ) { string addr = ADDR_PREFIX + name; deviceHS = controller.GetHSDeviceByAddress(addr, out bool created, create: true, name: name); RefId = deviceHS.get_Ref(null); if (created) { DeviceTypeInfo_m.DeviceTypeInfo DT = new DeviceTypeInfo_m.DeviceTypeInfo() { Device_API = Device_API, Device_Type = Device_Type, Device_SubType = Device_SubType, Device_SubType_Description = Device_SubType_Description }; deviceHS.set_DeviceType_Set(hs, DT); deviceHS.set_InterfaceInstance(hs, ""); deviceHS.set_Status_Support(hs, false);//Set to True if the devices can be polled, false if not deviceHS.MISC_Set(hs, Enums.dvMISC.SHOW_VALUES | Enums.dvMISC.NO_LOG); deviceHS.MISC_Clear(hs, Enums.dvMISC.AUTO_VOICE_COMMAND); Interface = controller.plugin.Name; Type = type; Address = addr; //Location = "EnOcean"; //Location2 = "EnOcean"; //LastChange = DateTime.Now; } controller.UsedDevices[RefId] = this; return(created); }