Class DefaultServerDeviceSupplier
java.lang.Object
io.github.lunasaw.gbproxy.server.service.DefaultServerDeviceSupplier
- All Implemented Interfaces:
DeviceSupplier
,ServerDeviceSupplier
@Service
@ConditionalOnMissingBean(ServerDeviceSupplier.class)
public class DefaultServerDeviceSupplier
extends Object
implements ServerDeviceSupplier
服务端设备提供器默认实现
基于Gb28181ServerProperties配置的服务端设备管理
设计原则: 1. 线程安全的设备管理 2. 基于配置的服务端设备初始化 3. 支持动态设备添加和移除 4. 自动生成服务端发送方设备信息
- Author:
- luna
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
清空所有设备boolean
containsDevice
(String userId) 检查设备是否存在根据用户ID获取指定设备 这是设备获取的核心方法,业务方通过userId获取设备数据getName()
获取设备提供器的名称标识获取服务端发送方设备信息 用于服务端发送SIP消息时标识发送方设备void
初始化服务端发送方设备信息 基于配置属性创建服务端设备void
setServerFromDevice
(FromDevice fromDevice) 设置服务端发送方设备信息 用于配置服务端的发送方设备标识Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.lunasaw.sip.common.service.DeviceSupplier
getToDevice, getToDevice
Methods inherited from interface io.github.lunasaw.sip.common.service.ServerDeviceSupplier
checkDevice
-
Constructor Details
-
DefaultServerDeviceSupplier
public DefaultServerDeviceSupplier()初始化服务端发送方设备信息
-
-
Method Details
-
initializeServerFromDevice
public void initializeServerFromDevice()初始化服务端发送方设备信息 基于配置属性创建服务端设备 -
getDevice
Description copied from interface:DeviceSupplier
根据用户ID获取指定设备 这是设备获取的核心方法,业务方通过userId获取设备数据- Specified by:
getDevice
in interfaceDeviceSupplier
- Parameters:
userId
- 用户ID- Returns:
- 设备信息,如果不存在则返回null
-
getServerFromDevice
Description copied from interface:ServerDeviceSupplier
获取服务端发送方设备信息 用于服务端发送SIP消息时标识发送方设备- Specified by:
getServerFromDevice
in interfaceServerDeviceSupplier
- Returns:
- 服务端发送方设备信息,如果不存在则返回null
-
setServerFromDevice
Description copied from interface:ServerDeviceSupplier
设置服务端发送方设备信息 用于配置服务端的发送方设备标识- Specified by:
setServerFromDevice
in interfaceServerDeviceSupplier
- Parameters:
fromDevice
- 服务端发送方设备信息
-
getName
Description copied from interface:DeviceSupplier
获取设备提供器的名称标识- Specified by:
getName
in interfaceDeviceSupplier
- Returns:
- 提供器名称
-
clearAllDevices
public void clearAllDevices()清空所有设备 -
containsDevice
检查设备是否存在- Parameters:
userId
- 用户ID- Returns:
- 是否存在
-