libUPnP  1.8.0
upnp_tv_ctrlpt.h
1 /**************************************************************************
2  *
3  * Copyright (c) 2000-2003 Intel Corporation
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * - Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  * - Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  * - Neither name of Intel Corporation nor the names of its contributors
15  * may be used to endorse or promote products derived from this software
16  * without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  **************************************************************************/
31 
32 
33 #ifndef UPNP_TV_CTRLPT_H
34 #define UPNP_TV_CTRLPT_H
35 
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 
42 #include "sample_util.h"
43 
44 
45 #include "ithread.h"
46 #include "upnp.h"
47 #include "upnptools.h"
48 
49 
50 #include <signal.h>
51 #include <stdarg.h>
52 #include <stdio.h>
53 #include <stdlib.h>
54 #include <string.h>
55 
56 
57 #ifdef WIN32
58  /* Do not #include <unistd.h> */
59 #else
60  #include <unistd.h>
61 #endif
62 
63 
64 #define TV_SERVICE_SERVCOUNT 2
65 #define TV_SERVICE_CONTROL 0
66 #define TV_SERVICE_PICTURE 1
67 
68 #define TV_CONTROL_VARCOUNT 3
69 #define TV_CONTROL_POWER 0
70 #define TV_CONTROL_CHANNEL 1
71 #define TV_CONTROL_VOLUME 2
72 
73 #define TV_PICTURE_VARCOUNT 4
74 #define TV_PICTURE_COLOR 0
75 #define TV_PICTURE_TINT 1
76 #define TV_PICTURE_CONTRAST 2
77 #define TV_PICTURE_BRIGHTNESS 3
78 
79 #define TV_MAX_VAL_LEN 5
80 
81 #define TV_SUCCESS 0
82 #define TV_ERROR (-1)
83 #define TV_WARNING 1
84 
85 /* This should be the maximum VARCOUNT from above */
86 #define TV_MAXVARS TV_PICTURE_VARCOUNT
87 
88 extern char TvDeviceType[];
89 extern char *TvServiceType[];
90 extern char *TvServiceName[];
91 extern char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS];
92 extern char TvVarCount[];
93 
94 struct tv_service {
95  char ServiceId[NAME_SIZE];
96  char ServiceType[NAME_SIZE];
97  char *VariableStrVal[TV_MAXVARS];
98  char EventURL[NAME_SIZE];
99  char ControlURL[NAME_SIZE];
100  char SID[NAME_SIZE];
101 };
102 
103 extern struct TvDeviceNode *GlobalDeviceList;
104 
105 struct TvDevice {
106  char UDN[250];
107  char DescDocURL[250];
108  char FriendlyName[250];
109  char PresURL[250];
110  int AdvrTimeOut;
111  struct tv_service TvService[TV_SERVICE_SERVCOUNT];
112 };
113 
114 struct TvDeviceNode {
115  struct TvDevice device;
116  struct TvDeviceNode *next;
117 };
118 
119 extern ithread_mutex_t DeviceListMutex;
120 
121 extern UpnpClient_Handle ctrlpt_handle;
122 
123 void TvCtrlPointPrintHelp();
124 int TvCtrlPointDeleteNode(struct TvDeviceNode*);
125 int TvCtrlPointRemoveDevice(const char *);
126 int TvCtrlPointRemoveAll();
127 int TvCtrlPointRefresh();
128 
129 
130 int TvCtrlPointSendAction(int, int, char *, char **, char **, int);
131 int TvCtrlPointSendActionNumericArg(int devnum, int service, char *actionName, char *paramName, int paramValue);
132 int TvCtrlPointSendPowerOn(int devnum);
133 int TvCtrlPointSendPowerOff(int devnum);
134 int TvCtrlPointSendSetChannel(int, int);
135 int TvCtrlPointSendSetVolume(int, int);
136 int TvCtrlPointSendSetColor(int, int);
137 int TvCtrlPointSendSetTint(int, int);
138 int TvCtrlPointSendSetContrast(int, int);
139 int TvCtrlPointSendSetBrightness(int, int);
140 
141 int TvCtrlPointGetVar(int, int, char*);
142 int TvCtrlPointGetPower(int devnum);
143 int TvCtrlPointGetChannel(int);
144 int TvCtrlPointGetVolume(int);
145 int TvCtrlPointGetColor(int);
146 int TvCtrlPointGetTint(int);
147 int TvCtrlPointGetContrast(int);
148 int TvCtrlPointGetBrightness(int);
149 
150 int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
151 int TvCtrlPointPrintList( void );
152 int TvCtrlPointPrintDevice(int);
153 void TvCtrlPointAddDevice(IXML_Document *, const char *, int);
154 void TvCtrlPointHandleGetVar(const char *, const char *, const DOMString);
155 void TvStateUpdate(char*,int, IXML_Document * , char **);
156 void TvCtrlPointHandleEvent(const UpnpString *, int, IXML_Document *);
157 void TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);
158 int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
159 void TvCtrlPointVerifyTimeouts(int);
160 void TvCtrlPointPrintCommands( void );
161 void* TvCtrlPointCommandLoop( void* );
162 int TvCtrlPointStart( print_string printFunctionPtr, state_update updateFunctionPtr );
163 int TvCtrlPointStop( void );
164 int TvCtrlPointProcessCommand( char *cmdline );
165 
166 #ifdef __cplusplus
167 };
168 #endif
169 
170 #endif //UPNP_TV_CTRLPT_H
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition: upnp.h:461
Definition: upnp_tv_ctrlpt.h:114
Definition: upnp_tv_ctrlpt.h:105
#define DOMString
The type of DOM strings.
Definition: ixml.h:55
Data structure representing the DOM Document.
Definition: ixml.h:183
Definition: upnp_tv_ctrlpt.h:94
struct s_UpnpString UpnpString
Type of the string objects inside libupnp.
Definition: UpnpString.h:35
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition: upnp.h:590