blob: d49f1f557f566bd26513cb153f4395f83f117e13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
//
// PltUPnPObject.mm
// Platinum
//
// Created by Sylvain on 9/14/10.
// Copyright 2010 Plutinosoft LLC. All rights reserved.
//
#import "Platinum.h"
#import "PltUPnPObject.h"
/*----------------------------------------------------------------------
| PLT_ActionObject
+---------------------------------------------------------------------*/
@implementation PLT_ActionObject
- (id)initWithAction:(PLT_Action *)_action
{
if ((self = [super init])) {
action = _action;
}
return self;
}
- (NPT_Result)setValue:(NSString *)value forArgument:(NSString *)argument
{
return action->SetArgumentValue([argument UTF8String], [value UTF8String]);
}
- (NPT_Result)setErrorCode:(unsigned int)code withDescription:(NSString*)description
{
return action->SetError(code, [description UTF8String]);
}
@end
/*----------------------------------------------------------------------
| PLT_DeviceHostObject
+---------------------------------------------------------------------*/
@implementation PLT_DeviceHostObject
- (id)init
{
return [super init];
}
- (void)setDevice:(PLT_DeviceHostReference*)_device
{
delete device;
device = new PLT_DeviceHostReference(*_device);
}
- (void)dealloc
{
delete device;
}
- (PLT_DeviceHostReference&)getDevice
{
return *device;
}
@end
/*----------------------------------------------------------------------
| PLT_UPnPObject
+---------------------------------------------------------------------*/
@interface PLT_UPnPObject () {
PLT_UPnP *_upnp;
NSMutableArray *_devices;
}
@end
@implementation PLT_UPnPObject
- (id)init
{
if ((self = [super init])) {
_upnp = new PLT_UPnP();
_devices = [NSMutableArray array];
}
return self;
}
-(void) dealloc
{
delete _upnp;
}
- (NPT_Result)start
{
return _upnp->Start();
}
- (NPT_Result)stop
{
return _upnp->Stop();
}
- (bool)isRunning
{
return _upnp->IsRunning();
}
- (NPT_Result)addDevice:(PLT_DeviceHostObject*)device
{
[_devices addObject:device];
return _upnp->AddDevice([device getDevice]);
}
- (NPT_Result)removeDevice:(PLT_DeviceHostObject*)device
{
[_devices removeObject:device];
return _upnp->RemoveDevice([device getDevice]);
}
@end
|