Skip to content

ICallContext

Interface in Oadm.Sdk.Plugins · Oadm.Sdk.dll

The user’s call of a plugin method (SDK 0.4.0, OADM 4.5): who calls, what the role allows, and the devices the user may reach. A user can be limited to a device group; ICallContext.Devices, ICallContext.Vapix, ICallContext.Tasks and ICallContext.EventStreams see only the devices of that group. Device ids outside it are treated like unknown ids: IDeviceRepository.FindAsync answers null, the others throw DevicesNotAvailableException (the host answers NOT_FOUND, “N devices are no longer available.”) and nothing runs.

public interface ICallContext

Guide: Device groups and the call context

During the call of a user with a device group, the context’s own ctx.Devices, ctx.Vapix, ctx.Tasks and ctx.EventStreams refuse (fail closed): use the call. Background work never carries a user; work a method starts for the user goes through ICorePluginContext.Jobs, which keeps the owner’s call.

string DeviceScopeKey { get; }

The key of the user’s devices for state a plugin keeps per group (sweeps, scans): ICallContext.AllDevicesScopeKey for users with all devices, else the device group’s id. Never empty.

IDeviceRepository Devices { get; }

The devices of the user’s view: IDeviceRepository.ListAsync lists only them.

IDeviceEventStreams? EventStreams { get; }

Event streams of devices of the user’s view; null when the host does not offer them.

bool HasAllDevices { get; }

The user may reach every device (administrators always). False for a user limited to a device group.

string SessionId { get; }

An opaque id of the user’s login session (never the token): the audience of events for one client (PluginEventAudience.Session) and the owner of jobs.

ITaskRunner Tasks { get; }

Starts tasks for the user, only on devices of the user’s view (the whole run is refused otherwise).

string UserName { get; }

The user’s name, as logged in.

IVapixClientFactory Vapix { get; }

Logged-in VAPIX clients, only for devices of the user’s view.

bool Contains(IDeviceInfo device)

True when device is in the user’s view (a few hash lookups, no request).

bool CoversRoute(Guid? siteId)

Default implementation

True when the user may reach the network of a route (SDK 0.4.0): siteId a site, null the server’s own network (“This server”). Users with all devices reach every route; a user with a device group only the sites the group names and the server’s network only when the group has “This server” (a device in the group through a tag or a single device does not open its network). For probes of addresses that are not devices (an address check). Fail closed: the default answers false for a user with a group.

bool Has(string permission)

True when the user’s role grants permission (“<plugin id>:<key>” or a host key).

const string AllDevicesScopeKey = "all"

The ICallContext.DeviceScopeKey of users with all devices.