tv_device.c File Reference
Sample Code
`#include "tv_device.h"`
`#include "upnp.h"`
`#include "upnpdebug.h"`
`#include <assert.h>`
`#include "posix_overwrites.h"`
Include dependency graph for tv_device.c:

## Macros

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

## Device Sample Module

#define | DEFAULT_WEB_DIR "./web"
#define | DESC_URL_SIZE 200
const char * | tvc_varname [] = {"Power", "Channel", "Volume"}
char | tvc_varval [3][5]
const char * | tvc_varval_def [] = {"1", "1", "5"}
const char * | tvp_varname [] = {"Color", "Tint", "Contrast", "Brightness"}
char | tvp_varval [4][5]
const char * | tvp_varval_def [] = {"5", "5", "5", "5"}
int | default_advr_expire = 100
struct TvService | tv_service_table [2]
UpnpDevice_Handle | device_handle = -1
ithread_mutex_t | TVDevMutex
static int | SetServiceTable (int serviceType, const char *UDN, const char *serviceId, const char *serviceTypeS, struct TvService *out)
| Initializes the service table for the specified service.
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 ( const UpnpSubscriptionRequest *sr_event)
| Called during a subscription request callback.
int | TvDeviceHandleGetVarRequest ( UpnpStateVarRequest *cgv_event)
| Called during a get variable request callback.
int | TvDeviceHandleActionRequest ( UpnpActionRequest *ca_event)
| Called during an action request callback.
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.
static int | TvDeviceSetPower (int on)
| Turn the power on/off, update the TvDevice control 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 | IncrementChannel (int incr, IXML_Document *in, IXML_Document **out, const char **errorString)
int | TvDeviceDecreaseChannel ( IXML_Document *in, IXML_Document **out, const char **errorString)
| Decrease the channel.
int | TvDeviceIncreaseChannel ( IXML_Document *in, IXML_Document **out, const char **errorString)
| Increase 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.
static int | IncrementVolume (int incr, IXML_Document *in, IXML_Document **out, const char **errorString)
| Increment the volume. Read the current volume from the state table, add the increment, and then change the volume.
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.
static int | IncrementColor (int incr, IXML_Document *in, IXML_Document **out, const char **errorString)
| Increment the color. Read the current color from the state table, add the increment, and then change the color.
int | TvDeviceDecreaseColor ( IXML_Document *in, IXML_Document **out, const char **errorString)
| Decrease the color.
int | TvDeviceIncreaseColor ( IXML_Document *in, IXML_Document **out, const char **errorString)
| Increase 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 | IncrementTint (int incr, IXML_Document *in, IXML_Document **out, const char **errorString)
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.
static int | IncrementContrast (int incr, IXML_Document *in, IXML_Document **out, const char **errorString)
| Increment the contrast. Read the current contrast from the state table, add the increment, and then change the contrast.
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.
static int | IncrementBrightness (int incr, IXML_Document *in, IXML_Document **out, const char **errorString)
| Increment the brightness. Read the current brightness from the state table, add the increment, and then change the brightness.
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 | TvDeviceCallbackEventHandler ( Upnp_EventType, const void *Event, void *Cookie)
| The callback handler registered with the SDK while registering root device.
int | TvDeviceStart ( char *iface, unsigned short port, const char *desc_doc_name, const char *web_dir_path, int ip_mode, 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.