Skip to content

Commit

Permalink
tests and coveralls cover
Browse files Browse the repository at this point in the history
  • Loading branch information
agsh committed Dec 25, 2014
1 parent 75edb79 commit fb75337
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
service_name: travis-ci
repo_token: o73BiIANdR3JrQaeIEgfPilPmBufxLQUb
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# ONVIF

[![Build Status](https://travis-ci.org/agsh/onvif.png)](https://travis-ci.org/agsh/onvif)
[![Coverage Status](https://img.shields.io/coveralls/agsh/onvif.svg)](https://coveralls.io/r/agsh/onvif?branch=master)

ONVIF Node.js implementation based on this [article](http://ltoscanolm.hubpages.com/hub/onvif-programming-revealed).

![ONVIF](http://www.onvif.org/Portals/_default/Skins/onvif/images/logo-new.jpg)
[![ONVIF](http://www.onvif.org/Portals/_default/Skins/onvif/images/logo-new.jpg)](http://onvif.org)

##Supported methods
* GetSystemDateAndTime
Expand Down Expand Up @@ -74,4 +75,7 @@ Returns an object with camera DateTime

And with credentials (with passed `username` and `password` in object):

### getVideoSources
### getServices(callback)
Returns in callback and assigns to #services property an array consists of objects with properties: `namespace`, `XAddr`, `version`


14 changes: 7 additions & 7 deletions lib/onvif.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ Cam.prototype.getVideoSources = function(callback) {

/**
* Get active sources
* @private
*/
Cam.prototype.getActiveSources = function() {
if (this.videoSources.$) { // NVT is a camera
Expand Down Expand Up @@ -243,7 +244,6 @@ Cam.prototype.getProfiles = function(callback) {
this.defaultProfile = this.profiles[0]; // setting up default profile
}
if (callback) {
//TODO rewrite profiles storing
callback(null, this.profiles);
}
}.bind(this));
Expand All @@ -262,7 +262,7 @@ Cam.prototype.getServices = function(callback) {
if (err) {
return callback ? callback(err) : null;
}
this.services = _linerase(data);
this.services = _linerase(data).getServicesResponse.service;
if (callback) {
callback(null, this.services);
}
Expand Down Expand Up @@ -502,20 +502,20 @@ var _linerase = exports._linerase = function _linerase(xml) {
module.exports.Cam = Cam;

//var cam = new Cam({hostname: 'localhost', port: 10101, username: 'admin', password: '9999'}, function(err) {
var cam = new Cam({hostname: '192.168.68.111', username: 'admin', password: '9999'}, function(err) {
/*var cam = new Cam({hostname: '192.168.68.111', username: 'admin', password: '9999'}, function(err) {
if (err) {
return console.log(err);
}
console.log(JSON.stringify(this));
this.getSystemDateAndTime(console.log);
this.getServices(function(err,d){console.log(JSON.stringify(d))});
//console.log(this.ptzUri);
//this.getProfiles(function(err,d){console.log(JSON.stringify(d));});
});
/*cam.on('rawResponse', function(data) {
cam.on('rawResponse', function(data) {
console.log(data);
});*/

/*var cam = new Cam({hostname: '192.168.68.111', username: 'admin', password: '9999'}, function(err) {
var cam = new Cam({hostname: '192.168.68.111', username: 'admin', password: '9999'}, function(err) {
if (err) {
return console.log(err);
}
Expand All @@ -531,4 +531,4 @@ var cam = new Cam({hostname: '192.168.68.111', username: 'admin', password: '999
, zoom: 1
});
}.bind(this), 5000);
});*/
});
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@
},
"dependencies": {
"async": ">=0.9.0",
"coveralls": "^2.11.2",
"mocha-lcov-reporter": "0.0.1",
"xml2js": ">=0.4.4"
},
"keywords": [
"onvif",
"video"
"video",
"PTZ",
"camera"
],
"license": "MIT",
"engines": {
Expand All @@ -26,4 +30,4 @@
"devDependencies": {
"mocha": ">=2.1.0"
}
}
}
10 changes: 0 additions & 10 deletions test/getVideoSources.map

This file was deleted.

12 changes: 12 additions & 0 deletions test/simple.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,20 @@ describe 'Simple and common get functions', () ->
, port: 10101
}, done

#describe 'object '

describe 'getSystemDateAndTime', () ->
it 'should return valid date', (done) ->
cam.getSystemDateAndTime (err, data) ->
assert.equal err, null
assert.ok (data instanceof Date)
done()

describe 'getServices', () ->
it 'should return an array of services objects', (done) ->
cam.getServices (err, data) ->
assert.equal err, null
assert.ok Array.isArray data
assert.ok data.every (service) ->
service.namespace and service.XAddr and service.version
done()
15 changes: 14 additions & 1 deletion test/simple.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/simple.map
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"simple.coffee"
],
"names": [],
"mappings": ";AAAA;AAAA,MAAA,yBAAA;;AAAA,EAAA,MAAA,GAAS,OAAA,CAAQ,QAAR,CAAT,CAAA;;AAAA,EACA,GAAA,GAAM,OAAA,CAAQ,cAAR,CAAuB,CAAC,GAD9B,CAAA;;AAAA,EAEA,YAAA,GAAe,OAAA,CAAQ,gBAAR,CAFf,CAAA;;AAAA,EAIA,QAAA,CAAS,iCAAT,EAA4C,SAAA,GAAA;AAC1C,QAAA,GAAA;AAAA,IAAA,GAAA,GAAM,IAAN,CAAA;AAAA,IACA,MAAA,CAAO,SAAC,IAAD,GAAA;aACL,GAAA,GAAU,IAAA,GAAA,CAAI;AAAA,QACZ,QAAA,EAAU,WADE;AAAA,QAEV,QAAA,EAAU,OAFA;AAAA,QAGV,QAAA,EAAU,MAHA;AAAA,QAIV,IAAA,EAAM,KAJI;OAAJ,EAKP,IALO,EADL;IAAA,CAAP,CADA,CAAA;WASA,QAAA,CAAS,sBAAT,EAAiC,SAAA,GAAA;aAC/B,EAAA,CAAG,0BAAH,EAA+B,SAAC,IAAD,GAAA;eAC7B,GAAG,CAAC,oBAAJ,CAAyB,SAAC,GAAD,EAAM,IAAN,GAAA;AACvB,UAAA,MAAM,CAAC,EAAP,CAAW,IAAA,YAAgB,IAA3B,CAAA,CAAA;iBACA,IAAA,CAAA,EAFuB;QAAA,CAAzB,EAD6B;MAAA,CAA/B,EAD+B;IAAA,CAAjC,EAV0C;EAAA,CAA5C,CAJA,CAAA;AAAA"
"mappings": ";AAAA;AAAA,MAAA,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