Lines Matching refs:node
141 """Set the volume of the given output node.
143 @param node_id: the id of the output node to be set the volume.
185 @returns: A dict containing information of each node.
195 field is a list of selected node IDs returned from Cras DBus API.
203 for node in nodes:
204 if node['Active']:
205 if node['IsInput']:
206 input_nodes.append(node['Id'])
208 output_nodes.append(node['Id'])
213 """Sets the selected output node volume.
251 """Determine if there is any node of node_type plugged.
257 Since Cras only reports the plugged node in GetNodes, we can
258 parse the return value to see if there is any node with the given type.
267 @param node_type: A str representing node type defined in CRAS_NODE_TYPES.
270 @returns: True if there is any node of node_type plugged. False otherwise.
278 # Cras node types reported from Cras DBus control API.
288 """Returns the pair of filtered output node types and input node types.
290 @param callback: A callback function which takes a node as input parameter
291 and filter the node based on its return value.
294 field is a list of node types defined in CRAS_NODE_TYPES,
301 for node in nodes:
302 if callback(node):
303 node_type = str(node['Type'])
306 'node type %s is not valid' % node_type)
307 if node['IsInput']:
315 """Returns the pair of active output node types and input node types.
318 field is a list of selected node types defined in CRAS_NODE_TYPES.
321 def is_selected(node):
322 """Checks if a node is selected.
324 A node is selected if its Active attribute is True.
326 @returns: True is a node is selected, False otherwise.
329 return node['Active']
335 """Returns the pair of plugged output node types and input node types.
338 field is a list of plugged node types defined in CRAS_NODE_TYPES.
341 def is_plugged(node):
342 """Checks if a node is plugged and is not unknown node.
344 Cras DBus API only reports plugged node, so every node reported by Cras
345 DBus API is plugged. However, we filter out UNKNOWN node here because
346 the existence of unknown node depends on the number of redundant
350 @returns: True if a node is plugged and is not an UNKNOWN node.
353 return node['Type'] != 'UNKNOWN'
359 """Sets selected node types.
361 @param output_node_types: A list of output node types. None to skip setting.
362 @param input_node_types: A list of input node types. None to skip setting.
376 """Sets one selected output node.
379 to select one output node.
381 @param node_type: A node type.
385 for node in nodes:
386 if node['IsInput']:
388 if node['Type'] == node_type:
389 set_active_output_node(node['Id'])
393 """Sets one selected input node.
396 to select one input node.
398 @param node_type: A node type.
402 for node in nodes:
403 if not node['IsInput']:
405 if node['Type'] == node_type:
406 set_active_input_node(node['Id'])
410 """Sets selected output node types.
413 to select one output node. Here we use add/remove active output node
416 @param types: A list of output node types.
420 for node in nodes:
421 if node['IsInput']:
423 if node['Type'] in types:
424 add_active_output_node(node['Id'])
425 elif node['Active']:
426 remove_active_output_node(node['Id'])
430 """Sets selected input node types.
433 to select one input node. Here we use add/remove active input node
436 @param types: A list of input node types.
440 for node in nodes:
441 if not node['IsInput']:
443 if node['Type'] in types:
444 add_active_input_node(node['Id'])
445 elif node['Active']:
446 remove_active_input_node(node['Id'])
450 """Sets one active input node.
452 @param node_id: node id.
459 """Sets one active output node.
461 @param node_id: node id.
468 """Adds an active output node.
470 @param node_id: node id.
477 """Adds an active input node.
479 @param node_id: node id.
486 """Removes an active output node.
488 @param node_id: node id.
495 """Removes an active input node.
497 @param node_id: node id.
504 """Gets node id from node type.
506 @param types: A node type defined in CRAS_NODE_TYPES.
507 @param is_input: True if the node is input. False otherwise.
509 @returns: A string for node id.
511 @raises: CrasUtilsError: if unique node id can not be found.
516 for node in nodes:
517 if node['Type'] == node_type and node['IsInput'] == is_input:
518 find_ids.append(node['Id'])
521 'Can not find unique node id from node type %s' % node_type)