Newer
Older
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#ifndef _TRANSITION_EFFECT_MANAGER_H_
#define _TRANSITION_EFFECT_MANAGER_H_
/**
* \ingroup ControllerClient
*/
/**
* \file lighting_controller_client/inc/TransitionEffectManager.h
* This file provides definitions for transitionEffect manager
*/
/******************************************************************************
* Copyright AllSeen Alliance. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************************/
#include <LSFTypes.h>
#include <Manager.h>
#include <ControllerClientDefs.h>
#include <list>
#include <LSFResponseCodes.h>
namespace lsf {
class ControllerClient;
/**
* A callback class which object delivered to the TransitionEffectManager and its object and methods delivered as a handle to get method replies and signals related to presence of the lamps.
*/
class TransitionEffectManagerCallback {
public:
/**
* Destructor
*/
virtual ~TransitionEffectManagerCallback() { }
/**
* Response to TransitionEffectManager::GetTransitionEffect. \n
* response code LSF_OK on success. \n
* LSF_ERR_NOT_FOUND - transition effect with requested id is not found. \n
* @param responseCode The return code
* @param transitionEffectID The id of the TransitionEffect
* @param transitionEffect The transition effect information
*
*/
virtual void GetTransitionEffectReplyCB(const LSFResponseCode& responseCode, const LSFString& transitionEffectID, const TransitionEffect& transitionEffect) { }
/**
* Response to TransitionEffectManager::GetAllTransitionEffectIDs. \n
* response code LSF_OK on success. \n
* @param responseCode The return code
* @param transitionEffectIDs A list of LSFString's
*/
virtual void GetAllTransitionEffectIDsReplyCB(const LSFResponseCode& responseCode, const LSFStringList& transitionEffectIDs) { }
/**
* Response to TransitionEffectManager::GetTransitionEffectName. \n
* Response code LSF_OK on success. \n
* @param responseCode The return code
* @param transitionEffectID The id of the TransitionEffect
* @param language
* @param transitionEffectName The name of the TransitionEffect
*/
virtual void GetTransitionEffectNameReplyCB(const LSFResponseCode& responseCode, const LSFString& transitionEffectID, const LSFString& language, const LSFString& transitionEffectName) { }
/**
* Response to TransitionEffectManager::SetTransitionEffectName. \n
* response code LSF_OK on success. \n
* LSF_ERR_INVALID_ARGS - language not supported, name is too long. \n
* LSF_ERR_EMPTY_NAME - transitionEffect name is empty. \n
* LSF_ERR_RESOURCES - blob is too big. \n
* @param responseCode The return code
* @param transitionEffectID The id of the TransitionEffect
* @param language
*/
virtual void SetTransitionEffectNameReplyCB(const LSFResponseCode& responseCode, const LSFString& transitionEffectID, const LSFString& language) { }
/**
* A TransitionEffect has been renamed
*
* @param transitionEffectIDs The id of the TransitionEffect
*/
virtual void TransitionEffectsNameChangedCB(const LSFStringList& transitionEffectIDs) { }
/**
* Response to TransitionEffectManager::CreateTransitionEffect. \n
* response code LSF_OK on success. \n
* LSF_ERR_INVALID_ARGS - language not supported, name is too long. \n
* LSF_ERR_EMPTY_NAME - transitionEffect name is empty. \n
* LSF_ERR_RESOURCES - blob is too big. \n
* @param responseCode The return code
* @param transitionEffectID The id of the new TransitionEffect
*/
virtual void CreateTransitionEffectReplyCB(const LSFResponseCode& responseCode, const LSFString& transitionEffectID) { }
/**
* A TransitionEffect has been created
*
* @param transitionEffectIDs The id of the TransitionEffect
*/
virtual void TransitionEffectsCreatedCB(const LSFStringList& transitionEffectIDs) { }
/**
* Response to TransitionEffectManager::UpdateTransitionEffect. \n
* response code LSF_OK on success. \n
* LSF_ERR_INVALID_ARGS - language not supported, name is too long. \n
* LSF_ERR_RESOURCES - blob is too big. \n
* @param responseCode The return code
* @param transitionEffectID The id of the new TransitionEffect
*/
virtual void UpdateTransitionEffectReplyCB(const LSFResponseCode& responseCode, const LSFString& transitionEffectID) { }
/**
* A TransitionEffect has been updated
*
* @param transitionEffectIDs The id of the TransitionEffect
*/
virtual void TransitionEffectsUpdatedCB(const LSFStringList& transitionEffectIDs) { }
/**
* Response to TransitionEffectManager::DeleteTransitionEffect. \n
* response code LSF_OK on success. \n
* LSF_ERR_NOT_FOUND - transition effect with requested id is not found. \n
* @param responseCode The return code
* @param transitionEffectID The id of the TransitionEffect
*/
virtual void DeleteTransitionEffectReplyCB(const LSFResponseCode& responseCode, const LSFString& transitionEffectID) { }
/**
* A TransitionEffect has been deleted
*
* @param transitionEffectIDs The id of the TransitionEffect
*/
virtual void TransitionEffectsDeletedCB(const LSFStringList& transitionEffectIDs) { }
};
/**
* a class manage the status of the lamps
*/
class TransitionEffectManager : public Manager {
friend class ControllerClient;
public:
/**
* class constructor
*/
TransitionEffectManager(ControllerClient& controller, TransitionEffectManagerCallback& callback);
/**
* Get all transition effect ids. \n
* Return asynchronous all transition effect ids which are not the default lamp state. \n
* Response in TransitionEffectManagerCallback::GetAllTransitionEffectIDsReplyCB. \n
* @return CONTROLLER_CLIENT_OK on success to send the request. \n
*/
ControllerClientStatus GetAllTransitionEffectIDs(void);
/**
* Get existing transition effect. \n
* Response in TransitionEffectManagerCallback::GetTransitionEffectReplyCB. \n
* @param transitionEffectID type LSFString which is transition effect id. \n
* Return asynchronously the transition effect response code, unique id and requested lamp state \n
* response code LSF_OK on success. \n
* LSF_ERR_NOT_FOUND - transition effect with requested id is not found. \n
*/
ControllerClientStatus GetTransitionEffect(const LSFString& transitionEffectID);
/**
* Get the name of a TransitionEffect. \n
* Response in TransitionEffectManagerCallback::GetTransitionEffectNameReplyCB. \n
* Return asynchronously the transition effect name, id, language and response code. \n
*
* @param transitionEffectID The id of the TransitionEffect
* @param language
*/
ControllerClientStatus GetTransitionEffectName(const LSFString& transitionEffectID, const LSFString& language = LSFString("en"));
/**
* Set the name of a TransitionEffect. \n
* Return asynchronously the transition effect new name, id, language and response code. \n
* Response in TransitionEffectManagerCallback::SetTransitionEffectNameReplyCB
*
* @param transitionEffectID The id of the TransitionEffect
* @param transitionEffectName The new name of the TransitionEffect
* @param language
*/
ControllerClientStatus SetTransitionEffectName(const LSFString& transitionEffectID, const LSFString& transitionEffectName, const LSFString& language = LSFString("en"));
/**
* Create a new transitionEffect. \n
* Response in TransitionEffectManagerCallback::CreateTransitionEffectReplyCB. \n
* Return asynchronously the transition effect response code and auto generated unique id. \n
*
* @param transitionEffect The new transition effect information
* @param transitionEffectName
* @param language
*/
ControllerClientStatus CreateTransitionEffect(const TransitionEffect& transitionEffect, const LSFString& transitionEffectName, const LSFString& language = LSFString("en"));
/**
* Update an existing TransitionEffect. \n
* Response in TransitionEffectManagerCallback::UpdateTransitionEffectReplyCB. \n
* Return asynchronously the transition effect response code and unique id. \n
*
* @param transitionEffectID The id of the TransitionEffect
* @param transitionEffect The new transition effect information
*/
ControllerClientStatus UpdateTransitionEffect(const LSFString& transitionEffectID, const TransitionEffect& transitionEffect);
/**
* Delete a transitionEffect. \n
* Return asynchronously the transition effect response code and unique id. \n
* Response in TransitionEffectManagerCallback::DeleteTransitionEffectReplyCB. \n
*
* @param transitionEffectID The id of the TransitionEffect to delete
*/
ControllerClientStatus DeleteTransitionEffect(const LSFString& transitionEffectID);
/**
* Get the TransitionEffect Info and Name. \n
* Combination of GetTransitionEffect and GetTransitionEffectName. \n
*
* @param transitionEffectID The ID of the master transitionEffect
* @param language
*/
ControllerClientStatus GetTransitionEffectDataSet(const LSFString& transitionEffectID, const LSFString& language = LSFString("en"));
private:
// signal handlers
void TransitionEffectsNameChanged(LSFStringList& idList) {
callback.TransitionEffectsNameChangedCB(idList);
}
void TransitionEffectsCreated(LSFStringList& idList) {
callback.TransitionEffectsCreatedCB(idList);
}
void TransitionEffectsUpdated(LSFStringList& idList) {
callback.TransitionEffectsUpdatedCB(idList);
}
void TransitionEffectsDeleted(LSFStringList& idList) {
callback.TransitionEffectsDeletedCB(idList);
}
// method reply handlers
void GetAllTransitionEffectIDsReply(LSFResponseCode& responseCode, LSFStringList& idList) {
callback.GetAllTransitionEffectIDsReplyCB(responseCode, idList);
}
void GetTransitionEffectReply(ajn::Message& message);
void GetTransitionEffectNameReply(LSFResponseCode& responseCode, LSFString& lsfId, LSFString& language, LSFString& lsfName) {
callback.GetTransitionEffectNameReplyCB(responseCode, lsfId, language, lsfName);
}
void SetTransitionEffectNameReply(LSFResponseCode& responseCode, LSFString& lsfId, LSFString& language) {
callback.SetTransitionEffectNameReplyCB(responseCode, lsfId, language);
}
void CreateTransitionEffectReply(LSFResponseCode& responseCode, LSFString& lsfId) {
callback.CreateTransitionEffectReplyCB(responseCode, lsfId);
}
void UpdateTransitionEffectReply(LSFResponseCode& responseCode, LSFString& lsfId) {
callback.UpdateTransitionEffectReplyCB(responseCode, lsfId);
}
void DeleteTransitionEffectReply(LSFResponseCode& responseCode, LSFString& lsfId) {
callback.DeleteTransitionEffectReplyCB(responseCode, lsfId);
}
TransitionEffectManagerCallback& callback;
};
}
#endif