tv_ctrlpt.h
Go to the documentation of this file.
#ifndef UPNP_TV_CTRLPT_H
#define UPNP_TV_CTRLPT_H
/**************************************************************************
*
* Copyright (c) 2000-2003 Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#include "sample_util.h"
#include "UpnpString.h"
#include "upnp.h"
#include "upnptools.h"
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#define TV_SERVICE_SERVCOUNT 2
#define TV_SERVICE_CONTROL 0
#define TV_SERVICE_PICTURE 1
#define TV_CONTROL_VARCOUNT 3
#define TV_CONTROL_POWER 0
#define TV_CONTROL_CHANNEL 1
#define TV_CONTROL_VOLUME 2
#define TV_PICTURE_VARCOUNT 4
#define TV_PICTURE_COLOR 0
#define TV_PICTURE_TINT 1
#define TV_PICTURE_CONTRAST 2
#define TV_PICTURE_BRIGHTNESS 3
#define TV_MAX_VAL_LEN 5
#define TV_SUCCESS 0
#define TV_ERROR (-1)
#define TV_WARNING 1
/* This should be the maximum VARCOUNT from above */
#define TV_MAXVARS TV_PICTURE_VARCOUNT
extern const char *TvServiceName[];
extern const char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS];
extern char TvVarCount[];
struct tv_service
{
char ServiceId[NAME_SIZE];
char ServiceType[NAME_SIZE];
char *VariableStrVal[TV_MAXVARS];
char EventURL[NAME_SIZE];
char ControlURL[NAME_SIZE];
char SID[NAME_SIZE];
};
extern struct TvDeviceNode *GlobalDeviceList;
struct TvDevice
{
char UDN[250];
char DescDocURL[250];
char FriendlyName[250];
char PresURL[250];
int AdvrTimeOut;
struct tv_service TvService[TV_SERVICE_SERVCOUNT];
};
struct TvDeviceNode
{
struct TvDevice device;
struct TvDeviceNode *next;
};
extern ithread_mutex_t DeviceListMutex;
extern UpnpClient_Handle ctrlpt_handle;
void TvCtrlPointPrintHelp(void);
int TvCtrlPointDeleteNode(struct TvDeviceNode *);
int TvCtrlPointRemoveDevice(const char *);
int TvCtrlPointRemoveAll(void);
int TvCtrlPointRefresh(void);
int TvCtrlPointSendAction(int, int, const char *, const char **, char **, int);
int TvCtrlPointSendActionNumericArg(int devnum,
int service,
const char *actionName,
const char *paramName,
int paramValue);
int TvCtrlPointSendPowerOn(int devnum);
int TvCtrlPointSendPowerOff(int devnum);
int TvCtrlPointSendSetChannel(int, int);
int TvCtrlPointSendSetVolume(int, int);
int TvCtrlPointSendSetColor(int, int);
int TvCtrlPointSendSetTint(int, int);
int TvCtrlPointSendSetContrast(int, int);
int TvCtrlPointSendSetBrightness(int, int);
int TvCtrlPointGetVar(int, int, const char *);
int TvCtrlPointGetPower(int devnum);
int TvCtrlPointGetChannel(int);
int TvCtrlPointGetVolume(int);
int TvCtrlPointGetColor(int);
int TvCtrlPointGetTint(int);
int TvCtrlPointGetContrast(int);
int TvCtrlPointGetBrightness(int);
int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
int TvCtrlPointPrintList(void);
int TvCtrlPointPrintDevice(int);
void TvCtrlPointAddDevice(IXML_Document *, const char *, int);
void TvCtrlPointHandleGetVar(const char *, const char *, const DOMString);
void TvStateUpdate(
char *UDN,
int Service,
IXML_Document *ChangedVariables,
char **State);
void TvCtrlPointHandleEvent(const char *, int, IXML_Document *);
void TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);
int TvCtrlPointCallbackEventHandler(Upnp_EventType, const void *, void *);
void TvCtrlPointVerifyTimeouts(
int incr);
void TvCtrlPointPrintCommands(void);
void *TvCtrlPointCommandLoop(void *);
int TvCtrlPointStart(char *iface, state_update updateFunctionPtr, int combo);
int TvCtrlPointStop(void);
int TvCtrlPointProcessCommand(char *cmdline);
void TvCtrlPointPrintShortHelp(void);
void TvCtrlPointPrintLongHelp(void);
void TvCtrlPointPrintCommands(void);
void *TvCtrlPointCommandLoop(void *args);
int TvCtrlPointProcessCommand(char *cmdline);
#ifdef __cplusplus
};
#endif
#endif /* UPNP_TV_CTRLPT_H */
UpnpString.h
UpnpString object declaration.
Upnp_SID
char Upnp_SID[44]
Holds the subscription identifier for a subscription between a client and a device.
Definition upnp.h:448
UpnpClient_Handle
int UpnpClient_Handle
Returned when a control point application registers with UpnpRegisterClient.
Definition upnp.h:429
TvCtrlPointVerifyTimeouts
void TvCtrlPointVerifyTimeouts(int incr)
Checks the advertisement each device in the global device list.
Definition tv_ctrlpt.c:1193
TV_MAXVARS
#define TV_MAXVARS
Definition tv_ctrlpt.h:83
TV_SERVICE_SERVCOUNT
#define TV_SERVICE_SERVCOUNT
Definition tv_ctrlpt.h:61
DeviceListMutex
ithread_mutex_t DeviceListMutex
Definition tv_ctrlpt.c:55
TvCtrlPointCommandLoop
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:1532
TvCtrlPointPrintCommands
void TvCtrlPointPrintCommands(void)
Definition tv_ctrlpt.c:1518
TvCtrlPointPrintShortHelp
void TvCtrlPointPrintShortHelp(void)
Print help info for this application.
Definition tv_ctrlpt.c:1338
TvVarName
const char * TvVarName[2][4]
Definition tv_ctrlpt.c:69
TvServiceName
const char * TvServiceName[]
Definition tv_ctrlpt.c:63
TvStateUpdate
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:832
state_update
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
TvCtrlPointStart
int TvCtrlPointStart(char *iface, 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:1270
TvCtrlPointPrintLongHelp
void TvCtrlPointPrintLongHelp(void)
Print long help info for this application.
Definition tv_ctrlpt.c:1361
GlobalDeviceList
struct TvDeviceNode * GlobalDeviceList
Definition tv_ctrlpt.c:83
DOMString
#define DOMString
The type of DOM strings.
Definition ixml.h:48
sample_util.h
TvDeviceNode
Definition tv_ctrlpt.h:112
TvDevice
Definition tv_ctrlpt.h:102
TvService
Definition tv_device.h:159
_IXML_Document
Data structure representing the DOM Document.
Definition ixml.h:160
tv_service
Definition tv_ctrlpt.h:90
upnp.h
upnptools.h