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 Details

    • DefaultServerDeviceSupplier

      public DefaultServerDeviceSupplier()
      初始化服务端发送方设备信息
  • Method Details

    • initializeServerFromDevice

      public void initializeServerFromDevice()
      初始化服务端发送方设备信息 基于配置属性创建服务端设备
    • getDevice

      public Device getDevice(String userId)
      Description copied from interface: DeviceSupplier
      根据用户ID获取指定设备 这是设备获取的核心方法,业务方通过userId获取设备数据
      Specified by:
      getDevice in interface DeviceSupplier
      Parameters:
      userId - 用户ID
      Returns:
      设备信息,如果不存在则返回null
    • getServerFromDevice

      public FromDevice getServerFromDevice()
      Description copied from interface: ServerDeviceSupplier
      获取服务端发送方设备信息 用于服务端发送SIP消息时标识发送方设备
      Specified by:
      getServerFromDevice in interface ServerDeviceSupplier
      Returns:
      服务端发送方设备信息,如果不存在则返回null
    • setServerFromDevice

      public void setServerFromDevice(FromDevice fromDevice)
      Description copied from interface: ServerDeviceSupplier
      设置服务端发送方设备信息 用于配置服务端的发送方设备标识
      Specified by:
      setServerFromDevice in interface ServerDeviceSupplier
      Parameters:
      fromDevice - 服务端发送方设备信息
    • getName

      public String getName()
      Description copied from interface: DeviceSupplier
      获取设备提供器的名称标识
      Specified by:
      getName in interface DeviceSupplier
      Returns:
      提供器名称
    • clearAllDevices

      public void clearAllDevices()
      清空所有设备
    • containsDevice

      public boolean containsDevice(String userId)
      检查设备是否存在
      Parameters:
      userId - 用户ID
      Returns:
      是否存在