Go to the documentation of this file. 1 #ifndef UPNP_TV_CTRLPT_H
2 #define UPNP_TV_CTRLPT_H
61 #define TV_SERVICE_SERVCOUNT 2
62 #define TV_SERVICE_CONTROL 0
63 #define TV_SERVICE_PICTURE 1
65 #define TV_CONTROL_VARCOUNT 3
66 #define TV_CONTROL_POWER 0
67 #define TV_CONTROL_CHANNEL 1
68 #define TV_CONTROL_VOLUME 2
70 #define TV_PICTURE_VARCOUNT 4
71 #define TV_PICTURE_COLOR 0
72 #define TV_PICTURE_TINT 1
73 #define TV_PICTURE_CONTRAST 2
74 #define TV_PICTURE_BRIGHTNESS 3
76 #define TV_MAX_VAL_LEN 5
83 #define TV_MAXVARS TV_PICTURE_VARCOUNT
87 extern char TvVarCount[];
90 char ServiceId[NAME_SIZE];
91 char ServiceType[NAME_SIZE];
93 char EventURL[NAME_SIZE];
94 char ControlURL[NAME_SIZE];
102 char DescDocURL[250];
103 char FriendlyName[250];
118 void TvCtrlPointPrintHelp(
void);
120 int TvCtrlPointRemoveDevice(
const char *);
121 int TvCtrlPointRemoveAll(
void);
122 int TvCtrlPointRefresh(
void);
124 int TvCtrlPointSendAction(
int,
int,
const char *,
const char **,
char **,
int);
125 int TvCtrlPointSendActionNumericArg(
int devnum,
int service,
const char *actionName,
const char *paramName,
int paramValue);
126 int TvCtrlPointSendPowerOn(
int devnum);
127 int TvCtrlPointSendPowerOff(
int devnum);
128 int TvCtrlPointSendSetChannel(
int,
int);
129 int TvCtrlPointSendSetVolume(
int,
int);
130 int TvCtrlPointSendSetColor(
int,
int);
131 int TvCtrlPointSendSetTint(
int,
int);
132 int TvCtrlPointSendSetContrast(
int,
int);
133 int TvCtrlPointSendSetBrightness(
int,
int);
135 int TvCtrlPointGetVar(
int,
int,
const char *);
136 int TvCtrlPointGetPower(
int devnum);
137 int TvCtrlPointGetChannel(
int);
138 int TvCtrlPointGetVolume(
int);
139 int TvCtrlPointGetColor(
int);
140 int TvCtrlPointGetTint(
int);
141 int TvCtrlPointGetContrast(
int);
142 int TvCtrlPointGetBrightness(
int);
145 int TvCtrlPointPrintList(
void);
146 int TvCtrlPointPrintDevice(
int);
147 void TvCtrlPointAddDevice(
IXML_Document *,
const char *,
int);
148 void TvCtrlPointHandleGetVar(
const char *,
const char *,
const DOMString);
166 void TvCtrlPointHandleEvent(
const char *,
int,
IXML_Document *);
167 void TvCtrlPointHandleSubscribeUpdate(
const char *,
const Upnp_SID,
int);
168 int TvCtrlPointCallbackEventHandler(Upnp_EventType,
const void *,
void *);
186 int TvCtrlPointStop(
void);
187 int TvCtrlPointProcessCommand(
char *cmdline);
214 int TvCtrlPointProcessCommand(
char *cmdline);
EXPORT_SPEC void ixmlNodeList_free(IXML_NodeList *nList)
Frees a NodeList object.
Definition: nodeList.c:143
@ UPNP_EVENT_SUBSCRIPTION_REQUEST
Definition: Callback.h:83
@ UPNP_DISCOVERY_SEARCH_RESULT
Definition: Callback.h:63
@ UPNP_CONTROL_ACTION_REQUEST
Definition: Callback.h:25
Definition: tv_ctrlpt.h:109
#define TV_MAXVARS
Definition: tv_device.h:133
int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
Prints callback event structure details.
Definition: sample_util.c:317
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition: upnp.h:445
char * SampleUtil_GetFirstDocumentItem(IXML_Document *doc, const char *item)
Given a document node, this routine searches for the first element named by the input string item,...
Definition: sample_util.c:192
int UpnpDownloadXmlDoc(const char *url, IXML_Document **xmlDoc)
Downloads an XML document specified in a URL.
Definition: upnpapi.c:3190
@ UPNP_CONTROL_GET_VAR_REQUEST
Definition: Callback.h:36
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition: upnp.h:426
@ UPNP_EVENT_RENEWAL_COMPLETE
Definition: Callback.h:93
int UpnpGetServiceVarStatusAsync(UpnpClient_Handle Hnd, const char *ActionURL, const char *VarName, Upnp_FunPtr Fun, const void *Cookie)
Queries the state of a variable of a service, generating a callback when the operation is complete.
Definition: upnpapi.c:2873
void(* print_string)(const char *string,...)
Prototype for displaying strings. All printing done by the device, control point, and sample util,...
Definition: sample_util.h:162
@ UPNP_EVENT_UNSUBSCRIBE_COMPLETE
Definition: Callback.h:103
int UpnpRegisterClient(Upnp_FunPtr Callback, const void *Cookie, UpnpClient_Handle *Hnd)
Registers a control point application with the UPnP Library.
Definition: upnpapi.c:1308
Data structure representing the DOM Document.
Definition: ixml.h:198
@ UPNP_EVENT_SUBSCRIPTION_EXPIRED
Definition: Callback.h:115
char * VariableStrVal[4]
Definition: tv_device.h:164
int SampleUtil_Initialize(print_string print_function)
Initializes the sample util. Must be called before any sample util functions. May be called multiple ...
Definition: sample_util.c:62
unsigned short UpnpGetServerPort(void)
Returns the internal server IPv4 UPnP listening port.
Definition: upnpapi.c:659
#define TV_SERVICE_SERVCOUNT
Definition: tv_device.h:91
void TvCtrlPointPrintLongHelp(void)
Print long help info for this application.
Definition: tv_ctrlpt.c:1307
void(* state_update)(const char *varName, const char *varValue, const char *UDN, eventType type)
Prototype for passing back state changes.
Definition: sample_util.h:179
Definition: tv_ctrlpt.h:89
static struct cmdloop_commands cmdloop_cmdlist[]
Definition: tv_ctrlpt.c:1424
void TvStateUpdate(char *UDN, int Service, IXML_Document *ChangedVariables, char **State)
Update a Tv state table. Called when an event is received.
Definition: tv_ctrlpt.c:811
#define TV_CONTROL_VARCOUNT
Definition: tv_device.h:100
@ UPNP_DISCOVERY_SEARCH_TIMEOUT
Definition: Callback.h:68
char * SampleUtil_GetElementValue(IXML_Element *element)
Given a DOM node such as <Channel>11</Channel>, this routine extracts the value (e....
Definition: sample_util.c:103
cmdloop_tvcmds
Definition: tv_ctrlpt.c:1388
int UpnpInit2(const char *IfName, unsigned short DestPort)
Initializes the Linux SDK for UPnP Devices (IPv4 or IPv6).
Definition: upnpapi.c:460
#define UPNP_E_SUCCESS
The operation completed successfully.
Definition: upnp.h:97
@ UPNP_EVENT_RECEIVED
Definition: Callback.h:88
int UpnpUnSubscribe(UpnpClient_Handle Hnd, const Upnp_SID SubsId)
Removes the subscription of a control point from a service previously subscribed to using UpnpSubscri...
Definition: upnpapi.c:2035
int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionPtr, int combo)
Call this function to initialize the UPnP library and start the TV Control Point. This function creat...
Definition: tv_ctrlpt.c:1216
@ UPNP_CONTROL_GET_VAR_COMPLETE
Definition: Callback.h:41
const char * TvVarName[2][4]
Definition: tv_ctrlpt.c:67
EXPORT_SPEC void ixmlDocument_free(IXML_Document *doc)
Frees a Document object and all Nodes associated with it.
Definition: document.c:54
struct s_UpnpActionComplete UpnpActionComplete
Definition: TemplateInclude.h:136
static int TvCtrlPointTimerLoopRun
Function that runs in its own thread and monitors advertisement and subscription timeouts for devices...
Definition: tv_ctrlpt.c:1194
@ UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE
Definition: Callback.h:57
int SampleUtil_RegisterUpdateFunction(state_update update_function)
Definition: sample_util.c:82
EXPORT_SPEC IXML_Node * ixmlNodeList_item(IXML_NodeList *nList, unsigned long index)
Retrieves a Node from a NodeList specified by a numerical index.
Definition: nodeList.c:54
const char * TvServiceName[]
Definition: tv_ctrlpt.c:61
const char * UpnpString_get_String(const UpnpString *p)
Returns the pointer to char.
Definition: UpnpString.c:159
int UpnpSubscribe(UpnpClient_Handle Hnd, const char *PublisherUrl, int *TimeOut, Upnp_SID SubsId)
Registers a control point to receive event notifications from another device.
Definition: upnpapi.c:1964
int UpnpActionComplete_get_ErrCode(const UpnpActionComplete *p)
#define TV_SERVICE_PICTURE
Definition: tv_device.h:97
int UpnpSendActionAsync(UpnpClient_Handle Hnd, const char *ActionURL, const char *ServiceType, const char *DevUDN, IXML_Document *Action, Upnp_FunPtr Fun, const void *Cookie)
Sends a message to change a state variable in a service, generating a callback when the operation is ...
Definition: upnpapi.c:2656
void TvCtrlPointVerifyTimeouts(int incr)
Checks the advertisement each device in the global device list.
Definition: tv_ctrlpt.c:1144
void TvCtrlPointPrintShortHelp(void)
Print help info for this application.
Definition: tv_ctrlpt.c:1283
void SampleUtil_StateUpdate(const char *varName, const char *varValue, const char *UDN, eventType type)
Definition: sample_util.c:655
int SampleUtil_Print(const char *fmt,...)
Function emulating printf that ultimately calls the registered print function with the formatted stri...
Definition: sample_util.c:634
Definition: tv_ctrlpt.c:1410
Definition: tv_ctrlpt.h:100
int SampleUtil_FindAndParseService(IXML_Document *DescDoc, const char *location, const char *serviceType, char **serviceId, char **eventURL, char **controlURL)
This routine finds the first occurance of a service in a DOM representation of a description document...
Definition: sample_util.c:550
struct TvDeviceNode * GlobalDeviceList
Definition: tv_ctrlpt.c:82
Data structure representing a list of nodes.
Definition: ixml.h:246
#define DOMString
The type of DOM strings.
Definition: ixml.h:59
char * UpnpGetServerIpAddress(void)
Returns the local IPv4 listening ip address.
Definition: upnpapi.c:679
EXPORT_SPEC IXML_NodeList * ixmlDocument_getElementsByTagName(IXML_Document *doc, const char *tagName)
Returns a NodeList of all Elements that match the given tag name in the order in which they were enco...
int UpnpSearchAsync(UpnpClient_Handle Hnd, int Mx, const char *TTarget_constarget_const, const void *Cookie_const)
Searches for devices matching the given search target.
Definition: upnpapi.c:1757
EXPORT_SPEC unsigned long ixmlNodeList_length(IXML_NodeList *nList)
Returns the number of Nodes in a NodeList.
Definition: nodeList.c:128
@ UPNP_EVENT_SUBSCRIBE_COMPLETE
Definition: Callback.h:98
@ UPNP_CONTROL_ACTION_COMPLETE
Definition: Callback.h:30
@ UPNP_DISCOVERY_ADVERTISEMENT_ALIVE
Definition: Callback.h:51
void * TvCtrlPointCommandLoop(void *args)
Function that receives commands from the user at the command prompt during the lifetime of the device...
Definition: tv_ctrlpt.c:1458
UpnpString object declaration.
int default_timeout
Definition: tv_ctrlpt.c:77
void TvCtrlPointPrintCommands(void)
Definition: tv_ctrlpt.c:1445
Data structure representing an Element node.
Definition: ixml.h:216
@ UPNP_EVENT_AUTORENEWAL_FAILED
Definition: Callback.h:109
#define TV_SERVICE_CONTROL
Definition: tv_device.h:94
int UpnpFinish(void)
Initializes the OpenSSL library, and the OpenSSL context for use with pupnp.
Definition: upnpapi.c:585
int UpnpUnRegisterClient(UpnpClient_Handle Hnd)
Unregisters a control point application, unsubscribing all active subscriptions.
Definition: upnpapi.c:1356
const char TvDeviceType[]
Definition: tv_ctrlpt.c:58
#define TV_PICTURE_VARCOUNT
Definition: tv_device.h:112
#define TV_MAX_VAL_LEN
Definition: tv_device.h:127
ithread_mutex_t DeviceListMutex
Definition: tv_ctrlpt.c:53
Definition: tv_device.h:154
EXPORT_SPEC IXML_NodeList * ixmlElement_getElementsByTagName(IXML_Element *element, const char *tagName)
Returns a NodeList of all descendant Elements with a given tag name, in the order in which they are e...
int SampleUtil_Finish()
Releases Resources held by sample util.
Definition: sample_util.c:92