mUPnP for C
CGUpnpControlPoint Class Reference

#include <CGUpnpControlPoint.h>

Inheritance diagram for CGUpnpControlPoint:

Instance Methods

(nullable instancetype) - init
 
(mUpnpControlPoint *) - cObject
 
(BOOL) - start
 
(BOOL) - stop
 
(BOOL) - isRunning
 
(void) - search
 
(void) - searchWithST:
 
(void) - setSsdpSearchMX:
 
(NSInteger) - ssdpSearchMX
 
(NSArray *) - devices
 
(CGUpnpDevice *) - deviceForUDN:
 

Properties

mUpnpControlPoint * cObject
 
id< CGUpnpControlPointDelegate > delegate
 

Detailed Description

The CGUpnpControlPoint class is a wrapper class for mUpnpControlPoint of mUPnP for C to program using only Objective-C directly on macOS and iOS. Currently, the only basic methods are wrapped to control UPnP devices.

-init creates and starts the native control point. It returns nil, without leaking the native object, when the native control point cannot be created or started.

Method Documentation

◆ cObject

- (mUpnpControlPoint *) cObject

◆ deviceForUDN:

- (CGUpnpDevice *) deviceForUDN: (NSString*) udn

Get a specified UPnP devices by the UDN.

Returns
CGUpnpDevice when the specified device is found, otherwise nil.

◆ devices

- (NSArray *) devices

Get all UPnP devices which the control point found as a NSArray object. The array has the devices as instances of CGUpnpDevice.

Returns
NSArray of CGUpnpDevice.

◆ init

- (id) init

◆ isRunning

- (BOOL) isRunning

Check if the controll point is running.

Returns
YES if the device is started normally, otherwise NO.

◆ search

- (void) search

Send an M-SEARCH request for root devices in the network. The method is the same as searchWithST: with the ST parameter "upnp:rootdevice" (MUPNP_NT_ROOTDEVICE); it does not search for "ssdp:all". See searchWithST: for when the method returns and how results are delivered.

◆ searchWithST:

- (void) searchWithST: (NSString*) aST

Send an M-SEARCH request for the specified search target (ST) in the network.

By default the method returns once the native layer has sent the request (it repeats the send mupnp_ssdp_getannouncecount() times with a short delay in between); it does not wait for the MX period and does not report whether sending succeeded. Responses arrive asynchronously: found devices are reported through the delegate and are returned by devices and deviceForUDN: afterwards. Only when the wrapper is compiled with CG_UPNPCONTROLPOINT_ENABLE_SEARCH_SLEEP does the method additionally sleep for ssdpSearchMX seconds before returning.

Parameters
aSTThe Search Target parameter (ex. "upnp:rootdevice" or "ssdp:all")

◆ setSsdpSearchMX:

- (void) setSsdpSearchMX: (NSInteger) aMX

Set the MX parameter, in seconds, sent in SSDP M-SEARCH requests. MX is the maximum time devices may wait before responding. The search methods wait for this time only when compiled with CG_UPNPCONTROLPOINT_ENABLE_SEARCH_SLEEP.

Parameters
aMXMaximum response delay in seconds

◆ ssdpSearchMX

- (NSInteger) ssdpSearchMX

Get the MX parameter, in seconds, sent in SSDP M-SEARCH requests.

Returns
Maximum response delay in seconds

◆ start

- (BOOL) start

Activate some background threads of the control point such as SSDP and HTTP servers to listen messages and events of UPnP. You must call this method before you can actually use a control point.

Returns
TRUE if successful; otherwise FALSE

◆ stop

- (BOOL) stop

Stop some background threads of the control point such as SSDP and HTTP servers to listen messages and events of UPnP.

Returns
TRUE if successful; otherwise FALSE

Property Documentation

◆ cObject

- (mUpnpControlPoint*) cObject
readatomicassign

◆ delegate

- (id<CGUpnpControlPointDelegate>) delegate
readwriteatomicassign

The documentation for this class was generated from the following files: