public static Tuple <RobotInfo, LocalIdentifierLocks> LoadRobotInfoYamlWithIdentifierLocks(YamlRobotInfo yaml_robot_info)
        {
            var robot_info = yaml_robot_info.ToRRInfo();
            LocalIdentifierLocks ident_locks = null;

            if (robot_info.device_info != null && robot_info.device_info.device != null &&
                !String.IsNullOrEmpty(robot_info.device_info.device.name) &&
                robot_info.device_info.device.uuid.uuid_bytes.All(x => x == 0))
            {
                var l = LocalIdentifiersManager.GetIdentifierForNameAndLock("robot", robot_info.device_info.device.name);
                robot_info.device_info.device.uuid = l.Identifier.uuid;
                ident_locks = new LocalIdentifierLocks(l);
            }
            return(Tuple.Create <RobotInfo, LocalIdentifierLocks>(robot_info, ident_locks));
        }
Esempio n. 2
0
        public static Tuple <ToolInfo, LocalIdentifierLocks> LoadToolInfoYamlWithIdentifierLocks(YamlToolInfo yaml_tool_info, string device_name_override = null)
        {
            var tool_info = yaml_tool_info.ToRRInfo();

            if (tool_info.device_info != null && device_name_override != null)
            {
                tool_info.device_info.device = IdentifierUtil.CreateIdentifierFromName(device_name_override);
            }
            LocalIdentifierLocks ident_locks = null;

            if (tool_info.device_info != null && tool_info.device_info.device != null &&
                !String.IsNullOrEmpty(tool_info.device_info.device.name) &&
                tool_info.device_info.device.uuid.uuid_bytes.All(x => x == 0))
            {
                var l = LocalIdentifiersManager.GetIdentifierForNameAndLock("tool", tool_info.device_info.device.name);
                tool_info.device_info.device.uuid = l.Identifier.uuid;
                ident_locks = new LocalIdentifierLocks(l);
            }
            return(Tuple.Create <ToolInfo, LocalIdentifierLocks>(tool_info, ident_locks));
        }