Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

camera-vc0706

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

camera-vc0706 - npm Package Compare versions

Comparing version 0.0.25 to 0.1.0

.npmignore

23

examples/camera.js
var tessel = require('tessel');
var port = tessel.port('a');
var port = tessel.port['A'];
var camera = require('../index').use(port, function(err) {
tessel.led[1].high();
tessel.led[2].high();
var camera = require('camera-vc0706').use(port);
camera.on('ready', function(err) {
if (err) {

@@ -15,2 +20,4 @@ return console.log(err);

tessel.led[3].high();
tessel.led[3].high();
camera.takePicture(function(err, image) {

@@ -21,4 +28,8 @@ if (err) {

else {
console.log("picture length", image.length);
// TODO: Add an http outlet here
var name = 'picture-' + Math.floor(Date.now()*1000) + '.jpg';
console.log("picture size", image.length);
console.log('uploading as', name);
process.sendfile(name, image);
console.log('done.');
camera.close();
}

@@ -35,5 +46,1 @@ });

});
setInterval(function() {}, 20000);

@@ -27,3 +27,3 @@ var tessel = require('tessel');

// Turn the camera on!
hardware.gpio(3).setOutput().high();
hardware.digital[3].output().high();

@@ -175,2 +175,10 @@ // Attempt to read the version of firmware

/****
Close camera connection.
**/
Camera.prototype.close = function () {
this.uart.disable();
};
Camera.prototype._captureImageData = function(imgSize, next) {

@@ -181,6 +189,2 @@

// Set up our tx/rx buffers
var rxBuff = new Buffer(imgSize);
var txBuff = new Buffer(imgSize);
// Send the command to read the number of bytes

@@ -197,3 +201,3 @@ this._readFrameBuffer(imgSize, function imageReadCommandSent(err) {

// Begin the transfer
spi.transfer(txBuff, rxBuff, function imageDataRead(err, image){
spi.receive(imgSize, function imageDataRead(err, image){

@@ -200,0 +204,0 @@ // If there was a problem, report it

{
"name": "camera-vc0706",
"version": "0.0.25",
"version": "0.1.0",
"description": "Library to run the camera-vc0706 Tessel module",
"main": "index.js",
"scripts": {
"test": "tessel push test/test.js"
"test": "tinytap -e 'tessel run {} ${CAMERA_PORT}' test/*.js"
},

@@ -13,3 +13,2 @@ "repository": {

},
"author": "Jon McKay <jon@technical.io>",

@@ -26,6 +25,10 @@ "license": "MIT",

],
"dependencies" : {
"vclib" :"*",
"async" : "*"
"dependencies": {
"vclib": "*",
"async": "*"
},
"devDependencies": {
"jpeg-size": "~0.0.1",
"tinytap": "~0.0.2"
}
}

@@ -0,68 +1,42 @@

var jpegSize = require('jpeg-size');
var tessel = require('tessel');
var port = tessel.port('a');
var async = require('async');
var http;
// Only
function sendFile(buf) {
process.binding('hw').usb_send(0xFFFF, buf);
}
var portname = process.argv[2] || 'A';
console.log('# listening on port', portname)
var camera = require('../index').use(port, function(err) {
if (err) {
return console.log(err);
}
else {
camera.setResolution('vga', function(err) {
if (err) return console.log("Error setting resolution", err);
camera.setCompression(100, function(err) {
if (err) return console.log("Error setting compression", err);
else {
async.whilst(
function () { return true; },
function (callback) {
camera.takePicture(function(err, image) {
if (err) {
console.log("error taking image", err);
}
else {
console.log("picture length", image.length);
sendFile(image);
}
callback();
var camera = require('../').use(tessel.port[portname]);
});
},
function (err) {
console.log('damn, there was an error');
}
);
}
});
});
}
});
console.log('1..7');
camera.on('ready', function() {
console.log("We're ready!");
});
camera.on('ready', function(err) {
if (err) return console.log('not ok - error on ready:', err);
console.log('ok - camera ready');
camera.on('error', function(err) {
console.log("Error connecting", err);
});
camera.setResolution('vga', function(err) {
if (err) return console.log('not ok - error setting resolution:', err);
console.log('ok - resolution set');
camera.on('picture', function(image) {
console.log("Took a picture", image);
});
camera.setCompression(100, function(err) {
if (err) return console.log('not ok - error setting compression:', err);
console.log('ok - compression set');
camera.on('resolution', function(resolution) {
console.log("Resolution was set!", resolution);
});
camera.takePicture(function(err, image) {
if (err) return console.log('not ok - error taking image:', err);
console.log('ok - successfuly took image');
camera.on('compression', function(compression) {
console.log("Compression was set!", compression);
});
console.log(image.length > 0 ? 'ok' : 'not ok', '- picture length');
setInterval(function() {}, 20000);
var size = jpegSize(image);
console.log(size.height == 480 ? 'ok' : 'not ok', '- jpeg height');
console.log(size.width == 640 ? 'ok' : 'not ok', '- jpeg width');
console.log('# done.');
camera.close();
});
});
});
});
camera.on('error', function (err) {
console.log('not ok', '-', err);
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc