Permalink
Browse files

Update library

  • Loading branch information...
vshymanskyy committed Sep 25, 2018
2 parents e5e7529 + afd8bce commit e925e31760b96c6ce283ff79b0d94e970f7ac174
Showing with 113 additions and 6 deletions.
  1. +0 −2 README.md
  2. +10 −1 blynk-espruino.js
  3. +51 −1 blynk.js
  4. +51 −1 dist/blynk-browser.js
  5. +1 −1 dist/blynk-browser.min.js
  6. BIN dist/blynk-library-js.ipk
@@ -7,8 +7,6 @@ Blynk library implementation for JavaScript (Node.js, Espruino)
[![GitHub issues](https://img.shields.io/github/issues/vshymanskyy/blynk-library-js.svg)](https://github.com/vshymanskyy/blynk-library-js/issues)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/vshymanskyy/blynk-library-js)

[![NPM](https://nodei.co/npm/blynk-library.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/blynk-library/)

If you like **Blynk** - give it a star, or fork it and contribute!
[![GitHub stars](https://img.shields.io/github/stars/blynkkk/blynk-library.svg?style=social&label=Star)](https://github.com/blynkkk/blynk-library/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/blynkkk/blynk-library.svg?style=social&label=Fork)](https://github.com/blynkkk/blynk-library/network)
@@ -321,7 +321,16 @@ Blynk.prototype.onReceive = function(data) {
Blynk.prototype.sendRsp = function(msg_type, msg_id, msg_len, data) {
var self = this;
data = data || "";
msg_id = msg_id || (self.msg_id++);

if (!msg_id) {
if (self.msg_id === 0xFFFF)
self.msg_id = 1;
else
self.msg_id++;

msg_id = self.msg_id;
}

if (msg_type == MsgType.RSP) {
//console.log('< ', string_of_enum(MsgType, msg_type), msg_id, string_of_enum(MsgStatus, msg_len));
data = blynkHeader(msg_type, msg_id, msg_len)
@@ -368,6 +368,38 @@ var Blynk = function(auth, options) {
self.sendMsg(MsgType.HW, ['vw', this.pin, 'p', x, y, val]);
};
};

this.WidgetTable = function(vPin) {
this.pin = vPin;

this.clear = function() {
self.virtualWrite(this.pin, 'clr');
};

this.add_row = function(id, name, value) {
self.virtualWrite(this.pin, ['add', id, name, value]);
};

this.update_row = function(id, name, value) {
self.virtualWrite(this.pin, ['update', id, name, value]);
};

this.highlight_row = function(id) {
self.virtualWrite(this.pin, ['pick', id]);
};

this.select_row = function(id) {
self.virtualWrite(this.pin, ['select', id]);
};

this.deselect_row = function(id) {
self.virtualWrite(this.pin, ['deselect', id]);
};

this.move_row = function(old_row, new_row) {
self.virtualWrite(this.pin, ['order', old_row, new_row]);
};
};

this.WidgetLED = function(vPin) {
this.pin = vPin;
@@ -382,6 +414,15 @@ var Blynk = function(auth, options) {
self.virtualWrite(this.pin, 0);
};
};

this.WidgetMAP = function(vPin) {
this.pin = vPin;

this.location = function(index, lat, lon, value) {
var locationdata = [index, lat, lon, value]
self.virtualWrite(this.pin, locationdata);
}
};

if (needsEmitter()) {
util.inherits(this.VirtualPin, events.EventEmitter);
@@ -511,7 +552,16 @@ Blynk.prototype.onReceive = function(data) {
Blynk.prototype.sendRsp = function(msg_type, msg_id, msg_len, data) {
var self = this;
data = data || "";
msg_id = msg_id || (self.msg_id++);

if (!msg_id) {
if (self.msg_id === 0xFFFF)
self.msg_id = 1;
else
self.msg_id++;

msg_id = self.msg_id;
}

if (msg_type == MsgType.RSP) {
//console.log('< ', string_of_enum(MsgType, msg_type), msg_id, string_of_enum(MsgStatus, msg_len));
data = blynkHeader(msg_type, msg_id, msg_len)
@@ -1775,6 +1775,38 @@ var Blynk = function(auth, options) {
self.sendMsg(MsgType.HW, ['vw', this.pin, 'p', x, y, val]);
};
};

this.WidgetTable = function(vPin) {
this.pin = vPin;

this.clear = function() {
self.virtualWrite(this.pin, 'clr');
};

this.add_row = function(id, name, value) {
self.virtualWrite(this.pin, ['add', id, name, value]);
};

this.update_row = function(id, name, value) {
self.virtualWrite(this.pin, ['update', id, name, value]);
};

this.highlight_row = function(id) {
self.virtualWrite(this.pin, ['pick', id]);
};

this.select_row = function(id) {
self.virtualWrite(this.pin, ['select', id]);
};

this.deselect_row = function(id) {
self.virtualWrite(this.pin, ['deselect', id]);
};

this.move_row = function(old_row, new_row) {
self.virtualWrite(this.pin, ['order', old_row, new_row]);
};
};

this.WidgetLED = function(vPin) {
this.pin = vPin;
@@ -1789,6 +1821,15 @@ var Blynk = function(auth, options) {
self.virtualWrite(this.pin, 0);
};
};

this.WidgetMAP = function(vPin) {
this.pin = vPin;

this.location = function(index, lat, lon, value) {
var locationdata = [index, lat, lon, value]
self.virtualWrite(this.pin, locationdata);
}
};

if (needsEmitter()) {
util.inherits(this.VirtualPin, events.EventEmitter);
@@ -1918,7 +1959,16 @@ Blynk.prototype.onReceive = function(data) {
Blynk.prototype.sendRsp = function(msg_type, msg_id, msg_len, data) {
var self = this;
data = data || "";
msg_id = msg_id || (self.msg_id++);

if (!msg_id) {
if (self.msg_id === 0xFFFF)
self.msg_id = 1;
else
self.msg_id++;

msg_id = self.msg_id;
}

if (msg_type == MsgType.RSP) {
//console.log('< ', string_of_enum(MsgType, msg_type), msg_id, string_of_enum(MsgStatus, msg_len));
data = blynkHeader(msg_type, msg_id, msg_len)

Large diffs are not rendered by default.

Oops, something went wrong.
BIN +198 Bytes (100%) dist/blynk-library-js.ipk
Binary file not shown.

0 comments on commit e925e31

Please sign in to comment.