DLNA DMC
$[timeformat('2018-01-31T14:10:39+08:00')]

CGUpnpControlPoint


#if !defined(_CG_UPNP_CCONTROLPOINT_H_)
typedef void CgUpnpControlPoint;
#endif

@class CGUpnpDevice;
@class CGUpnpControlPoint;

@protocol CGUpnpControlPointDelegate <NSObject>
@optional
// deviceUdn 设备的UDID 设备添加,更新,移除,失效的协议方法
- (void)controlPoint:(CGUpnpControlPoint *)controlPoint deviceAdded:(NSString *)deviceUdn;
- (void)controlPoint:(CGUpnpControlPoint *)controlPoint deviceUpdated:(NSString *)deviceUdn;
- (void)controlPoint:(CGUpnpControlPoint *)controlPoint deviceRemoved:(NSString *)deviceUdn;
- (void)controlPoint:(CGUpnpControlPoint *)controlPoint deviceInvalid:(NSString *)deviceUdn;
@end

/**
 * The CGUpnpControlPoint class is a wrapper class for CgUpnpControlPoint of CyberLink for C to 
 * program using only Objective-C directly on MacOSX.
 * Currently, the only basic methods are wrapped to control UPnP devices.
 */
@interface CGUpnpControlPoint : NSObject 
{
	CgUpnpControlPoint *cObject;
}
// 子控制点
@property(readonly) CgUpnpControlPoint *cObject;
// 代理对象
@property(assign) id<CGUpnpControlPointDelegate> delegate;

// get方法
- (CgUpnpControlPoint *)cObject;
/**
 * 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.
 *
 * @return TRUE if successful; otherwise FALSE
 *
 */
 // 激活DMC的子线程 SSDP HTTP服务,去监听UPnP信息和时间
 // 使用控制点之前必须要激活
- (BOOL)start;
/**
 * Stop some background threads of the control point such as SSDP and 
 * HTTP servers to listen messages and events of UPnP. 
 *
 * @return TRUE if successful; otherwise FALSE
 *
 */
 // 停止后台线程 和 SSDP HTTP 服务
- (BOOL)stop;
/**
 * Check if the controll point is running.
 *
 * @return YES if the device is started normally, otherwise NO.
 */
 // 检测DMC是否正在运行
- (BOOL)isRunning;
/**
 * Send a M-SEARCH request to find for the all UPnP devices of UPnP in the network.
 * The method waits for the specified MX time. Use setSsdpSearchMX:(NSInteger)aMX to change the time.
 * The method is same as searchWithST() when the ST parameter is "ssdp:all".
 */
 
 // 发送M-SEARCH 请求去发现局域网内所有的UPnP设备
- (void)search;
/**
 * Send a M-SEARCH request to find for the specified UPnP devices by a ST parameter in the network.
 * The method waits for the specified MX time. Use setSsdpSearchMX:(NSInteger)aMX to change the time.
 *
 * @param aST The Search Target parameter (ex. "ssdp:all")
 */
- (void)searchWithST:(NSString *)aST;
/**
 * Set a MX parameter used for SSDP searches in seconds.
 * The parameter is used to wait for M-SEARCH responses in search() and searchWithST:(NSString *)aST.
 *
 * @param aMX Time to wait
 */
- (void)setSsdpSearchMX:(NSInteger)aMX;
/**
 * Get a MX parameter used for SSDP searches in seconds.
 * The parameter is used to wait for M-SEARCH responses in search() and searchWithST:(NSString *)aST.
 *
 * @return Time to wait
 */
// 等待时间
- (NSInteger)ssdpSearchMX;
/**
 * Get all UPnP devices which the control point found as a NSArray object. The array has the devices as instances of CGUpnpDevice.
 * @return NSArray of CGUpnpDevice.
 */
 // DMC发现的所有设备
- (NSArray *)devices;
/**
 * Get a specified UPnP devices by the UDN.
 * @return CGUpnpDevice when the specified device is found, otherwise nil.
 */
 // 通过UDN 获取指定的upnp设备
- (CGUpnpDevice *)deviceForUDN:(NSString *)udn;

CGUpnpAvContentDirectory

/**
 * The CGUpnpAvContentDirectory class has UPnP/AV objects of a media servers.
 *
 */
@interface CGUpnpAvContentDirectory : NSObject
{
	CGUpnpAvContentManager *contentMgr;
}
- (CGUpnpAvContainer *)rootObject;
- (CGUpnpAvObject *)objectForId:(NSString *)aObjectId;
- (CGUpnpAvObject *)objectForTitlePath:(NSString *)aTitlePath;
@end

CGUpnpAvContentManager

/**
 * The CGUpnpAvContentDirectory class has UPnP/AV objects of a media servers.
 *
 */
@interface CGUpnpAvContentManager : NSObject
{
	CGUpnpAvRoot *rootObj;
}
- (CGUpnpAvContainer *)rootObject;
- (CGUpnpAvObject *)objectForId:(NSString *)aObjectId;
- (CGUpnpAvObject *)objectForTitlePath:(NSString *)aTitlePath;

CGUpnpAvObject


/**
 * The CGUpnpAvObject class is a wrapper class for CgUpnpAvObject of CyberLink for C.
 */

#define CGUPNPAV_OBJECT_MOVIE_FILEEXT @"mov"
#define CGUPNPAV_OBJECT_SOUND_FILEEXT @"snd"
#define CGUPNPAV_OBJECT_IMAGE_FILEEXT @"img"

@interface CGUpnpAvObject : CGXmlNode 
{
    // 父类对象
	CGUpnpAvObject *parent;
}
@property(retain) id userObject;
#if defined(TARGET_OS_IPHONE)
@property(retain) UIImage *thumbnailImage;
#endif

// xml字符串转成对象
+ (NSArray *)arrayWithXMLString:(NSString *)aXmlString;
// 初始化方法
- (id)init;
#if  !defined(TARGET_OS_IPHONE)
- (id)initWithXMLNode:(NSXMLElement *)aXmlNode;
#else
- (id)initWithXMLNode:(CgXmlNode *)aXmlNode;
- (id)initWithMediaContent:(CgUpnpAvContent *)aMediaContent;
#endif
// 判断方法
- (BOOL)isEqual:(id)anObject;
- (BOOL)isContainer;
- (BOOL)isItem;
// 设置、获取父亲类
- (void)setParent:(CGUpnpAvObject *)aParent;
- (CGUpnpAvObject *)parent;
// 祖先类对象
- (CGUpnpAvObject *)ancestor;
// 对象ID
- (NSString *)objectId;
// 子类对象个数
- (NSUInteger)childCount;
// 标题(文件名 不带后缀)
- (NSString *)title;
// upnp 类型
- (NSString *)upnpClass;
// 日期
- (NSString *)date;
// 相册URI
- (NSString *)albumArtURI;
// 设置对象ID、title等
- (void)setObjectId:(NSString *)aValue;
- (void)setTitle:(NSString *)aValue;
- (void)setUpnpClass:(NSString *)aValue;
// 是否包含某一资源对象
- (BOOL)isObjectId:(NSString *)aObjectId;
- (BOOL)isTitle:(NSString *)aTitle;
- (BOOL)isUpnpClass:(NSString *)aUpnpClass;
// 文件全名 (带后缀)
- (NSString *)toFileNameString;
// 艺术家 作者
- (NSString *)artist;