libUPnP  1.6.17
Data Structures
tv_device.h File Reference
#include <stdio.h>
#include <signal.h>
#include "sample_util.h"
#include "ithread.h"
#include "upnp.h"
#include <stdlib.h>
#include <string.h>
Include dependency graph for tv_device.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TvService

Functions

Device Sample Module
int SetActionTable (int serviceType,struct TvService *out)
 Initializes the action table for the specified service.
int TvDeviceStateTableInit (char *DescDocURL)
 Initialize the device state table for this TvDevice, pulling identifier info from the description Document.
int TvDeviceHandleSubscriptionRequest (struct Upnp_Subscription_Request *sr_event)
 Called during a subscription request callback.
int TvDeviceHandleGetVarRequest (struct Upnp_State_Var_Request *cgv_event)
 Called during a get variable request callback.
int TvDeviceHandleActionRequest (struct Upnp_Action_Request *ca_event)
 Called during an action request callback.
int TvDeviceCallbackEventHandler (Upnp_EventType,void *Event,void *Cookie)
 The callback handler registered with the SDK while registering root device.
int TvDeviceSetServiceTableVar (unsigned int service,int variable,char *value)
 Update the TvDevice service state table, and notify all subscribed control points of the updated state.
int TvDevicePowerOn (IXML_Document *in,IXML_Document **out,const char **errorString)
 Turn the power on.
int TvDevicePowerOff (IXML_Document *in,IXML_Document **out,const char **errorString)
 Turn the power off.
int TvDeviceSetChannel (IXML_Document *in,IXML_Document **out,const char **errorString)
 Change the channel, update the TvDevice control service state table, and notify all subscribed control points of the updated state.
int TvDeviceIncreaseChannel (IXML_Document *in,IXML_Document **out,const char **errorString)
 Increase the channel.
int TvDeviceDecreaseChannel (IXML_Document *in,IXML_Document **out,const char **errorString)
 Decrease the channel.
int TvDeviceSetVolume (IXML_Document *in,IXML_Document **out,const char **errorString)
 Change the volume, update the TvDevice control service state table, and notify all subscribed control points of the updated state.
int TvDeviceIncreaseVolume (IXML_Document *in,IXML_Document **out,const char **errorString)
 Increase the volume.
int TvDeviceDecreaseVolume (IXML_Document *in,IXML_Document **out,const char **errorString)
 Decrease the volume.
int TvDeviceSetColor (IXML_Document *in,IXML_Document **out,const char **errorString)
 Change the color, update the TvDevice picture service state table, and notify all subscribed control points of the updated state.
int TvDeviceIncreaseColor (IXML_Document *in,IXML_Document **out,const char **errorString)
 Increase the color.
int TvDeviceDecreaseColor (IXML_Document *in,IXML_Document **out,const char **errorString)
 Decrease the color.
int TvDeviceSetTint (IXML_Document *in,IXML_Document **out,const char **errorString)
 Change the tint, update the TvDevice picture service state table, and notify all subscribed control points of the updated state.
int TvDeviceIncreaseContrast (IXML_Document *in,IXML_Document **out,const char **errorString)
 Increase the contrast.
int TvDeviceDecreaseContrast (IXML_Document *in,IXML_Document **out,const char **errorString)
 Decrease the contrast.
int TvDeviceSetBrightness (IXML_Document *in,IXML_Document **out,const char **errorString)
 Change the brightness, update the TvDevice picture service state table, and notify all subscribed control points of the updated state.
int TvDeviceIncreaseBrightness (IXML_Document *in,IXML_Document **out,const char **errorString)
 Increase brightnesss.
int TvDeviceDecreaseBrightness (IXML_Document *in,IXML_Document **out,const char **errorString)
 Decrease brightnesss.
int TvDeviceStart (char *ip_address,unsigned short port,const char *desc_doc_name,const char *web_dir_path,print_string pfun,int combo)
 Initializes the UPnP Sdk, registers the device, and sends out advertisements.
int TvDeviceStop (void)
 Stops the device. Uninitializes the sdk.
void * TvDeviceCommandLoop (void *args)
 Function that receives commands from the user at the command prompt during the lifetime of the device, and calls the appropriate functions for those commands. Only one command, exit, is currently defined.
int device_main (int argc, char *argv[])
 Main entry point for tv device application.

Device Sample API

#define MAX_COLOR   10
#define MIN_COLOR   1
#define MAX_BRIGHTNESS   10
#define MIN_BRIGHTNESS   1
#define POWER_ON   1
#define POWER_OFF   0
#define MAX_TINT   10
#define MIN_TINT   1
#define MAX_VOLUME   10
#define MIN_VOLUME   1
#define MAX_CONTRAST   10
#define MIN_CONTRAST   1
#define MAX_CHANNEL   100
#define MIN_CHANNEL   1
#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_MAXACTIONS   12
#define TV_MAXVARS   TV_PICTURE_VARCOUNT
typedef int(* upnp_action )(IXML_Document *request, IXML_Document **out, const char **errorString)
 Prototype for all actions. For each action that a service implements, there is a corresponding function with this prototype.
struct TvService tv_service_table []
UpnpDevice_Handle device_handle
ithread_mutex_t TVDevMutex
int TvDeviceIncreaseTint (IXML_Document *in, IXML_Document **out, const char **errorString)
 Increase tint.
int TvDeviceDecreaseTint (IXML_Document *in, IXML_Document **out, const char **errorString)
 Decrease tint.
int TvDeviceSetContrast (IXML_Document *in, IXML_Document **out, const char **errorString)
 Change the contrast, update the TvDevice picture service state table, and notify all subscribed control points of the updated state.

Detailed Description