device

package
v2.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the Device API client

func New

func New(webexClient *webexsdk.Client, config *Config) *Client

New creates a new Device plugin

func (*Client) GetDevice

func (c *Client) GetDevice() DeviceDTO

GetDevice returns a copy of the current device data

func (*Client) GetDeviceURL

func (c *Client) GetDeviceURL() (string, error)

GetDeviceURL returns the device URL

func (*Client) GetWebSocketURL

func (c *Client) GetWebSocketURL() (string, error)

GetWebSocketURL returns the WebSocket URL for Mercury connections

func (*Client) IsRegistered

func (c *Client) IsRegistered() bool

IsRegistered returns true if the device is registered

func (*Client) OnRegistered

func (c *Client) OnRegistered(callback func())

OnRegistered registers a callback function to be called when the device is registered

func (*Client) Refresh

func (c *Client) Refresh() error

Refresh refreshes the device registration with the Webex service

func (*Client) Register

func (c *Client) Register() error

Register registers a device with Webex to get a WebSocket URL

func (*Client) Unregister

func (c *Client) Unregister() error

Unregister unregisters a device with Webex

func (*Client) WaitForRegistration

func (c *Client) WaitForRegistration(timeout time.Duration) error

WaitForRegistration waits for the device to be registered with a timeout

type Config

type Config struct {
	// Ephemeral determines if the device is temporary and should be refreshed
	Ephemeral bool
	// EphemeralDeviceTTL is the time to live for ephemeral devices in seconds
	EphemeralDeviceTTL int
	// DeviceType specifies the type of device
	DeviceType string
	// DefaultHeaders to include in requests
	DefaultHeaders map[string]string
	// DefaultBody to include in requests
	DefaultBody map[string]interface{}
	// WDMURL is the base URL for the Webex Device Management service.
	// Default: https://wdm-a.wbx2.com/wdm/api/v1/devices
	WDMURL string
}

Config holds the configuration for the Device plugin

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration for the Device plugin

type DeviceDTO

type DeviceDTO struct {
	URL                         string      `json:"url,omitempty"`                         // Device URL for refresh/unregister operations
	WebSocketURL                string      `json:"webSocketUrl,omitempty"`                // Mercury WebSocket URL for real-time events
	UserID                      string      `json:"userId,omitempty"`                      // Webex user ID associated with this device
	DeviceType                  string      `json:"deviceType,omitempty"`                  // Device type (e.g., "TEAMS_SDK_JS")
	IntranetInactivityDuration  int         `json:"intranetInactivityDuration,omitempty"`  // Intranet inactivity timeout in seconds
	InNetworkInactivityDuration int         `json:"inNetworkInactivityDuration,omitempty"` // In-network inactivity timeout in seconds
	ModificationTime            string      `json:"modificationTime,omitempty"`            // Last modification timestamp
	Services                    interface{} `json:"services,omitempty"`                    // Service catalog (v1 format)
	ServiceHostMap              interface{} `json:"serviceHostMap,omitempty"`              // Service host catalog including Mobius endpoints
	WebFileShareControl         string      `json:"webFileShareControl,omitempty"`         // File sharing control setting
	ClientMessagingGiphy        string      `json:"clientMessagingGiphy,omitempty"`        // Giphy messaging setting
	ETag                        string      `json:"-"`                                     // HTTP ETag for conditional refresh requests
}

DeviceDTO represents the full device information returned by the WDM service. It captures all fields from the registration response, including service host mappings used for Mobius discovery and Mercury WebSocket URLs.

type DeviceResponse

type DeviceResponse struct {
	URL          string `json:"url"`
	WebSocketURL string `json:"webSocketUrl"`
}

DeviceResponse represents the response from the device registration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL