fakegato-history
Advanced tools
Comparing version 0.3.7 to 0.3.8
@@ -322,3 +322,2 @@ /*jshint esversion: 6,node: true,-W041: false */ | ||
sendHistory(address) { | ||
var hexAddress = address.toString('16'); // unused | ||
if (address != 0) { | ||
@@ -357,2 +356,4 @@ this.currentEntry = address; | ||
var val; | ||
if (this.usedMemory < this.memorySize) { | ||
@@ -368,3 +369,3 @@ this.usedMemory++; | ||
if (this.refTime == 0) { | ||
this.refTime = entry.time - EPOCH_OFFSET + 1; | ||
this.refTime = entry.time - EPOCH_OFFSET; | ||
this.history[this.lastEntry] = { | ||
@@ -380,3 +381,4 @@ time: entry.time, | ||
var val = Format( | ||
if (this.usedMemory < this.memorySize) { | ||
val = Format( | ||
'%s00000000%s%s%s%s%s000000000101', | ||
@@ -386,5 +388,15 @@ numToHex(swap32(entry.time - this.refTime - EPOCH_OFFSET), 8), | ||
this.accessoryType116, | ||
numToHex(swap16(this.usedMemory+1), 4), | ||
numToHex(swap16(this.memorySize), 4), | ||
numToHex(swap32(this.firstEntry), 8)); | ||
} else { | ||
val = Format( | ||
'%s00000000%s%s%s%s%s000000000101', | ||
numToHex(swap32(entry.time - this.refTime - EPOCH_OFFSET), 8), | ||
numToHex(swap32(this.refTime), 8), | ||
this.accessoryType116, | ||
numToHex(swap16(this.usedMemory), 4), | ||
numToHex(swap16(this.memorySize), 4), | ||
numToHex(swap32(this.firstEntry), 8)); | ||
numToHex(swap32(this.firstEntry+1), 8)); | ||
} | ||
@@ -409,3 +421,3 @@ if (this.service === undefined) { | ||
if ((this.currentEntry < this.lastEntry) && (this.transfer == true)) { | ||
if ((this.currentEntry <= this.lastEntry) && (this.transfer == true)) { | ||
this.memoryAddress = entry2address(this.currentEntry); | ||
@@ -415,5 +427,4 @@ if ((this.history[this.memoryAddress].setRefTime == 1) || (this.setTime == true)) { | ||
var val = Format( | ||
'15%s 0000 0000 80 0000 0000 0000 0000 00 0000 15%s 0100 0000 81%s0000 0000 00 0000', | ||
'15%s 0100 0000 81%s0000 0000 00 0000', | ||
numToHex(swap32(this.currentEntry), 8), | ||
numToHex(swap32(this.currentEntry + 1), 8), | ||
numToHex(swap32(this.refTime), 8)); | ||
@@ -424,3 +435,3 @@ | ||
this.setTime = false; | ||
this.currentEntry = this.currentEntry + 2; | ||
this.currentEntry = this.currentEntry + 1; | ||
@@ -427,0 +438,0 @@ } |
{ | ||
"name": "fakegato-history", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "Module emulating Elgato Eve history for homebridge plugins", | ||
@@ -5,0 +5,0 @@ "main": "fakegato-history.js", |
30528
563