Skip to content

Instantly share code, notes, and snippets.

#include "application.h"
// Define the pins we're going to call pinMode on
int PIR_PIN = D0;
int BUTTON_PIN = D1;
int DOOR_PIN = D2;
int LOCK_PIN = D3; // Note that on zuul this pin seems not to do INPUT_PULLDOWN
int DOORBELL_PIN = D4;
int LED_PIN = D7; // This one is the built-in tiny one to the right of the USB jack
///////////////////////////////////////////////////////// PIR
class SparkCloud : public QObject
{
Q_OBJECT
public:
explicit SparkCloud(QUrl apiurl, QObject *parent = 0);
explicit SparkCloud(QObject *parent = 0);
Q_INVOKABLE QList<QObject*> devices() { return (QList<QObject*>)(m_devices.values()); }
Q_INVOKABLE QList<QString> device_ids() { return m_devices.keys(); }
Q_INVOKABLE SparkDevice* device(QString id) { return m_devices[id]; }
void SparkVariable::callFinished(QJsonDocument json) {
if (json.isNull()) goto cleanup;
if (! json.isObject()) { qDebug() << "expected a json object"; goto cleanup; }
QJsonObject jo = json.object();
if (jo.isEmpty()) { qDebug() << "json object is empty"; goto cleanup; }
QJsonValue return_value = jo["return_value "];
QVariant value = return_value.toVariant();
qDebug() << "a function from " << m_variable << " returned " << return_value;
event: front-door
data: {"data":"closed","ttl":"60","published_at":"2014-08-22T22:35:17.419Z","coreid":"53ff6c065075535119511687"}
event: front-door-lock
data: {"data":"locked","ttl":"60","published_at":"2014-08-22T22:35:21.101Z","coreid":"53ff6c065075535119511687"}
event: porch-pir
data: {"data":"null","ttl":"60","published_at":"2014-08-22T22:35:21.302Z","coreid":"53ff6c065075535119511687"}
event: front-door
Each version of a package has a manifest; revisions are kept in .../projects/<project>.pkg/<package>[.rev|.mrev]
The rev/mrev files indicate which package manifest to use
The 3rd column holds the manifest hash and the 5th column holds the creation timestamp.
Each version of the package manifest lives in the trees area:
.../trees/<project>/<package>/
(The project has it's own set of manifest versions: _project/*MD5SUMS)
A given version of a manifest in .../trees/<project>/<package>/*-MD5SUMS file contains a list of md5sums/filename pairs
class SSEvent
{
public:
SSEvent(QString type, QString data, QString origin, QString lastEventId):
m_data(data)
, m_lastEventId(lastEventId)
, m_origin(origin)
, m_type(type) { }
QString type() const { return m_type; }
%install
rm -rf %{buildroot}
# >> install pre
# << install pre
%qmake5_install
# >> install post
mkdir -p %{buildroot}%{_datadir}/%{name}/lib
cp -a /usr/lib/libassimp* %{buildroot}%{_datadir}/%{name}/lib/
#!/usr/bin/env ruby1.9.1
# http://gist.github.com/144861
#
# Requirements:
# * ruote-2.1.10 or later
# * ruote-amqp-2.1.10 or later
# * daemon-kit-0.1.8rc3 or later
#
$:.push "./ruote-amqp/lib"
$:.push "./ruote/lib"
clock_gettime(CLOCK_REALTIME, {1276757928, 212448187}) = 0
clock_gettime(CLOCK_REALTIME, {1276757928, 212722018}) = 0
stat64("/tmp/work/expressions/be/0!!20100617-bitzuharube.json", 0xb7575d10) = -1 ENOENT (No such file or directory)
stat64("/tmp/work/expressions/be", 0xb7575d10) = -1 ENOENT (No such file or directory)
mkdir("/tmp/work/expressions/be", 0777) = 0
stat64("/tmp/work/expressions/be/0!!20100617-bitzuharube.json", 0xb7575d10) = -1 ENOENT (No such file or directory)
utimensat(AT_FDCWD, "/tmp/work/expressions/be/0!!20100617-bitzuharube.json", NULL, 0) = -1 ENOENT (No such file or directory)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
open("/tmp/work/expressions/be/0!!20100617-bitzuharube.json", O_WRONLY|O_CREAT|O_APPEND|O_LARGEFILE, 0666) = 6
ioctl(6, SNDCTL_TMR_TIMEBASE or TCGETS, 0xb7575518) = -1 ENOTTY (Inappropriate ioctl for device)
execve("./run_engine.rb", ["./run_engine.rb"], [/* 43 vars */]) = 0
brk(0) = 0x9180000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77ae000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=172486, ...}) = 0
mmap2(NULL, 172486, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7783000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)