BS2OsdpStandardActionConfig config; bool activate = false; for (int idx = 0; idx < (int)BS2OsdpStandardActionType.COUNT; idx++) { Console.WriteLine("Do you want to modify the {0} action type? [Y/n]", (BS2OsdpStandardActionType)config.actions[idx].actionType); Console.Write(">> "); if (Util.IsYes()) { for (int ledidx = 0; ledidx < BS2Environment.BS2_OSDP_STANDARD_ACTION_MAX_LED; ledidx++) { string tempStr = String.Format("LED#{0}", ledidx); string msgStr = String.Format("Do you want to activate for {0} action? [Y/n]", tempStr); Util.HighlightLine(msgStr, tempStr); Console.Write(">> "); activate = Util.IsYes(); config.actions[idx].led[ledidx].use = Convert.ToByte(activate); if (activate) { Util.HighlightLine(" Please enter your reader number. Default(0).", "reader number"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].readerNumber = Util.GetInput((byte)0); Util.HighlightLine(" Please enter a led number of the reader. Default(0).", "led number"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].ledNumber = Util.GetInput((byte)0); Util.HighlightLine(" Please enter a temporary command (0: NOP, 1: Cancel, 2: Set)", "temporary command"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].tempCommand = Util.GetInput((byte)BS2OsdpStandardLEDCommand.NOP); Util.HighlightLine(" Please enter the temporary command on time in ms.", "on time"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].tempOnTime = Util.GetInput((byte)10); Util.HighlightLine(" Please enter the temporary command off time in ms.", "off time"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].tempOffTime = Util.GetInput((byte)0); Util.HighlightLine(" Please enter the temporary command on color. (0: Black, 1: Red, 2: Green, 3: Amber, 4: Blue, 5: Magenta, 6: Cyan, 7: White)", "on color"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].tempOnColor = Util.GetInput((byte)BS2OsdpStandardColor.GREEN); Util.HighlightLine(" Please enter the temporary command off color. (0: Black, 1: Red, 2: Green, 3: Amber, 4: Blue, 5: Magenta, 6: Cyan, 7: White)", "off color"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].tempOffColor = Util.GetInput((byte)BS2OsdpStandardColor.BLACK); Util.HighlightLine(" Please enter the temporary run time in ms.", "run time"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].tempRunTime = Util.GetInput((UInt16)10); Util.HighlightLine(" Please enter a permanent command (0: NOP, 1: Cancel, 2: Set)", "permanent command"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].permCommand = Util.GetInput((byte)BS2OsdpStandardLEDCommand.NOP); Util.HighlightLine(" Please enter the permanent on time in ms.", "on time"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].permOnTime = Util.GetInput((byte)0); Util.HighlightLine(" Please enter the permanent off time in ms.", "off time"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].permOffTime = Util.GetInput((byte)0); Util.HighlightLine(" Please enter the permanent on color. (0: Black, 1: Red, 2: Green, 3: Amber, 4: Blue, 5: Magenta, 6: Cyan, 7: White)", "on color"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].permOnColor = Util.GetInput((byte)BS2OsdpStandardColor.BLACK); Util.HighlightLine(" Please enter the permanent off color. (0: Black, 1: Red, 2: Green, 3: Amber, 4: Blue, 5: Magenta, 6: Cyan, 7: White)", "off color"); Console.Write(" >>>> "); config.actions[idx].led[ledidx].permOffColor = Util.GetInput((byte)BS2OsdpStandardColor.BLACK); } } Util.HighlightLine("Do you want to activate for buzzer action? [Y/n]", "buzzer"); Console.Write(">> "); activate = Util.IsYes(); config.actions[idx].buzzer.use = Convert.ToByte(activate); if (activate) { Util.HighlightLine(" Please enter your reader number. Default(0).", "reader number"); Console.Write(" >>>> "); config.actions[idx].buzzer.readerNumber = Util.GetInput((byte)0); Util.HighlightLine(" Please enter a tone type (0: None, 1: Off, 2: On)", "tone"); Console.Write(" >>>> "); config.actions[idx].buzzer.tone = Util.GetInput((byte)BS2OsdpStandardTone.ON); Util.HighlightLine(" Please enter the buzzer turn-on time in ms.", "on time"); Console.Write(" >>>> "); config.actions[idx].buzzer.onTime = Util.GetInput((byte)2); Util.HighlightLine(" Please enter the buzzer turn-off time in ms.", "off time"); Console.Write(" >>>> "); config.actions[idx].buzzer.offTime = Util.GetInput((byte)0); Util.HighlightLine(" Please enter the number of cycle the buzzer on and off.", "number of cycle"); Console.Write(" >>>> "); config.actions[idx].buzzer.numOfCycle = Util.GetInput((byte)1); } } } Console.WriteLine("Trying to set OsdpStandardActionConfig"); BS2ErrorCode result = (BS2ErrorCode)API.BS2_SetOsdpStandardActionConfig(sdkContext, deviceID, ref config); if (result != BS2ErrorCode.BS_SDK_SUCCESS) Console.WriteLine("Got error({0}).", result); else Console.WriteLine("Call success."); return result;