[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] Additional programs and language bindings branch, master, updated.
From: |
Daniele Forsi |
Subject: |
[SCM] Additional programs and language bindings branch, master, updated. 032f622ce9285b2e043858ce6b556d463261446c |
Date: |
Sun, 12 Jan 2014 17:24:23 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Additional programs and language bindings".
The branch, master has been updated
via 032f622ce9285b2e043858ce6b556d463261446c (commit)
from d0e79857da52f12a226b1d8ac1904035882b7bc5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii/gnokii-extras.git/commit/?id=032f622ce9285b2e043858ce6b556d463261446c
commit 032f622ce9285b2e043858ce6b556d463261446c
Author: Daniele Forsi <address@hidden>
Date: Sun Jan 12 14:11:27 2014 +0100
Split PROGS list
So it's easier to see changes.
diff --git a/snippets/misc/Makefile b/snippets/misc/Makefile
index eaf3a9f..ec898f0 100644
--- a/snippets/misc/Makefile
+++ b/snippets/misc/Makefile
@@ -1,6 +1,13 @@
# $Id$
-PROGS = error_codes error_codes_intl events get_supported_phone_model
gnokii_error gnokii_memory memory_names
+PROGS = \
+ error_codes \
+ error_codes_intl \
+ events \
+ get_supported_phone_model \
+ gnokii_error \
+ gnokii_memory \
+ memory_names
TOPDIR = ..
include ${TOPDIR}/Makefile.global
diff --git a/snippets/misc/photo.c b/snippets/misc/photo.c
new file mode 100644
index 0000000..491f67b
--- /dev/null
+++ b/snippets/misc/photo.c
@@ -0,0 +1,113 @@
+/*
+
+ $Id$
+
+ G N O K I I
+
+ A Linux/Unix toolset and driver for the mobile phones.
+
+ This file is part of gnokii.
+
+ Gnokii is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ Gnokii is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with gnokii; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Copyright (C) 2014 by Daniele Forsi
+
+ Takes a photo with the camera built into the phone.
+
+ compile with
+ gcc -Wall -o photo battery_level.c `pkg-config --libs gnokii`
+
+ usage:
+ photo
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+
+#include <gnokii.h>
+
+/* prepare for i18n */
+#define _(x) x
+
+struct gn_statemachine *state = NULL;
+
+void busterminate(void) {
+ gn_lib_phone_close(state);
+ gn_lib_phoneprofile_free(&state);
+ gn_lib_library_free();
+}
+
+void businit(void) {
+ gn_error error;
+
+ atexit(busterminate);
+
+ error = gn_lib_phoneprofile_load(NULL, &state);
+ if (GN_ERR_NONE == error) {
+ error = gn_lib_phone_open(state);
+ }
+
+ if (GN_ERR_NONE != error) {
+ fprintf(stderr, "%s\n", gn_error_print(error));
+ exit(-1);
+ }
+}
+
+void signal_handler(int signal) {
+ (void)signal;
+ exit(-2);
+}
+
+/* Definitions stolen from private includes */
+#define FBUS_FRAME_HEADER 0x00, 0x01, 0x00
+#define NK6510_MSG_KEYPRESS 0x0c
+
+int main(int argc, char *argv[]) {
+ gn_data data;
+ gn_error error;
+ unsigned char req[] = {FBUS_FRAME_HEADER, 0x11, 0,
+ 2, /* number of keypresses */
+ 1, 0x08 /* block length */, 0xe0, 0x5c, 1 /*
press */, 0, 0, 0,
+ 1, 0x08 /* block length */, 0xe0, 0x5c, 0 /*
release */, 0, 0, 0};
+ gn_raw_buffer write_buffer = {NK6510_MSG_KEYPRESS, sizeof(req), req};
+ gn_raw_buffer read_buffer = {0, 0, NULL};
+
+ if (argc != 1) {
+ fprintf(stderr, _("Usage: %s\nPurpose: take a photo with
supported phones\n"), argv[0]);
+ exit(-1);
+ }
+
+ businit();
+
+ signal(SIGINT, signal_handler);
+
+ gn_data_clear(&data);
+
+ /* Press the camera button twice to take a photo */
+ data.write_buffer = &write_buffer;
+ data.read_buffer = &read_buffer;
+ error = gn_sm_functions(GN_OP_Passthrough, &data, state);
+ if (error == GN_ERR_NONE) {
+ /* Need to wait a little before the camera app is ready */
+ sleep(2);
+ error = gn_sm_functions(GN_OP_Passthrough, &data, state);
+ /* Now we could wait for the photo to be saved, then exit the
camera app */
+ }
+
+ exit(error);
+}
diff --git a/snippets/misc/photo.readme b/snippets/misc/photo.readme
new file mode 100644
index 0000000..2211bed
--- /dev/null
+++ b/snippets/misc/photo.readme
@@ -0,0 +1,8 @@
+$Id$
+
+Takes a photo emulating keypresses.
+Tested on Series 40 3rd (Nokia 5300).
+
+Example:
+
+./photo
-----------------------------------------------------------------------
Summary of changes:
snippets/misc/Makefile | 9 +++++-
snippets/{monitor/rf_level.c => misc/photo.c} | 37 +++++++++++++++---------
snippets/misc/photo.readme | 8 +++++
3 files changed, 39 insertions(+), 15 deletions(-)
copy snippets/{monitor/rf_level.c => misc/photo.c} (60%)
create mode 100644 snippets/misc/photo.readme
hooks/post-receive
--
Additional programs and language bindings
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] Additional programs and language bindings branch, master, updated. 032f622ce9285b2e043858ce6b556d463261446c,
Daniele Forsi <=