Skip to content

Commit

Permalink
Update Mythbackend Service API for SendMessage timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Kendall committed Jan 6, 2012
1 parent 4d1c372 commit 181529f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
3 changes: 2 additions & 1 deletion mythtv/html/js/util.qjs
Expand Up @@ -179,9 +179,10 @@ function sendMessage() {
var message = $("#message").val();
var address = $("#address").val();
var port = $("#port").val();
var timeout = $("#timeout").val();

$.post("/Myth/SendMessage",
{ Message: message, Address: address, udpPort: port },
{ Message: message, Address: address, udpPort: port, Timeout: timeout },
function(data) {
result = 1;
}).error(function(data) {
Expand Down
4 changes: 4 additions & 0 deletions mythtv/html/misc/message.html
Expand Up @@ -19,6 +19,10 @@ <h3><a href="javascript:void(0)">Advanced Settings</a></h3>
<td><input id='port' size=10 value='6948'>
</td>
</tr>
<tr><th align=right>Timeout:</th>
<td><input id='timeout' size=10 value='0'>
</td>
</tr>
</table>
</p>
</div>
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythservicecontracts/services/mythServices.h
Expand Up @@ -116,7 +116,8 @@ class SERVICE_PUBLIC MythServices : public Service //, public QScriptable ???

virtual bool SendMessage ( const QString &Message,
const QString &Address,
int udpPort ) = 0;
int udpPort,
int Timeout ) = 0;

virtual bool BackupDatabase ( void ) = 0;

Expand Down
7 changes: 6 additions & 1 deletion mythtv/programs/mythbackend/services/myth.cpp
Expand Up @@ -585,16 +585,21 @@ bool Myth::TestDBSettings( const QString &sHostName,

bool Myth::SendMessage( const QString &sMessage,
const QString &sAddress,
int udpPort)
int udpPort,
int Timeout)
{
bool bResult = false;

if (sMessage.isEmpty())
return bResult;

if (Timeout < 0 || Timeout > 999)
Timeout = 0;

QString xmlMessage =
"<mythmessage version=\"1\">\n"
" <text>" + sMessage + "</text>\n"
" <timeout>" + QString::number(Timeout) + "</timeout>\n"
"</mythmessage>";

QHostAddress address = QHostAddress::Broadcast;
Expand Down
8 changes: 5 additions & 3 deletions mythtv/programs/mythbackend/services/myth.h
Expand Up @@ -75,7 +75,8 @@ class Myth : public MythServices

bool SendMessage ( const QString &Message,
const QString &Address,
int udpPort);
int udpPort,
int Timeout);

bool BackupDatabase ( void );

Expand Down Expand Up @@ -178,9 +179,10 @@ class ScriptableMyth : public QObject

bool SendMessage( const QString &Message,
const QString &Address,
int udpPort)
int udpPort,
int Timeout)
{
return m_obj.SendMessage( Message, Address, udpPort );
return m_obj.SendMessage( Message, Address, udpPort, Timeout );
}

bool BackupDatabase( void )
Expand Down

0 comments on commit 181529f

Please sign in to comment.