Search in sources :

Example 1 with DeviceIdentity

use of org.fourthline.cling.model.meta.DeviceIdentity in project BeyondUPnP by kevinshine.

the class BeyondUpnpService method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    //Create LocalDevice
    LocalService localService = new AnnotationLocalServiceBinder().read(BeyondContentDirectoryService.class);
    localService.setManager(new DefaultServiceManager<>(localService, BeyondContentDirectoryService.class));
    String macAddress = Utils.getMACAddress(Utils.WLAN0);
    //Generate UUID by MAC address
    UDN udn = UDN.valueOf(UUID.nameUUIDFromBytes(macAddress.getBytes()).toString());
    try {
        mLocalDevice = new LocalDevice(new DeviceIdentity(udn), new UDADeviceType("MediaServer"), new DeviceDetails("Local Media Server"), new LocalService[] { localService });
    } catch (ValidationException e) {
        e.printStackTrace();
    }
    upnpService.getRegistry().addDevice(mLocalDevice);
    //LocalBinder instead of binder
    binder = new LocalBinder();
}
Also used : BeyondContentDirectoryService(com.kevinshen.beyondupnp.core.upnp.BeyondContentDirectoryService) DeviceIdentity(org.fourthline.cling.model.meta.DeviceIdentity) DeviceDetails(org.fourthline.cling.model.meta.DeviceDetails) ValidationException(org.fourthline.cling.model.ValidationException) LocalDevice(org.fourthline.cling.model.meta.LocalDevice) UDADeviceType(org.fourthline.cling.model.types.UDADeviceType) LocalService(org.fourthline.cling.model.meta.LocalService) AnnotationLocalServiceBinder(org.fourthline.cling.binding.annotations.AnnotationLocalServiceBinder) UDN(org.fourthline.cling.model.types.UDN)

Aggregations

BeyondContentDirectoryService (com.kevinshen.beyondupnp.core.upnp.BeyondContentDirectoryService)1 AnnotationLocalServiceBinder (org.fourthline.cling.binding.annotations.AnnotationLocalServiceBinder)1 ValidationException (org.fourthline.cling.model.ValidationException)1 DeviceDetails (org.fourthline.cling.model.meta.DeviceDetails)1 DeviceIdentity (org.fourthline.cling.model.meta.DeviceIdentity)1 LocalDevice (org.fourthline.cling.model.meta.LocalDevice)1 LocalService (org.fourthline.cling.model.meta.LocalService)1 UDADeviceType (org.fourthline.cling.model.types.UDADeviceType)1 UDN (org.fourthline.cling.model.types.UDN)1