BS2OsdpStandardDeviceAdd addDevice = Util.AllocateStructure(); Util.HighlightLine(">>>> Now add a OSDP device.", "add"); addDevice.deviceID = Util.GetInputSlaveID(); UInt32 channelIndex = 0; for (int idx = 0; idx < allDevice.numOfChannel; idx++) { for (int didx = 0; didx < allDevice.channels[idx].numOsdpAvailableDevice; didx++) { if (allDevice.channels[idx].deviceIDs[didx] == addDevice.deviceID) channelIndex = allDevice.channels[idx].channelIndex; } } Util.HighlightLine(">>>> Please enter the OSDP ID. [0 ~ 126]", "OSDP ID"); Console.Write(">>>> "); addDevice.osdpID = Util.GetInput((byte)0); Util.HighlightLine(">>>> Does the OSDP device use secure communication? [Y/n]", "use secure communication"); Console.Write(">>>> "); addDevice.useSecureSession = Convert.ToByte(Util.IsYes()); addDevice.deviceType = Convert.ToByte(BS2DeviceTypeEnum.THIRD_OSDP_DEVICE); addDevice.activate = Convert.ToByte(true); UInt32 outChannelIndex = 0; BS2ErrorCode result = (BS2ErrorCode)API.BS2_AddOsdpStandardDevice(sdkContext, deviceID, channelIndex, ref addDevice, out outChannelIndex); if (result != BS2ErrorCode.BS_SDK_SUCCESS) Console.WriteLine("Got error({0}).", result); else Console.WriteLine("Call success."); return result;