mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 17:01:15 +02:00
src/zapit/zapitclient: add a mutex to protect against concurrent calls from nhttpd threads
Signed-off-by: Jacek Jendrzej <crashdvb@googlemail.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <OpenThreads/Mutex>
|
||||
|
||||
/* zapit */
|
||||
#include "zapittypes.h"
|
||||
@@ -37,6 +38,8 @@ class CZapitClient:public CBasicClient
|
||||
virtual unsigned char getVersion () const;
|
||||
virtual const char * getSocketName() const;
|
||||
|
||||
OpenThreads::Mutex mutex;
|
||||
|
||||
public:
|
||||
enum events
|
||||
{
|
||||
|
@@ -27,6 +27,8 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include <OpenThreads/ScopedLock>
|
||||
|
||||
/* libevent */
|
||||
#include <eventserver.h>
|
||||
|
||||
@@ -66,6 +68,7 @@ void CZapitClient::zapTo(const unsigned int bouquet, const unsigned int channel)
|
||||
msg.bouquet = bouquet;
|
||||
msg.channel = channel - 1;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_ZAPTO, (char*)&msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -78,6 +81,7 @@ void CZapitClient::zapTo(const unsigned int channel)
|
||||
|
||||
msg.channel = channel - 1;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_ZAPTO_CHANNELNR, (const char *) & msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -85,6 +89,7 @@ void CZapitClient::zapTo(const unsigned int channel)
|
||||
|
||||
t_channel_id CZapitClient::getCurrentServiceID()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_CURRENT_SERVICEID);
|
||||
|
||||
CZapitMessages::responseGetCurrentServiceID response;
|
||||
@@ -97,6 +102,7 @@ t_channel_id CZapitClient::getCurrentServiceID()
|
||||
|
||||
CZapitClient::CCurrentServiceInfo CZapitClient::getCurrentServiceInfo()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_CURRENT_SERVICEINFO);
|
||||
|
||||
CZapitClient::CCurrentServiceInfo response;
|
||||
@@ -109,6 +115,7 @@ CZapitClient::CCurrentServiceInfo CZapitClient::getCurrentServiceInfo()
|
||||
#if 0
|
||||
void CZapitClient::getLastChannel(t_channel_id &channel_id, int &mode)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_LAST_CHANNEL);
|
||||
|
||||
CZapitClient::responseGetLastChannel response;
|
||||
@@ -123,6 +130,7 @@ void CZapitClient::getLastChannel(t_channel_id &channel_id, int &mode)
|
||||
#if 0
|
||||
int32_t CZapitClient::getCurrentSatellitePosition(void)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_CURRENT_SATELLITE_POSITION);
|
||||
|
||||
int32_t response;
|
||||
@@ -139,6 +147,7 @@ void CZapitClient::setAudioChannel(const unsigned int channel)
|
||||
|
||||
msg.channel = channel;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SET_AUDIOCHAN, (const char *) & msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -154,6 +163,7 @@ unsigned int CZapitClient::zapTo_serviceID(const t_channel_id channel_id)
|
||||
msg.pip = false;
|
||||
msg.epg = false;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_ZAPTO_SERVICEID, (const char *) & msg, sizeof(msg));
|
||||
|
||||
CZapitMessages::responseZapComplete response;
|
||||
@@ -173,6 +183,7 @@ unsigned int CZapitClient::zapTo_record(const t_channel_id channel_id)
|
||||
msg.pip = false;
|
||||
msg.epg = false;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_ZAPTO_SERVICEID, (const char *) & msg, sizeof(msg));
|
||||
|
||||
CZapitMessages::responseZapComplete response;
|
||||
@@ -192,6 +203,7 @@ unsigned int CZapitClient::zapTo_pip(const t_channel_id channel_id)
|
||||
msg.pip = true;
|
||||
msg.epg = false;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_ZAPTO_SERVICEID, (const char *) & msg, sizeof(msg));
|
||||
|
||||
CZapitMessages::responseZapComplete response;
|
||||
@@ -209,6 +221,7 @@ unsigned int CZapitClient::zapTo_epg(const t_channel_id channel_id, bool standby
|
||||
msg.channel_id = channel_id;
|
||||
msg.standby = standby;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_ZAPTO_EPG, (const char *) & msg, sizeof(msg));
|
||||
|
||||
CZapitMessages::responseZapComplete response;
|
||||
@@ -228,6 +241,7 @@ unsigned int CZapitClient::zapTo_subServiceID(const t_channel_id channel_id)
|
||||
msg.pip = false;
|
||||
msg.epg = false;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_ZAPTO_SUBSERVICEID, (const char *) & msg, sizeof(msg));
|
||||
|
||||
CZapitMessages::responseZapComplete response;
|
||||
@@ -248,6 +262,7 @@ void CZapitClient::zapTo_serviceID_NOWAIT(const t_channel_id channel_id)
|
||||
msg.pip = false;
|
||||
msg.epg = false;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_ZAPTO_SERVICEID_NOWAIT, (const char *) & msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -263,6 +278,7 @@ void CZapitClient::zapTo_subServiceID_NOWAIT(const t_channel_id channel_id)
|
||||
msg.pip = false;
|
||||
msg.epg = false;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_ZAPTO_SUBSERVICEID_NOWAIT, (const char *) & msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -275,6 +291,7 @@ void CZapitClient::setMode(const channelsMode mode)
|
||||
|
||||
msg.mode = mode;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SET_MODE, (const char *) & msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -282,6 +299,7 @@ void CZapitClient::setMode(const channelsMode mode)
|
||||
|
||||
int CZapitClient::getMode()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_MODE);
|
||||
|
||||
CZapitMessages::responseGetMode response;
|
||||
@@ -295,6 +313,7 @@ void CZapitClient::setSubServices( subServiceList& subServices )
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SETSUBSERVICES);
|
||||
|
||||
for (i = 0; i< subServices.size(); i++)
|
||||
@@ -308,6 +327,7 @@ void CZapitClient::getPIDS(responseGetPIDs& pids)
|
||||
CZapitMessages::responseGeneralInteger responseInteger;
|
||||
responseGetAPIDs responseAPID;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GETPIDS);
|
||||
|
||||
CBasicClient::receive_data((char* )&(pids.PIDs), sizeof(pids.PIDs));
|
||||
@@ -322,7 +342,7 @@ void CZapitClient::getPIDS(responseGetPIDs& pids)
|
||||
{
|
||||
CBasicClient::receive_data((char*)&responseAPID, sizeof(responseAPID));
|
||||
pids.APIDs.push_back(responseAPID);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
close_connection();
|
||||
@@ -334,6 +354,7 @@ void CZapitClient::zaptoNvodSubService(const int num)
|
||||
|
||||
msg.val = num;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_NVOD_SUBSERVICE_NUM, (const char *) & msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -350,6 +371,7 @@ void CZapitClient::getBouquets(BouquetList& bouquets, const bool emptyBouquetsTo
|
||||
msg.emptyBouquetsToo = emptyBouquetsToo;
|
||||
msg.mode = mode;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_BOUQUETS, (char*)&msg, sizeof(msg));
|
||||
|
||||
responseGetBouquets response;
|
||||
@@ -436,6 +458,7 @@ bool CZapitClient::getBouquetChannels(const unsigned int bouquet, BouquetChannel
|
||||
msg.bouquet = bouquet;
|
||||
msg.mode = mode;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
return_value = (send(CZapitMessages::CMD_GET_BOUQUET_CHANNELS, (char*)&msg, sizeof(msg))) ? receive_channel_list(channels, utf_encoded) : false;
|
||||
|
||||
close_connection();
|
||||
@@ -466,6 +489,7 @@ bool CZapitClient::getChannels( BouquetChannelList& channels, channelsMode mode,
|
||||
msg.mode = mode;
|
||||
msg.order = order;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
return_value = (send(CZapitMessages::CMD_GET_CHANNELS, (char*)&msg, sizeof(msg))) ? receive_channel_list(channels, utf_encoded) : false;
|
||||
|
||||
close_connection();
|
||||
@@ -479,6 +503,7 @@ bool CZapitClient::getChannels( BouquetChannelList& channels, channelsMode mode,
|
||||
/* channel name */
|
||||
std::string CZapitClient::getChannelName(const t_channel_id channel_id)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_CHANNEL_NAME, (char *) & channel_id, sizeof(channel_id));
|
||||
|
||||
CZapitMessages::responseGetChannelName response;
|
||||
@@ -491,6 +516,7 @@ std::string CZapitClient::getChannelName(const t_channel_id channel_id)
|
||||
/* is channel a TV channel ? */
|
||||
bool CZapitClient::isChannelTVChannel(const t_channel_id channel_id)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_IS_TV_CHANNEL, (char *) & channel_id, sizeof(channel_id));
|
||||
|
||||
CZapitMessages::responseGeneralTrueFalse response;
|
||||
@@ -505,6 +531,7 @@ bool CZapitClient::isChannelTVChannel(const t_channel_id channel_id)
|
||||
/* restore bouquets so as if they were just loaded */
|
||||
void CZapitClient::restoreBouquets()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_BQ_RESTORE);
|
||||
|
||||
CZapitMessages::responseCmd response;
|
||||
@@ -515,6 +542,7 @@ void CZapitClient::restoreBouquets()
|
||||
/* reloads channels and services*/
|
||||
void CZapitClient::reinitChannels()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_REINIT_CHANNELS);
|
||||
|
||||
CZapitMessages::responseCmd response;
|
||||
@@ -525,6 +553,7 @@ void CZapitClient::reinitChannels()
|
||||
//called when sectionsd updates currentservices.xml
|
||||
void CZapitClient::reloadCurrentServices()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_RELOAD_CURRENTSERVICES);
|
||||
#if 0
|
||||
CZapitMessages::responseCmd response;
|
||||
@@ -539,6 +568,7 @@ void CZapitClient::muteAudio(const bool mute)
|
||||
|
||||
msg.truefalse = mute;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_MUTE, (char*)&msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -548,6 +578,7 @@ bool CZapitClient::getMuteStatus()
|
||||
{
|
||||
CZapitMessages::commandBoolean msg;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_MUTE_STATUS, (char*)&msg, sizeof(msg));
|
||||
CBasicClient::receive_data((char*)&msg, sizeof(msg));
|
||||
close_connection();
|
||||
@@ -561,6 +592,7 @@ void CZapitClient::setVolume(const unsigned int left, const unsigned int right)
|
||||
msg.left = left;
|
||||
msg.right = right;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SET_VOLUME, (char*)&msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -570,6 +602,7 @@ void CZapitClient::getVolume(unsigned int *left, unsigned int *right)
|
||||
{
|
||||
CZapitMessages::commandVolume msg;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_VOLUME, 0, 0);
|
||||
|
||||
CBasicClient::receive_data((char*)&msg, sizeof(msg));
|
||||
@@ -582,6 +615,7 @@ void CZapitClient::getVolume(unsigned int *left, unsigned int *right)
|
||||
//never used
|
||||
delivery_system_t CZapitClient::getDeliverySystem(void)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_DELIVERY_SYSTEM, 0, 0);
|
||||
|
||||
CZapitMessages::responseDeliverySystem response;
|
||||
@@ -598,6 +632,7 @@ delivery_system_t CZapitClient::getDeliverySystem(void)
|
||||
bool CZapitClient::get_current_TP(transponder* TP)
|
||||
{
|
||||
TP_params TP_temp;
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_CURRENT_TP);
|
||||
bool reply = CBasicClient::receive_data((char*)&TP_temp, sizeof(TP_temp));
|
||||
memmove(TP, &TP_temp, sizeof(TP_temp));
|
||||
@@ -617,6 +652,7 @@ void CZapitClient::sendMotorCommand(uint8_t cmdtype, uint8_t address, uint8_t cm
|
||||
msg.param1 = param1;
|
||||
msg.param2 = param2;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SEND_MOTOR_COMMAND, (char*)&msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -632,6 +668,7 @@ void CZapitClient::sendMotorCommand(uint8_t cmdtype, uint8_t address, uint8_t cm
|
||||
/* start TS-Scan */
|
||||
bool CZapitClient::startScan(const int scan_mode)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
bool reply = send(CZapitMessages::CMD_SCANSTART, (char*)&scan_mode, sizeof(scan_mode));
|
||||
|
||||
close_connection();
|
||||
@@ -640,6 +677,7 @@ bool CZapitClient::startScan(const int scan_mode)
|
||||
}
|
||||
bool CZapitClient::stopScan()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
bool reply = send(CZapitMessages::CMD_SCANSTOP);
|
||||
close_connection();
|
||||
return reply;
|
||||
@@ -661,6 +699,7 @@ void CZapitClient::getConfig (Zapit_config * Cfg)
|
||||
#endif
|
||||
bool CZapitClient::Rezap()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
bool reply = send(CZapitMessages::CMD_REZAP);
|
||||
close_connection();
|
||||
return reply;
|
||||
@@ -669,12 +708,14 @@ bool CZapitClient::Rezap()
|
||||
/* start manual scan */
|
||||
bool CZapitClient::scan_TP(TP_params TP)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
bool reply = send(CZapitMessages::CMD_SCAN_TP, (char*)&TP, sizeof(TP));
|
||||
close_connection();
|
||||
return reply;
|
||||
}
|
||||
bool CZapitClient::tune_TP(TP_params TP)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
bool reply = send(CZapitMessages::CMD_TUNE_TP, (char*)&TP, sizeof(TP));
|
||||
close_connection();
|
||||
return reply;
|
||||
@@ -683,6 +724,7 @@ bool CZapitClient::tune_TP(TP_params TP)
|
||||
/* query if ts-scan is ready - response gives status */
|
||||
bool CZapitClient::isScanReady(unsigned int &satellite, unsigned int &processed_transponder, unsigned int &transponder, unsigned int &services )
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SCANREADY);
|
||||
|
||||
CZapitMessages::responseIsScanReady response;
|
||||
@@ -702,6 +744,7 @@ void CZapitClient::getScanSatelliteList(SatelliteList& satelliteList)
|
||||
{
|
||||
uint32_t satlength;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SCANGETSATLIST);
|
||||
|
||||
responseGetSatelliteList response;
|
||||
@@ -723,6 +766,7 @@ void CZapitClient::getScanSatelliteList(SatelliteList& satelliteList)
|
||||
/* tell zapit which satellites to scan*/
|
||||
void CZapitClient::setScanSatelliteList( ScanSatelliteList& satelliteList )
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SCANSETSCANSATLIST);
|
||||
|
||||
for (uint32_t i=0; i<satelliteList.size(); i++)
|
||||
@@ -736,6 +780,7 @@ void CZapitClient::setScanSatelliteList( ScanSatelliteList& satelliteList )
|
||||
/* tell zapit stored satellite positions in diseqc 1.2 motor */
|
||||
void CZapitClient::setScanMotorPosList( ScanMotorPosList& motorPosList )
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SCANSETSCANMOTORPOSLIST);
|
||||
|
||||
for (uint32_t i = 0; i < motorPosList.size(); i++)
|
||||
@@ -749,6 +794,7 @@ void CZapitClient::setScanMotorPosList( ScanMotorPosList& motorPosList )
|
||||
/* set diseqcType*/
|
||||
void CZapitClient::setDiseqcType(const diseqc_t diseqc)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SCANSETDISEQCTYPE, (const char *) & diseqc, sizeof(diseqc));
|
||||
close_connection();
|
||||
}
|
||||
@@ -756,6 +802,7 @@ void CZapitClient::setDiseqcType(const diseqc_t diseqc)
|
||||
/* set diseqcRepeat*/
|
||||
void CZapitClient::setDiseqcRepeat(const uint32_t repeat)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SCANSETDISEQCREPEAT, (const char *) & repeat, sizeof(repeat));
|
||||
close_connection();
|
||||
}
|
||||
@@ -763,6 +810,7 @@ void CZapitClient::setDiseqcRepeat(const uint32_t repeat)
|
||||
/* set diseqcRepeat*/
|
||||
void CZapitClient::setScanBouquetMode(const bouquetMode mode)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SCANSETBOUQUETMODE, (const char *) & mode, sizeof(mode));
|
||||
close_connection();
|
||||
}
|
||||
@@ -771,6 +819,7 @@ void CZapitClient::setScanBouquetMode(const bouquetMode mode)
|
||||
/* set Scan-TYpe for channelsearch */
|
||||
void CZapitClient::setScanType(const scanType mode)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SCANSETTYPE, (const char *) & mode, sizeof(mode));
|
||||
close_connection();
|
||||
}
|
||||
@@ -783,6 +832,7 @@ void CZapitClient::getFESignal (struct responseFESignal &f)
|
||||
{
|
||||
struct responseFESignal rsignal;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_FE_SIGNAL);
|
||||
CBasicClient::receive_data((char *) &rsignal, sizeof(rsignal));
|
||||
|
||||
@@ -803,6 +853,7 @@ void CZapitClient::getFESignal (struct responseFESignal &f)
|
||||
/* adds bouquet at the end of the bouquetlist */
|
||||
void CZapitClient::addBouquet(const char * const name)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
if (send(CZapitMessages::CMD_BQ_ADD_BOUQUET))
|
||||
send_string(name);
|
||||
|
||||
@@ -818,6 +869,7 @@ void CZapitClient::moveBouquet(const unsigned int bouquet, const unsigned int ne
|
||||
msg.bouquet = bouquet;
|
||||
msg.newPos = newPos;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_BQ_MOVE_BOUQUET, (char*)&msg, sizeof(msg));
|
||||
close_connection();
|
||||
}
|
||||
@@ -830,6 +882,7 @@ void CZapitClient::deleteBouquet(const unsigned int bouquet)
|
||||
|
||||
msg.bouquet = bouquet;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_BQ_DELETE_BOUQUET, (char*)&msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -843,6 +896,7 @@ void CZapitClient::renameBouquet(const unsigned int bouquet, const char * const
|
||||
|
||||
msg.bouquet = bouquet;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
if (send(CZapitMessages::CMD_BQ_RENAME_BOUQUET, (char*)&msg, sizeof(msg)))
|
||||
send_string(newName);
|
||||
|
||||
@@ -856,6 +910,7 @@ signed int CZapitClient::existsBouquet(const char * const name)
|
||||
{
|
||||
CZapitMessages::responseGeneralInteger response;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
if (send(CZapitMessages::CMD_BQ_EXISTS_BOUQUET))
|
||||
send_string(name);
|
||||
|
||||
@@ -876,6 +931,7 @@ bool CZapitClient::existsChannelInBouquet(const unsigned int bouquet, const t_ch
|
||||
msg.bouquet = bouquet;
|
||||
msg.channel_id = channel_id;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_BQ_EXISTS_CHANNEL_IN_BOUQUET, (char*)&msg, sizeof(msg));
|
||||
|
||||
CBasicClient::receive_data((char* )&response, sizeof(response));
|
||||
@@ -896,6 +952,7 @@ void CZapitClient::moveChannel( unsigned int bouquet, unsigned int oldPos, unsig
|
||||
msg.newPos = newPos - 1;
|
||||
msg.mode = mode;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_BQ_MOVE_CHANNEL, (char*)&msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -913,6 +970,7 @@ void CZapitClient::addChannelToBouquet(const unsigned int bouquet, const t_chann
|
||||
msg.bouquet = bouquet;
|
||||
msg.channel_id = channel_id;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_BQ_ADD_CHANNEL_TO_BOUQUET, (char*)&msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -927,6 +985,7 @@ void CZapitClient::removeChannelFromBouquet(const unsigned int bouquet, const t_
|
||||
msg.bouquet = bouquet;
|
||||
msg.channel_id = channel_id;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_BQ_REMOVE_CHANNEL_FROM_BOUQUET, (char*)&msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -934,13 +993,14 @@ void CZapitClient::removeChannelFromBouquet(const unsigned int bouquet, const t_
|
||||
|
||||
/* set a bouquet's lock-state*/
|
||||
/* bouquets are numbered starting at 0 */
|
||||
void CZapitClient::setBouquetLock(const unsigned int bouquet, const bool lock)
|
||||
void CZapitClient::setBouquetLock(const unsigned int bouquet, const bool b)
|
||||
{
|
||||
CZapitMessages::commandBouquetState msg;
|
||||
|
||||
msg.bouquet = bouquet;
|
||||
msg.state = lock;
|
||||
msg.state = b;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_BQ_SET_LOCKSTATE, (char*)&msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -955,6 +1015,7 @@ void CZapitClient::setBouquetHidden(const unsigned int bouquet, const bool hidde
|
||||
msg.bouquet = bouquet;
|
||||
msg.state = hidden;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_BQ_SET_HIDDENSTATE, (char*)&msg, sizeof(msg));
|
||||
close_connection();
|
||||
}
|
||||
@@ -964,6 +1025,7 @@ void CZapitClient::setBouquetHidden(const unsigned int bouquet, const bool hidde
|
||||
/* necessarily after bouquet editing operations*/
|
||||
void CZapitClient::renumChannellist()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_BQ_RENUM_CHANNELLIST);
|
||||
close_connection();
|
||||
}
|
||||
@@ -975,6 +1037,7 @@ void CZapitClient::saveBouquets(const bool saveall)
|
||||
CZapitMessages::commandBoolean msg;
|
||||
msg.truefalse = saveall;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_BQ_SAVE_BOUQUETS, (char*)&msg, sizeof(msg));
|
||||
|
||||
CZapitMessages::responseCmd response;
|
||||
@@ -987,6 +1050,7 @@ void CZapitClient::setStandby(const bool enable)
|
||||
{
|
||||
CZapitMessages::commandBoolean msg;
|
||||
msg.truefalse = enable;
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SET_STANDBY, (char*)&msg, sizeof(msg));
|
||||
if(enable) {
|
||||
CZapitMessages::responseCmd response;
|
||||
@@ -999,18 +1063,21 @@ void CZapitClient::setVideoSystem(int video_system)
|
||||
{
|
||||
CZapitMessages::commandInt msg;
|
||||
msg.val = video_system;
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SET_VIDEO_SYSTEM, (char*)&msg, sizeof(msg));
|
||||
close_connection();
|
||||
}
|
||||
|
||||
void CZapitClient::startPlayBack()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SB_START_PLAYBACK);
|
||||
close_connection();
|
||||
}
|
||||
|
||||
void CZapitClient::stopPlayBack()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SB_STOP_PLAYBACK);
|
||||
CZapitMessages::responseCmd response;
|
||||
CBasicClient::receive_data((char* )&response, sizeof(response));
|
||||
@@ -1019,6 +1086,7 @@ void CZapitClient::stopPlayBack()
|
||||
|
||||
void CZapitClient::stopPip()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_STOP_PIP);
|
||||
CZapitMessages::responseCmd response;
|
||||
CBasicClient::receive_data((char* )&response, sizeof(response));
|
||||
@@ -1027,6 +1095,7 @@ void CZapitClient::stopPip()
|
||||
|
||||
void CZapitClient::lockPlayBack()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SB_LOCK_PLAYBACK);
|
||||
CZapitMessages::responseCmd response;
|
||||
CBasicClient::receive_data((char* )&response, sizeof(response));
|
||||
@@ -1034,6 +1103,7 @@ void CZapitClient::lockPlayBack()
|
||||
}
|
||||
void CZapitClient::unlockPlayBack()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SB_UNLOCK_PLAYBACK);
|
||||
CZapitMessages::responseCmd response;
|
||||
CBasicClient::receive_data((char* )&response, sizeof(response));
|
||||
@@ -1042,6 +1112,7 @@ void CZapitClient::unlockPlayBack()
|
||||
|
||||
bool CZapitClient::isPlayBackActive()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SB_GET_PLAYBACK_ACTIVE);
|
||||
|
||||
CZapitMessages::responseGetPlaybackState response;
|
||||
@@ -1063,6 +1134,7 @@ void CZapitClient::setAudioMode(const int mode)
|
||||
{
|
||||
CZapitMessages::commandInt msg;
|
||||
msg.val = mode;
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SET_AUDIO_MODE, (char*)&msg, sizeof(msg));
|
||||
close_connection();
|
||||
}
|
||||
@@ -1071,6 +1143,7 @@ void CZapitClient::setAudioMode(const int mode)
|
||||
void CZapitClient::getAudioMode(int * mode)
|
||||
{
|
||||
CZapitMessages::commandInt msg;
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_AUDIO_MODE, 0, 0);
|
||||
CBasicClient::receive_data((char* )&msg, sizeof(msg));
|
||||
* mode = msg.val;
|
||||
@@ -1081,6 +1154,7 @@ void CZapitClient::setRecordMode(const bool activate)
|
||||
{
|
||||
CZapitMessages::commandSetRecordMode msg;
|
||||
msg.activate = activate;
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SET_RECORD_MODE, (char*)&msg, sizeof(msg));
|
||||
close_connection();
|
||||
}
|
||||
@@ -1096,6 +1170,7 @@ void CZapitClient::setEventMode(const bool activate)
|
||||
#endif
|
||||
bool CZapitClient::isRecordModeActive()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_RECORD_MODE);
|
||||
|
||||
CZapitMessages::responseGetRecordModeState response;
|
||||
@@ -1108,6 +1183,7 @@ bool CZapitClient::isRecordModeActive()
|
||||
void CZapitClient::getAspectRatio(int *ratio)
|
||||
{
|
||||
CZapitMessages::commandInt msg;
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_ASPECTRATIO, 0, 0);
|
||||
CBasicClient::receive_data((char* )&msg, sizeof(msg));
|
||||
* ratio = msg.val;
|
||||
@@ -1118,6 +1194,7 @@ void CZapitClient::setAspectRatio(int ratio)
|
||||
{
|
||||
CZapitMessages::commandInt msg;
|
||||
msg.val = ratio;
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SET_ASPECTRATIO, (char*)&msg, sizeof(msg));
|
||||
close_connection();
|
||||
}
|
||||
@@ -1125,6 +1202,7 @@ void CZapitClient::setAspectRatio(int ratio)
|
||||
void CZapitClient::getMode43(int *m43)
|
||||
{
|
||||
CZapitMessages::commandInt msg;
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_GET_MODE43, 0, 0);
|
||||
CBasicClient::receive_data((char* )&msg, sizeof(msg));
|
||||
* m43 = msg.val;
|
||||
@@ -1135,6 +1213,7 @@ void CZapitClient::setMode43(int m43)
|
||||
{
|
||||
CZapitMessages::commandInt msg;
|
||||
msg.val = m43;
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_SET_MODE43, (char*)&msg, sizeof(msg));
|
||||
close_connection();
|
||||
}
|
||||
@@ -1148,6 +1227,7 @@ void CZapitClient::registerEvent(const unsigned int eventID, const unsigned int
|
||||
|
||||
strcpy(msg.udsName, udsName);
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_REGISTEREVENTS, (char*)&msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
@@ -1160,6 +1240,7 @@ void CZapitClient::unRegisterEvent(const unsigned int eventID, const unsigned in
|
||||
msg.eventID = eventID;
|
||||
msg.clientID = clientID;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
||||
send(CZapitMessages::CMD_UNREGISTEREVENTS, (char*)&msg, sizeof(msg));
|
||||
|
||||
close_connection();
|
||||
|
@@ -49,7 +49,9 @@ pzapit_SOURCES = \
|
||||
|
||||
pzapit_LDADD = \
|
||||
$(top_builddir)/src/zapit/lib/libzapitclient.a \
|
||||
$(top_builddir)/lib/connection/libtuxbox-connection.a
|
||||
$(top_builddir)/lib/connection/libtuxbox-connection.a \
|
||||
-lOpenThreads \
|
||||
-lpthread
|
||||
|
||||
udpstreampes_SOURCES = \
|
||||
udpstreampes.cpp
|
||||
@@ -57,4 +59,5 @@ udpstreampes_SOURCES = \
|
||||
udpstreampes_LDADD = \
|
||||
$(top_builddir)/src/zapit/lib/libzapitclient.a \
|
||||
$(top_builddir)/lib/connection/libtuxbox-connection.a \
|
||||
-lOpenThreads \
|
||||
-lpthread
|
||||
|
Reference in New Issue
Block a user