I'd like to transition https://github.com/openaps/oacids and https://github.com/bewest/openxshareble/tree/master/openxshareble and https://github.com/bewest/mmblelink and several other things to internet of things style daemons using linux to prototype these services.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
int main(int argc, char** argv) | |
{ | |
int fd, bytes; | |
unsigned char data[3]; | |
const char *pDevice = "/dev/input/mouse0"; |
I'd like to transition https://github.com/openaps/oacids and https://github.com/bewest/openxshareble/tree/master/openxshareble and https://github.com/bewest/mmblelink and several other things to internet of things style daemons using linux to prototype these services.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
g++ thisFile.cpp -I/usr/include/glib-2.0 \ | |
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include/ \ | |
-lglib-2.0 -lgio-2.0 -lgobject-2.0 | |
*/ | |
#include <iostream> | |
#include <gio/gio.h> | |
static GMainLoop* loop = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
g++ cppdbus.cpp -I/usr/include/glib-2.0 \ | |
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include/ \ | |
-lglib-2.0 -lgio-2.0 -lgobject-2.0 | |
This small program can pause/play media in vlc. Then, if the | |
tracklist is modified, the program will exit. | |
This is the dbus-monitor output corresponding to adding a track to a playlist: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
g++ cppdbus.cpp -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include/ -lglib-2.0 -lgio-2.0 -lgobject-2.0 | |
*/ | |
#include <iostream> | |
#include <gio/gio.h> | |
int main() | |
{ | |
GDBusConnection* conn = NULL; | |
GError* error = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dbus | |
import dbus.mainloop.glib | |
import time | |
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) | |
bus=dbus.SessionBus() | |
obj = bus.get_object("org.mpris.MediaPlayer2.vlc", | |
"/org/mpris/MediaPlayer2") | |
print(dir(obj)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
** client.c -- a stream socket client demo | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <netdb.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
typedef char myArr[12]; | |
void printInfo( myArr &arr, myArr arr2, myArr* arr3 ) | |
{ | |
std::cout << std::setw(10) << "arr: " << std::setw(20) << arr << std::setw(10) << " arr2: " << std::setw(20) << arr2 << std::setw(10) << " arr3: " << std::setw(20) << arr3 << std::endl; | |
std::cout << std::setw(10) << "&arr: " << std::setw(20) << &arr << std::setw(10) << " &arr2: " << std::setw(20) << &arr2 << std::setw(10) << " &arr3: " << std::setw(20) << &arr3 << std::endl; | |
std::cout << std::setw(10) << "arr[0]: " << std::setw(20) << arr[0] << std::setw(10) << " arr2[0]: " << std::setw(20) << arr2[0] << std::setw(10) << " arr3[0]: " << std::setw(20) << arr3[0] << std::endl; | |
std::cout << std::setw(10) << "&arr[0]: " << std::setw(20) << &arr[0] << std::setw(10) << " &arr2[0]: " << std::setw(20) << &arr2[0] << std::setw(10) << " &arr3[0]: " << std::setw(20) << &arr3[0] << std::endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pthread.h> | |
#include <iostream> | |
class A | |
{ | |
public: | |
A( int _i, int *_p ) : i( _i ), p( _p ){} | |
int i; | |
int *p; | |
void squareMyPtr() | |
{ |