fr.velossity.sample.device.Device.getIdentifier()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中fr.velossity.sample.device.Device.getIdentifier()方法的一些代码示例,展示了Device.getIdentifier()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Device.getIdentifier()方法的具体详情如下:
包路径:fr.velossity.sample.device.Device
类名称:Device
方法名:getIdentifier

Device.getIdentifier介绍

暂无

代码示例

代码示例来源:origin: fr.velossity.osgi/SCRServiceRequester

  1. /**
  2. * SCR callback, called when new device is registered.
  3. */
  4. public void addProvider(Device newDevice) {
  5. System.out.println("I found a mock device with identifer= " + newDevice.getIdentifier());
  6. }

代码示例来源:origin: fr.velossity.osgi/SCRServiceRequester

  1. /**
  2. * SCR callback, called when device is disappearing.
  3. */
  4. public void removeProvider(Device theDevice) {
  5. System.out.println("Mock device [" + theDevice.getIdentifier() + "] is unregistering");
  6. }

代码示例来源:origin: fr.velossity.osgi/ExtenderServiceRequester

  1. /**
  2. * @see DeviceHandler#handle(Device)
  3. */
  4. public void handle(Device newDevice) {
  5. System.out.println("I found a mock device with identifer= " + newDevice.getIdentifier());
  6. }

代码示例来源:origin: fr.velossity.osgi/ExtenderServiceRequester

  1. /**
  2. * @see DeviceHandler#free(Device)
  3. */
  4. public void free(Device aDevice) {
  5. System.out.println("Mock device [" + aDevice.getIdentifier() + "] is unregistering");
  6. }

代码示例来源:origin: fr.velossity.osgi/iPOJOServiceRequester

  1. /**
  2. * iPOJO callback, called when new device is registered.
  3. */
  4. public void addProvider(Device newDevice) {
  5. System.out.println("I found a mock device with identifer= " + newDevice.getIdentifier());
  6. }

代码示例来源:origin: fr.velossity.osgi/iPOJOServiceRequester

  1. /**
  2. * iPOJO callback, called when device is disappearing.
  3. */
  4. public void removeProvider(Device theDevice) {
  5. System.out.println("Mock device [" + theDevice.getIdentifier() + "] is unregistering");
  6. }
  7. }

代码示例来源:origin: fr.velossity.osgi/ServiceAPI4EAStep4

  1. private static Dictionary<String, Object> setProperties(Device source, float value,
  2. String unit, long timestamp) {
  3. Dictionary<String, Object> dico = new Hashtable<String, Object>();
  4. dico.put("identifier", source.getIdentifier());
  5. dico.put("source", source);
  6. dico.put("value", Float.toString(value));
  7. dico.put("unit", unit);
  8. dico.put("timestamp", Long.toString(timestamp));
  9. return dico;
  10. }

代码示例来源:origin: fr.velossity.osgi/ServiceProvider1

  1. /**
  2. * @see BundleActivator#start(BundleContext)
  3. */
  4. public void start(BundleContext context) throws Exception {
  5. // Set meta-data properties for the device
  6. Dictionary<String, String> properties = new Hashtable<String, String>();
  7. properties.put(Device.DEVICE_PROPERTY_IDENTIFIER, myDevice.getIdentifier());
  8. properties.put(Device.DEVICE_PROPERTY_TYPE, myDevice.getType());
  9. // PUBLISHES the Device service
  10. context.registerService(Device.class, myDevice, properties);
  11. }

代码示例来源:origin: fr.velossity.osgi/ServiceProvider2

  1. /**
  2. * @see BundleActivator#start(BundleContext)
  3. */
  4. public void start(BundleContext context) throws Exception {
  5. // Set meta-data properties for the device
  6. Dictionary<String, String> properties = new Hashtable<String, String>();
  7. properties.put(Device.DEVICE_PROPERTY_IDENTIFIER, myDevice.getIdentifier());
  8. properties.put(Device.DEVICE_PROPERTY_TYPE, myDevice.getType());
  9. // PUBLISHES the Device service
  10. context.registerService(Device.class, myDevice, properties);
  11. }

代码示例来源:origin: fr.velossity.osgi/ServiceRequester1

  1. /**
  2. * @see BundleActivator#start(BundleContext)
  3. */
  4. public void start(BundleContext context) throws Exception {
  5. // REQUESTS a service implementing a Device service of type Mock
  6. Collection<ServiceReference<Device>> sr = context.getServiceReferences(Device.class, "(type=Mock)");
  7. if(sr != null && !sr.isEmpty()) {
  8. // BINDS to the service provider
  9. Device myDevice = context.getService(sr.iterator().next());
  10. // INVOKES the service
  11. System.out.println("I found a mock device with identifer= " + myDevice.getIdentifier());
  12. } else {
  13. System.out.println("I found no mock device at that time");
  14. } }

代码示例来源:origin: fr.velossity.osgi/ServiceRequester2

  1. /**
  2. * @see BundleActivator#start(BundleContext)
  3. */
  4. public void start(BundleContext context) throws Exception {
  5. myContext = context;
  6. // Adds itself as a Registry listener for OSGi services
  7. context.addServiceListener(this, "(" + Constants.OBJECTCLASS + "=" + Device.class.getName() + ")");
  8. // REQUESTS a service implementing a Device service of type Mock
  9. Collection<ServiceReference<Device>> sr = context.getServiceReferences(Device.class, "(type=Mock)");
  10. if(sr != null && !sr.isEmpty()) {
  11. // BINDS to the service provider
  12. Device myDevice = context.getService(sr.iterator().next());
  13. // INVOKES the service
  14. System.out.println("I found a mock device with identifer= " + myDevice.getIdentifier());
  15. } else {
  16. System.out.println("I found no mock device at that time");
  17. }
  18. }

代码示例来源:origin: fr.velossity.osgi/NativeAdapter

  1. /**
  2. * @see ServiceTracker#addingService(ServiceReference)
  3. */
  4. public ServiceRegistration<Device> addingService(ServiceReference<AdapteeDevice> ref) {
  5. AdapteeDevice adaptee = context.getService(ref);
  6. Device adapter = new DeviceAdapterImpl(adaptee);
  7. // REGISTERS with mandatory properties
  8. Dictionary<String, String> properties = new Hashtable<String, String>();
  9. properties.put(Device.DEVICE_PROPERTY_IDENTIFIER, adapter.getIdentifier());
  10. properties.put(Device.DEVICE_PROPERTY_TYPE, adapter.getType());
  11. return context.registerService(Device.class, adapter, properties);
  12. }

代码示例来源:origin: fr.velossity.osgi/ServiceAPI4EAStep4

  1. public Measurement(Device source, float value, String unit, long timestamp) {
  2. super("fr/velossity/measures/" + source.getIdentifier() , setProperties(source, value, unit, timestamp));
  3. }

代码示例来源:origin: fr.velossity.osgi/ServiceRequester2

  1. /**
  2. * NOTIFICATION for device services.
  3. * OSGi callback to be notified of providers arrival and departure.
  4. * @see ServiceListener#serviceChanged(ServiceEvent)
  5. */
  6. public void serviceChanged(ServiceEvent event) {
  7. ServiceReference<?> sr = event.getServiceReference();
  8. // BINDS to the service provider
  9. Device myDevice = (Device) myContext.getService(sr);
  10. if(event.getType() == ServiceEvent.REGISTERED) {
  11. // INVOKES the service
  12. System.out.println("I found a mock device with identifer= " + myDevice.getIdentifier());
  13. }
  14. if(event.getType() == ServiceEvent.UNREGISTERING) {
  15. // INVOKES the service
  16. System.out.println("Mock device [" + myDevice.getIdentifier() + "] is unregistering");
  17. }
  18. }

代码示例来源:origin: fr.velossity.osgi/iPOJOConsumerWB

  1. /**
  2. * @see MeasurementHandler#newMeasure(Measurement)
  3. */
  4. public void newMeasure(final Measurement measurement) {
  5. System.out.println("New measure [" + measurement.getSource().getIdentifier() + "]= " + measurement.getValue() + " " + measurement.getUnit());
  6. }

代码示例来源:origin: fr.velossity.osgi/iPOJOConsumerAP

  1. /**
  2. * Just echoing the measurement to the console.
  3. */
  4. private void newMeasure(final Measurement measurement) {
  5. if(measurement != null) { // It can be null if the Producer service is declared before setting the measurement
  6. System.out.println("New measure [" + measurement.getSource().getIdentifier() + "]= " + measurement.getValue() + " " + measurement.getUnit());
  7. }
  8. }
  9. }

代码示例来源:origin: fr.velossity.osgi/ConsumerEL

  1. /**
  2. * @see MeasurementListener#newMeasure(Measurement)
  3. */
  4. public void newMeasure(final Measurement measurement) {
  5. System.out.println("New measure [" + measurement.getSource().getIdentifier() + "]= " + measurement.getValue() + " " + measurement.getUnit());
  6. }

相关文章