Get the topic name for a given item
@method getTopicFor
@param  {String}    device   Device Name
@param  {String}    property Property
@param  {String}    type     Type of topic (command or state)
@return {String}             MQTT Topic name
978491
function getTopicFor (device, property, type) {
    var tree = [config.mqtt.preface, device, property],
        suffix;

    if (type === TOPIC_COMMAND) {
        suffix = config.mqtt[SUFFIX_COMMAND];
    } else if (type === TOPIC_READ_STATE) {
        suffix = config.mqtt[SUFFIX_READ_STATE];
    } else if (type === TOPIC_WRITE_STATE) {
        suffix = config.mqtt[SUFFIX_WRITE_STATE];
    }

    if (suffix) {
        tree.push(suffix);
    }

    return tree.join('/');
}
123589
def get_devices(device_type: DeviceType) -> Iterator[str]:
    
    for device in BASE_PATH.iterdir():
        with open(str(Path(device, 'type'))) as type_file:
            if type_file.readline().strip() == device_type.value:
                yield device.name
1246239
def _get_devices(params):
    '''
    
    '''
    if 'id' not in params:
        raise CommandExecutionError("Parameter ID is required.")

    return type(params['id']) == int and [params['id']] \
           or [int(dev) for dev in params['id'].split(",")]
203504
public static String getProperty(String base, String property) {
		return getProperty(base, property, true);
	}
589133
def make_driveritem_deviceitem_devicename(device_name, condition='is', negate=False, preserve_case=False):
    
    document = 'DriverItem'
    search = 'DriverItem/DeviceItem/DeviceName'
    content_type = 'string'
    content = device_name
    ii_node = ioc_api.make_indicatoritem_node(condition, document, search, content_type, content,
                                              negate=negate, preserve_case=preserve_case)
    return ii_node
481748
public DbDatum getPipeProperty(String pipeName, String propertyName) throws DevFailed {
        DbPipe dbPipe = database.getDevicePipeProperties(deviceName, pipeName);
        DbDatum datum = dbPipe.getDatum(propertyName);
        if (datum==null) Except.throw_exception("TangoApi_PropertyNotFound",         "Property " + propertyName + " not found for pipe " + pipeName);
        return datum;
    }
153729
def get_device_type(device_type=0):
    """"""
    device_types = {
        0: "Unknown",
        1: "Classic - BR/EDR devices",
        2: "Low Energy - LE-only",
        3: "Dual Mode - BR/EDR/LE"
    }
    if device_type in [0, 1, 2, 3]:
        return_value = device_types[device_type]
    else:
        return_value = device_types[0]
    return return_value
266137
function queryProperties(props, nodeTypeStack, childIndexStack = [], text) {
  let stateId = 0
  for (let i = 0, {length} = nodeTypeStack; i < length; i++) {
    const nodeType = nodeTypeStack[i];
    const state = props.states[stateId];
    let found_transition = false;
    for (const transition of state.transitions) {
      if (
        (transition.type === nodeType) &&
        (transition.index == null || transition.index === childIndexStack[i]) &&
        (transition.text == null || new RegExp(transition.text).test(text))
      ) {
        stateId = transition.state_id;
        found_transition = true;
        break;
      }
    }
    if (!found_transition) {
      stateId = state.default_next_state_id
    }
    // console.log(
    //   nodeType, '->', stateId,
    //   props.property_sets[props.states[stateId].property_set_id]
    // );
  }
  return props.property_sets[props.states[stateId].property_set_id]
}
548604
public static DeviceType getDevice(final Request request) {
		if (request instanceof ServletRequest) {
			return getDevice(((ServletRequest) request).getBackingRequest());
		}
		return DeviceType.NORMAL;
	}
388672
public DbDatum getDevicePipeProperty(String deviceName, String pipeName, String propertyName) throws DevFailed {
        DbPipe dbPipe = databaseDAO.getDevicePipeProperties(this, deviceName, pipeName);
        DbDatum datum = dbPipe.getDatum(propertyName);
        if (datum==null)
            Except.throw_exception("TangoApi_PropertyNotFound",
                    "Property " + propertyName + " not found for pipe " + pipeName);
        return datum;
    }
161219
def get_property(self, index, doctype, name):
        

        return self.indices[index][doctype].properties[name]
1296619
function getPropInfo (name, prop) {
  if (!prop) {
    return null;
  }

  var hasProps = 'properties' in prop;

  var valueType = 'type' in prop ? 'type' :
                  'arrayType' in prop ? 'arrayType' :
                  'keyType' in prop ? 'keyType' :
                  hasProps ? 'type' :
                  null;

  var type = hasProps ? Object : prop[valueType];

  if (!type) {
    return null;
  }

  var description = prop.description;
  if (typeof description === 'string') {
    description = description.split(EOL);
  }

  var info = {
    name: name,
    type: type,
    hasProps: hasProps,
    valueType: valueType,
    valueTypeText: VALUE_TYPE_TEXT[valueType],
    description: description || []
  };

  Object.keys(prop).reduce(function(x, key){
    if (!~SKIP_COPY.indexOf(key)) {
      x[key] = prop[key];
    }
    return x;
  }, info);

  return info;
}
403854
function getPortPath(port, callback) {
  if (port.type=="path") callback(port.name);
  else if (port.type=="name") {
    log("Searching for device named "+JSON.stringify(port.name));
    var searchString = port.name.toLowerCase();
    var timeout = 2;
    Espruino.Core.Serial.getPorts(function cb(ports, shouldCallAgain) {
      //log(JSON.stringify(ports,null,2));
      var found = ports.find(function(p) { return p.description && p.description.toLowerCase().indexOf(searchString)>=0; });
      if (found) {
        log("Found "+JSON.stringify(found.description)+" ("+JSON.stringify(found.path)+")");
        callback(found.path);
      } else {
        if (timeout-- > 0 && shouldCallAgain) // try again - sometimes BLE devices take a while
          Espruino.Core.Serial.getPorts(cb);
        else {
         log("Port named "+JSON.stringify(port.name)+" not found");
         process.exit(1);
       }
      }
    });
  } else throw new Error("Unknown port type! "+JSON.stringify(port));
}
1252929
def property(contractid, groupid, propertyid)
      begin
        property_hash = @client.get_json_body(
          "/papi/v0/properties/#{propertyid}",
          { 'contractId' => contractid, 'groupId' => groupid, },
        )
      rescue
        puts "# unable to retrieve property for (group=#{groupid},contract=#{contractid},property=#{propertyid}): #{e.message}"
      end
      Property.new property_hash['properties']['items'].first
    end
371477
public Device registerDevice(UUID deviceId, Map<String, Object> properties) {
        assertValidApplicationId();
        if (properties == null) {
            properties = new HashMap<String, Object>();
        }
        properties.put("refreshed", System.currentTimeMillis());
        ApiResponse response = apiRequest(HttpMethod.PUT, null, properties,
                organizationId, applicationId, "devices", deviceId.toString());
        return response.getFirstEntity(Device.class);
    }
365462
private TopicWrapper getTopicForNewTopicNode(final DataProviderFactory providerFactory, final ITopicNode topicNode) {
        LOG.debug("Creating a new topic");

        final TopicProvider topicProvider = providerFactory.getProvider(TopicProvider.class);
        final TagProvider tagProvider = providerFactory.getProvider(TagProvider.class);
        final PropertyTagProvider propertyTagProvider = providerFactory.getProvider(PropertyTagProvider.class);

        // Create the topic entity.
        final TopicWrapper topic = topicProvider.newTopic();

        // Set the basics
        if (topicNode instanceof SpecTopic) {
            topic.setTitle(((SpecTopic) topicNode).getTitle());
        } else {
            topic.setTitle("Info");
        }
        topic.setDescription(topicNode.getDescription(true));
        topic.setXml("");

        // Write the type
        final TagWrapper tag;
        if (topicNode instanceof SpecTopic) {
            tag = tagProvider.getTagByName(((SpecTopic) topicNode).getType());
        } else {
            tag = tagProvider.getTag(serverEntities.getInfoTagId());
        }
        if (tag == null) {
            log.error(String.format(ProcessorConstants.ERROR_TYPE_NONEXIST_MSG, topicNode.getLineNumber(), topicNode.getText()));
            return null;
        }

        // Add the type to the topic
        topic.setTags(tagProvider.newTagCollection());
        topic.getTags().addNewItem(tag);

        // Add the added by property tag
        topic.setProperties(propertyTagProvider.newPropertyTagInTopicCollection(topic));
        final String assignedWriter = topicNode.getAssignedWriter(true);
        if (assignedWriter != null) {
            final PropertyTagWrapper addedByPropertyTag = propertyTagProvider.getPropertyTag(serverEntities.getAddedByPropertyTagId());
            final PropertyTagInTopicWrapper addedByProperty = propertyTagProvider.newPropertyTagInTopic(addedByPropertyTag, topic);
            addedByProperty.setValue(assignedWriter);
            topic.getProperties().addNewItem(addedByProperty);
        }

        return topic;
    }
157345
public static DeviceType getDevice(final HttpServletRequest request) {
		// User agent
		String userAgent = ((HttpServletRequest) request).getHeader("User-Agent");
		if (Util.empty(userAgent)) {
			LOG.warn("No User-Agent details in the request headers. Will assume normal device.");
			return DeviceType.NORMAL;
		}

		// Check for device type
		UAgentInfo agentInfo = new UAgentInfo(userAgent, null);
		if (agentInfo.detectMobileQuick()) {
			return DeviceType.MOBILE;
		} else if (agentInfo.detectTierTablet()) {
			return DeviceType.TABLET;
		}
		return DeviceType.NORMAL;
	}