|
mUPnP for C
|
#include <CGUpnpControlPoint.h>
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 |
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.
| - (mUpnpControlPoint *) cObject |
| - (CGUpnpDevice *) deviceForUDN: | (NSString*) | udn |
Get a specified UPnP devices by the UDN.
| - (NSArray *) devices |
Get all UPnP devices which the control point found as a NSArray object. The array has the devices as instances of CGUpnpDevice.
| - (id) init |
| - (BOOL) isRunning |
Check if the controll point is running.
| - (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.
| - (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.
| aST | The Search Target parameter (ex. "upnp:rootdevice" or "ssdp:all") |
| - (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.
| aMX | Maximum response delay in seconds |
| - (NSInteger) ssdpSearchMX |
Get the MX parameter, in seconds, sent in SSDP M-SEARCH requests.
| - (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.
| - (BOOL) stop |
Stop some background threads of the control point such as SSDP and HTTP servers to listen messages and events of UPnP.
|
readatomicassign |
|
readwriteatomicassign |