/usr/share/doc/kodi-eventclients-dev/examples/c++/example_log.cpp is in kodi-eventclients-dev 15.2+dfsg1-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include "../../lib/c++/xbmcclient.h"
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
int main(int argc, char **argv)
{
/* connect to localhost, port 9777 using a UDP socket
this only needs to be done once.
by default this is where XBMC will be listening for incoming
connections. */
CAddress my_addr; // Address => localhost on 9777
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0)
{
printf("Error creating socket\n");
return -1;
}
my_addr.Bind(sockfd);
//Normally this is already done by the client
CPacketHELO HeloPackage("LOG Test", ICON_NONE);
HeloPackage.Send(sockfd, my_addr);
sleep(5);
//This works as XBMC internal CLog::LOG(LOGTYPE, STRING);
CPacketLOG packet(LOGERROR, "The Log Message");
packet.Send(sockfd, my_addr);
// BYE is not required since XBMC would have shut down
CPacketBYE bye; // CPacketPing if you want to ping
bye.Send(sockfd, my_addr);
}
|