@Service public class LiveStreamService extends java.lang.Object implements MQTTEventListener
Modifier and Type | Class and Description |
---|---|
static class |
LiveStreamService.NewSessionInformation
Holds information about the session.
|
Constructor and Description |
---|
LiveStreamService(MQTTService mqttService,
DeviceRepository deviceRepository) |
Modifier and Type | Method and Description |
---|---|
LiveStreamService.NewSessionInformation |
getNewSession(java.util.UUID deviceId)
Create a new session for communication with specific device.
|
int |
getNumberOfSessionsForDevice(java.util.UUID deviceID)
Counts active livestream sessions to specific device.
|
void |
onNewMessage(java.util.UUID deviceId,
byte[] payload)
Callback that handles incoming MQTT message.
|
@Autowired public LiveStreamService(MQTTService mqttService, DeviceRepository deviceRepository)
public LiveStreamService.NewSessionInformation getNewSession(java.util.UUID deviceId) throws com.fasterxml.jackson.core.JsonProcessingException, org.eclipse.paho.client.mqttv3.MqttException
deviceId
- device UUID to communicate withorg.eclipse.paho.client.mqttv3.MqttException
- if error occurs during communication with the camera devicecom.fasterxml.jackson.core.JsonProcessingException
- if error occurs serializing the message for the camera devicepublic int getNumberOfSessionsForDevice(java.util.UUID deviceID)
deviceID
- device UUID to count sessions forpublic void onNewMessage(java.util.UUID deviceId, byte[] payload) throws java.io.IOException
MQTTEventListener
onNewMessage
in interface MQTTEventListener
deviceId
- UUID to send the message topayload
- message contentjava.io.IOException