keiser-echip-utilities
Advanced tools
Comparing version 0.1.1 to 0.1.2
392
dist/keu.js
@@ -10,168 +10,167 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.keu = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
const MACHINES = [{ | ||
models : [0x1121, 0x112A], | ||
name : 'Leg Extension A250' | ||
}, { | ||
models : [0x1122, 0x112B], | ||
name : 'Leg Extension A250, Range Limiter' | ||
}, { | ||
models : [0x1131, 0x113A], | ||
name : 'Leg Extension A300 120 degree' | ||
}, { | ||
models : [0x1132, 0x113B], | ||
name : 'Leg Extension A300 90 degree' | ||
}, { | ||
models : [0x1221, 0x122A], | ||
name : 'Leg Curl A250' | ||
}, { | ||
models : [0x1222, 0x122B], | ||
name : 'Leg Curl A250, Range Limiter' | ||
}, { | ||
models : [0x1231, 0x123A], | ||
name : 'Leg Curl A300' | ||
}, { | ||
models : [0x1321, 0x132A], | ||
name : 'Chest Press A250' | ||
}, { | ||
models : [0x1331, 0x133A], | ||
name : 'Chest Press A300' | ||
}, { | ||
models : [0x1335, 0x133B], | ||
name : 'Biaxial Chest Press A300' | ||
}, { | ||
models : [0x1336, 0x133C], | ||
name : 'Straight Push Chest Press A300' | ||
}, { | ||
models : [0x1337], | ||
name : 'Straight Push Chest Press A300 2010-3-1' | ||
}, { | ||
models : [0x1338], | ||
name : 'Straight Push Chest Press A300 2010-9-1' | ||
}, { | ||
models : [0x1431, 0x143A], | ||
name : 'Shoulder Raise A300' | ||
}, { | ||
models : [0x1531, 0x153A], | ||
name : 'Squat A300' | ||
}, { | ||
models : [0x1532, 0x153B], | ||
name : 'Squat A300' | ||
}, { | ||
models : [0x1621, 0x162A], | ||
name : 'Military Press A250' | ||
}, { | ||
models : [0x1631, 0x163A], | ||
name : 'Military Press A300' | ||
}, { | ||
models : [0x1721, 0x172A], | ||
name : 'Arm Curl A250' | ||
}, { | ||
models : [0x1736, 0x173B], | ||
name : 'Arm Curl A300' | ||
}, { | ||
models : [0x1831, 0x183A], | ||
name : 'Shrug A300' | ||
}, { | ||
models : [0x1921, 0x192A], | ||
name : 'Tricep A250' | ||
}, { | ||
models : [0x1931, 0x193A], | ||
name : 'Tricep A300' | ||
}, { | ||
models : [0x1937], | ||
name : 'Engineering Test Tricep, one sided' | ||
}, { | ||
models : [0x2021, 0x202A], | ||
name : 'Upper Back A250' | ||
}, { | ||
models : [0x2031, 0x2035, 0x203A, 0x203B], | ||
name : 'Upper Back A300' | ||
}, { | ||
models : [0x2121, 0x212A], | ||
name : 'Lat Pulldown A250' | ||
}, { | ||
models : [0x2131, 0x213A], | ||
name : 'Lat Pulldown A300' | ||
}, { | ||
models : [0x2221, 0x222A], | ||
name : 'Seated Butterfly A250' | ||
}, { | ||
models : [0x2231, 0x223A], | ||
name : 'Seated Butterfly A300' | ||
}, { | ||
models : [0x2235, 0x223B], | ||
name : 'Seated Butterfly A350' | ||
}, { | ||
models : [0x2331, 0x233A], | ||
name : 'Abductor A300' | ||
}, { | ||
models : [0x2431, 0x243A], | ||
name : 'Adductor A300' | ||
}, { | ||
models : [0x2521, 0x252A], | ||
name : 'Leg Press A250' | ||
}, { | ||
models : [0x2531, 0x253A], | ||
name : 'Leg Press A300' | ||
}, { | ||
models : [0x2621, 0x262A], | ||
name : 'Standing Hip A250' | ||
}, { | ||
models : [0x2631, 0x263A], | ||
name : 'Standing Hip A300' | ||
}, { | ||
models : [0x2721, 0x272A], | ||
name : 'Abdominal A250' | ||
}, { | ||
models : [0x2731, 0x273A], | ||
name : 'Abdominal A300' | ||
}, { | ||
models : [0x2821, 0x282A], | ||
name : 'Lower Back A250' | ||
}, { | ||
models : [0x2822, 0x282B], | ||
name : 'Lower Back A250, Range Limiter' | ||
}, { | ||
models : [0x2831, 0x2836, 0x283A, 0x283B], | ||
name : 'Lower Back A300' | ||
}, { | ||
models : [0x2936, 0x293A], | ||
name : 'Seated Calf A300' | ||
}, { | ||
models : [0x3000, 0x300A], | ||
name : 'Performance Zone' | ||
}, { | ||
models : [0x3010, 0x301A], | ||
name : 'Performance Trainer' | ||
}, { | ||
models : [0x3020, 0x302A], | ||
name : 'Functional Trainer' | ||
}, { | ||
models : [0x3030, 0x303A], | ||
name : 'Triple Trainer' | ||
}, { | ||
models : [0x3040, 0x304A], | ||
name : 'Functional Wall Trainer' | ||
}, { | ||
models : [0x3100], | ||
name : 'Rack, Seat Settings' | ||
}, { | ||
models : [0x3103, 0x3104, 0x3105, 0x3106, 0x3110, 0x3111, 0x3120], | ||
name : 'Rack, Iron Weight' | ||
}, { | ||
models : [0x3231], | ||
name : 'Single Runner' | ||
}, { | ||
models : [0x3232, 0x323A], | ||
name : 'Dual Runner' | ||
}, { | ||
models : [0x9990], | ||
name : 'One arm bandit test stand' | ||
}, { | ||
models : [0x9999], | ||
name : 'Pressure Gauge PSI' | ||
}, { | ||
models : [0x9998], | ||
name : 'Pressure Gauge KPA' | ||
} | ||
]; | ||
models: [0x1121, 0x112A], | ||
name: 'Leg Extension A250' | ||
}, { | ||
models: [0x1122, 0x112B], | ||
name: 'Leg Extension A250, Range Limiter' | ||
}, { | ||
models: [0x1131, 0x113A], | ||
name: 'Leg Extension A300 120 degree' | ||
}, { | ||
models: [0x1132, 0x113B], | ||
name: 'Leg Extension A300 90 degree' | ||
}, { | ||
models: [0x1221, 0x122A], | ||
name: 'Leg Curl A250' | ||
}, { | ||
models: [0x1222, 0x122B], | ||
name: 'Leg Curl A250, Range Limiter' | ||
}, { | ||
models: [0x1231, 0x123A], | ||
name: 'Leg Curl A300' | ||
}, { | ||
models: [0x1321, 0x132A], | ||
name: 'Chest Press A250' | ||
}, { | ||
models: [0x1331, 0x133A], | ||
name: 'Chest Press A300' | ||
}, { | ||
models: [0x1335, 0x133B], | ||
name: 'Biaxial Chest Press A300' | ||
}, { | ||
models: [0x1336, 0x133C], | ||
name: 'Straight Push Chest Press A300' | ||
}, { | ||
models: [0x1337], | ||
name: 'Straight Push Chest Press A300 2010-3-1' | ||
}, { | ||
models: [0x1338], | ||
name: 'Straight Push Chest Press A300 2010-9-1' | ||
}, { | ||
models: [0x1431, 0x143A], | ||
name: 'Shoulder Raise A300' | ||
}, { | ||
models: [0x1531, 0x153A], | ||
name: 'Squat A300' | ||
}, { | ||
models: [0x1532, 0x153B], | ||
name: 'Squat A300' | ||
}, { | ||
models: [0x1621, 0x162A], | ||
name: 'Military Press A250' | ||
}, { | ||
models: [0x1631, 0x163A], | ||
name: 'Military Press A300' | ||
}, { | ||
models: [0x1721, 0x172A], | ||
name: 'Arm Curl A250' | ||
}, { | ||
models: [0x1736, 0x173B], | ||
name: 'Arm Curl A300' | ||
}, { | ||
models: [0x1831, 0x183A], | ||
name: 'Shrug A300' | ||
}, { | ||
models: [0x1921, 0x192A], | ||
name: 'Tricep A250' | ||
}, { | ||
models: [0x1931, 0x193A], | ||
name: 'Tricep A300' | ||
}, { | ||
models: [0x1937], | ||
name: 'Engineering Test Tricep, one sided' | ||
}, { | ||
models: [0x2021, 0x202A], | ||
name: 'Upper Back A250' | ||
}, { | ||
models: [0x2031, 0x2035, 0x203A, 0x203B], | ||
name: 'Upper Back A300' | ||
}, { | ||
models: [0x2121, 0x212A], | ||
name: 'Lat Pulldown A250' | ||
}, { | ||
models: [0x2131, 0x213A], | ||
name: 'Lat Pulldown A300' | ||
}, { | ||
models: [0x2221, 0x222A], | ||
name: 'Seated Butterfly A250' | ||
}, { | ||
models: [0x2231, 0x223A], | ||
name: 'Seated Butterfly A300' | ||
}, { | ||
models: [0x2235, 0x223B], | ||
name: 'Seated Butterfly A350' | ||
}, { | ||
models: [0x2331, 0x233A], | ||
name: 'Abductor A300' | ||
}, { | ||
models: [0x2431, 0x243A], | ||
name: 'Adductor A300' | ||
}, { | ||
models: [0x2521, 0x252A], | ||
name: 'Leg Press A250' | ||
}, { | ||
models: [0x2531, 0x253A], | ||
name: 'Leg Press A300' | ||
}, { | ||
models: [0x2621, 0x262A], | ||
name: 'Standing Hip A250' | ||
}, { | ||
models: [0x2631, 0x263A], | ||
name: 'Standing Hip A300' | ||
}, { | ||
models: [0x2721, 0x272A], | ||
name: 'Abdominal A250' | ||
}, { | ||
models: [0x2731, 0x273A], | ||
name: 'Abdominal A300' | ||
}, { | ||
models: [0x2821, 0x282A], | ||
name: 'Lower Back A250' | ||
}, { | ||
models: [0x2822, 0x282B], | ||
name: 'Lower Back A250, Range Limiter' | ||
}, { | ||
models: [0x2831, 0x2836, 0x283A, 0x283B], | ||
name: 'Lower Back A300' | ||
}, { | ||
models: [0x2936, 0x293A], | ||
name: 'Seated Calf A300' | ||
}, { | ||
models: [0x3000, 0x300A], | ||
name: 'Performance Zone' | ||
}, { | ||
models: [0x3010, 0x301A], | ||
name: 'Performance Trainer' | ||
}, { | ||
models: [0x3020, 0x302A], | ||
name: 'Functional Trainer' | ||
}, { | ||
models: [0x3030, 0x303A], | ||
name: 'Triple Trainer' | ||
}, { | ||
models: [0x3040, 0x304A], | ||
name: 'Functional Wall Trainer' | ||
}, { | ||
models: [0x3100], | ||
name: 'Rack, Seat Settings' | ||
}, { | ||
models: [0x3103, 0x3104, 0x3105, 0x3106, 0x3110, 0x3111, 0x3120], | ||
name: 'Rack, Iron Weight' | ||
}, { | ||
models: [0x3231], | ||
name: 'Single Runner' | ||
}, { | ||
models: [0x3232, 0x323A], | ||
name: 'Dual Runner' | ||
}, { | ||
models: [0x9990], | ||
name: 'One arm bandit test stand' | ||
}, { | ||
models: [0x9999], | ||
name: 'Pressure Gauge PSI' | ||
}, { | ||
models: [0x9998], | ||
name: 'Pressure Gauge KPA' | ||
}]; | ||
@@ -196,4 +195,3 @@ /***************************************** | ||
return machine; | ||
} | ||
(); | ||
}(); | ||
@@ -208,4 +206,3 @@ },{}],2:[function(require,module,exports){ | ||
return keu; | ||
} | ||
(); | ||
}(); | ||
@@ -217,11 +214,14 @@ },{"./machine":1,"./messenger":3}],3:[function(require,module,exports){ | ||
/***************************************** | ||
* Constants | ||
*****************************************/ | ||
const MESSENGER_CONST = { | ||
TYPE : { | ||
RESPONSE : 'response', | ||
REQUEST : 'request' | ||
TYPE: { | ||
RESPONSE: 'response', | ||
REQUEST: 'request' | ||
}, | ||
ACTION : { | ||
CONNECT : 'connect', | ||
ECHIP_SET : 'echip-set', | ||
ECHIP_GET : 'echip-get' | ||
ACTION: { | ||
CONNECT: 'connect', | ||
ECHIP_SET: 'echip-set', | ||
ECHIP_GET: 'echip-get' | ||
} | ||
@@ -236,8 +236,8 @@ } | ||
var status = { | ||
initialized : false, | ||
connected : false, | ||
enabled : false, | ||
actions : { | ||
eChipSet : false, | ||
eChipGet : false | ||
initialized: false, | ||
connected: false, | ||
enabled: false, | ||
actions: { | ||
eChipSet: false, | ||
eChipGet: false | ||
} | ||
@@ -278,6 +278,6 @@ }; | ||
var messageObject = { | ||
id : id, | ||
type : type, | ||
action : action, | ||
data : data | ||
id: id, | ||
type: type, | ||
action: action, | ||
data: data | ||
}; | ||
@@ -292,3 +292,4 @@ sendMessage(messageObject); | ||
var messageObject = JSON.parse(messageEvent.data); | ||
if ((messageObject || {}).action && messageObject.action === MESSENGER_CONST.ACTION.CONNECT) { | ||
if ((messageObject || {}) | ||
.action && messageObject.action === MESSENGER_CONST.ACTION.CONNECT) { | ||
appWindow = messageEvent.source; | ||
@@ -310,3 +311,4 @@ appOrigin = messageEvent.origin; | ||
var messageObject = JSON.parse(messageData); | ||
if ((messageObject || {}).id) { | ||
if ((messageObject || {}) | ||
.id) { | ||
switch (messageObject.action) { | ||
@@ -332,3 +334,3 @@ case MESSENGER_CONST.ACTION.ECHIP_SET: | ||
var data = { | ||
actions : [] | ||
actions: [] | ||
}; | ||
@@ -351,3 +353,3 @@ if (status.actions.eChipSet) { | ||
var data = { | ||
success : true | ||
success: true | ||
}; | ||
@@ -380,4 +382,9 @@ composeMessage(id, MESSENGER_CONST.TYPE.RESPONSE, MESSENGER_CONST.ACTION.ECHIP_SET, data); | ||
status.enabled = false; | ||
status.actions.eChipGet = false; | ||
status.actions.eChipSet = false; | ||
onGetRequestCallback = null; | ||
onSetRequestCallback = null; | ||
if (status.initialized) { | ||
connect(); | ||
} | ||
}; | ||
@@ -387,6 +394,5 @@ | ||
return messenger; | ||
} | ||
(); | ||
}(); | ||
},{}]},{},[2])(2) | ||
}); |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.keu=e()}}(function(){return function e(n,a,o){function t(i,r){if(!a[i]){if(!n[i]){var m="function"==typeof require&&require;if(!r&&m)return m(i,!0);if(s)return s(i,!0);var d=new Error("Cannot find module '"+i+"'");throw d.code="MODULE_NOT_FOUND",d}var l=a[i]={exports:{}};n[i][0].call(l.exports,function(e){var a=n[i][1][e];return t(a?a:e)},l,l.exports,e,n,a,o)}return a[i].exports}for(var s="function"==typeof require&&require,i=0;i<o.length;i++)t(o[i]);return t}({1:[function(e,n,a){n.exports=function(){"use strict";var e={};const n=[{models:[4385,4394],name:"Leg Extension A250"},{models:[4386,4395],name:"Leg Extension A250, Range Limiter"},{models:[4401,4410],name:"Leg Extension A300 120 degree"},{models:[4402,4411],name:"Leg Extension A300 90 degree"},{models:[4641,4650],name:"Leg Curl A250"},{models:[4642,4651],name:"Leg Curl A250, Range Limiter"},{models:[4657,4666],name:"Leg Curl A300"},{models:[4897,4906],name:"Chest Press A250"},{models:[4913,4922],name:"Chest Press A300"},{models:[4917,4923],name:"Biaxial Chest Press A300"},{models:[4918,4924],name:"Straight Push Chest Press A300"},{models:[4919],name:"Straight Push Chest Press A300 2010-3-1"},{models:[4920],name:"Straight Push Chest Press A300 2010-9-1"},{models:[5169,5178],name:"Shoulder Raise A300"},{models:[5425,5434],name:"Squat A300"},{models:[5426,5435],name:"Squat A300"},{models:[5665,5674],name:"Military Press A250"},{models:[5681,5690],name:"Military Press A300"},{models:[5921,5930],name:"Arm Curl A250"},{models:[5942,5947],name:"Arm Curl A300"},{models:[6193,6202],name:"Shrug A300"},{models:[6433,6442],name:"Tricep A250"},{models:[6449,6458],name:"Tricep A300"},{models:[6455],name:"Engineering Test Tricep, one sided"},{models:[8225,8234],name:"Upper Back A250"},{models:[8241,8245,8250,8251],name:"Upper Back A300"},{models:[8481,8490],name:"Lat Pulldown A250"},{models:[8497,8506],name:"Lat Pulldown A300"},{models:[8737,8746],name:"Seated Butterfly A250"},{models:[8753,8762],name:"Seated Butterfly A300"},{models:[8757,8763],name:"Seated Butterfly A350"},{models:[9009,9018],name:"Abductor A300"},{models:[9265,9274],name:"Adductor A300"},{models:[9505,9514],name:"Leg Press A250"},{models:[9521,9530],name:"Leg Press A300"},{models:[9761,9770],name:"Standing Hip A250"},{models:[9777,9786],name:"Standing Hip A300"},{models:[10017,10026],name:"Abdominal A250"},{models:[10033,10042],name:"Abdominal A300"},{models:[10273,10282],name:"Lower Back A250"},{models:[10274,10283],name:"Lower Back A250, Range Limiter"},{models:[10289,10294,10298,10299],name:"Lower Back A300"},{models:[10550,10554],name:"Seated Calf A300"},{models:[12288,12298],name:"Performance Zone"},{models:[12304,12314],name:"Performance Trainer"},{models:[12320,12330],name:"Functional Trainer"},{models:[12336,12346],name:"Triple Trainer"},{models:[12352,12362],name:"Functional Wall Trainer"},{models:[12544],name:"Rack, Seat Settings"},{models:[12547,12548,12549,12550,12560,12561,12576],name:"Rack, Iron Weight"},{models:[12849],name:"Single Runner"},{models:[12850,12858],name:"Dual Runner"},{models:[39312],name:"One arm bandit test stand"},{models:[39321],name:"Pressure Gauge PSI"},{models:[39320],name:"Pressure Gauge KPA"}];return e.getMachineDetails=function(e){for(var a=0;a<n.length;a++)for(var o=0;o<n[a].models.length;o++)if(n[a].models[o]==e)return n[a]},e}()},{}],2:[function(e,n,a){n.exports=function(){"use strict";var n={};return n.machine=e("./machine"),n.messenger=e("./messenger"),n}()},{"./machine":1,"./messenger":3}],3:[function(e,n,a){n.exports=function(){"use strict";var e={};const n={TYPE:{RESPONSE:"response",REQUEST:"request"},ACTION:{CONNECT:"connect",ECHIP_SET:"echip-set",ECHIP_GET:"echip-get"}};var a,o,t,s,i,r={initialized:!1,connected:!1,enabled:!1,actions:{eChipSet:!1,eChipGet:!1}},m=function(e){r.initialized?c(e.data):u(e)},d=function(e){a&&o&&a.postMessage(JSON.stringify(e),o)},l=function(e,n,a,o){var t={id:e,type:n,action:a,data:o};d(t)},u=function(e){var s=JSON.parse(e.data);(s||{}).action&&s.action===n.ACTION.CONNECT&&(a=e.source,o=e.origin,t=s.id,r.initialized=!0,r.enabled&&f())},c=function(e){if(r.enabled){var a=JSON.parse(e);if((a||{}).id)switch(a.action){case n.ACTION.ECHIP_SET:i(a.data,function(){p(a.id)});break;case n.ACTION.ECHIP_GET:A(a.id,s(a))}}},f=function(){if(t){var e={actions:[]};r.actions.eChipSet&&e.actions.push(n.ACTION.ECHIP_SET),r.actions.eChipGet&&e.actions.push(n.ACTION.ECHIP_GET),l(t,n.TYPE.RESPONSE,n.ACTION.CONNECT,e)}},A=function(e,a){l(e,n.TYPE.RESPONSE,n.ACTION.ECHIP_GET,a)},p=function(e){var a={success:!0};l(e,n.TYPE.RESPONSE,n.ACTION.ECHIP_SET,a)};return e.enable=function(e,n){"function"==typeof e&&(r.actions.eChipGet=!0,s=e),"function"==typeof n&&(r.actions.eChipSet=!0,i=n),r.enabled=!0,r.initialized&&f()},e.disable=function(){r.enabled=!1,s=null,i=null},window.addEventListener("message",m),e}()},{}]},{},[2])(2)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.keu=e()}}(function(){return function e(n,a,t){function o(i,r){if(!a[i]){if(!n[i]){var m="function"==typeof require&&require;if(!r&&m)return m(i,!0);if(s)return s(i,!0);var d=new Error("Cannot find module '"+i+"'");throw d.code="MODULE_NOT_FOUND",d}var l=a[i]={exports:{}};n[i][0].call(l.exports,function(e){var a=n[i][1][e];return o(a?a:e)},l,l.exports,e,n,a,t)}return a[i].exports}for(var s="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(e,n,a){n.exports=function(){"use strict";var e={};const n=[{models:[4385,4394],name:"Leg Extension A250"},{models:[4386,4395],name:"Leg Extension A250, Range Limiter"},{models:[4401,4410],name:"Leg Extension A300 120 degree"},{models:[4402,4411],name:"Leg Extension A300 90 degree"},{models:[4641,4650],name:"Leg Curl A250"},{models:[4642,4651],name:"Leg Curl A250, Range Limiter"},{models:[4657,4666],name:"Leg Curl A300"},{models:[4897,4906],name:"Chest Press A250"},{models:[4913,4922],name:"Chest Press A300"},{models:[4917,4923],name:"Biaxial Chest Press A300"},{models:[4918,4924],name:"Straight Push Chest Press A300"},{models:[4919],name:"Straight Push Chest Press A300 2010-3-1"},{models:[4920],name:"Straight Push Chest Press A300 2010-9-1"},{models:[5169,5178],name:"Shoulder Raise A300"},{models:[5425,5434],name:"Squat A300"},{models:[5426,5435],name:"Squat A300"},{models:[5665,5674],name:"Military Press A250"},{models:[5681,5690],name:"Military Press A300"},{models:[5921,5930],name:"Arm Curl A250"},{models:[5942,5947],name:"Arm Curl A300"},{models:[6193,6202],name:"Shrug A300"},{models:[6433,6442],name:"Tricep A250"},{models:[6449,6458],name:"Tricep A300"},{models:[6455],name:"Engineering Test Tricep, one sided"},{models:[8225,8234],name:"Upper Back A250"},{models:[8241,8245,8250,8251],name:"Upper Back A300"},{models:[8481,8490],name:"Lat Pulldown A250"},{models:[8497,8506],name:"Lat Pulldown A300"},{models:[8737,8746],name:"Seated Butterfly A250"},{models:[8753,8762],name:"Seated Butterfly A300"},{models:[8757,8763],name:"Seated Butterfly A350"},{models:[9009,9018],name:"Abductor A300"},{models:[9265,9274],name:"Adductor A300"},{models:[9505,9514],name:"Leg Press A250"},{models:[9521,9530],name:"Leg Press A300"},{models:[9761,9770],name:"Standing Hip A250"},{models:[9777,9786],name:"Standing Hip A300"},{models:[10017,10026],name:"Abdominal A250"},{models:[10033,10042],name:"Abdominal A300"},{models:[10273,10282],name:"Lower Back A250"},{models:[10274,10283],name:"Lower Back A250, Range Limiter"},{models:[10289,10294,10298,10299],name:"Lower Back A300"},{models:[10550,10554],name:"Seated Calf A300"},{models:[12288,12298],name:"Performance Zone"},{models:[12304,12314],name:"Performance Trainer"},{models:[12320,12330],name:"Functional Trainer"},{models:[12336,12346],name:"Triple Trainer"},{models:[12352,12362],name:"Functional Wall Trainer"},{models:[12544],name:"Rack, Seat Settings"},{models:[12547,12548,12549,12550,12560,12561,12576],name:"Rack, Iron Weight"},{models:[12849],name:"Single Runner"},{models:[12850,12858],name:"Dual Runner"},{models:[39312],name:"One arm bandit test stand"},{models:[39321],name:"Pressure Gauge PSI"},{models:[39320],name:"Pressure Gauge KPA"}];return e.getMachineDetails=function(e){for(var a=0;a<n.length;a++)for(var t=0;t<n[a].models.length;t++)if(n[a].models[t]==e)return n[a]},e}()},{}],2:[function(e,n,a){n.exports=function(){"use strict";var n={};return n.machine=e("./machine"),n.messenger=e("./messenger"),n}()},{"./machine":1,"./messenger":3}],3:[function(e,n,a){n.exports=function(){"use strict";var e={};const n={TYPE:{RESPONSE:"response",REQUEST:"request"},ACTION:{CONNECT:"connect",ECHIP_SET:"echip-set",ECHIP_GET:"echip-get"}};var a,t,o,s,i,r={initialized:!1,connected:!1,enabled:!1,actions:{eChipSet:!1,eChipGet:!1}},m=function(e){r.initialized?c(e.data):u(e)},d=function(e){a&&t&&a.postMessage(JSON.stringify(e),t)},l=function(e,n,a,t){var o={id:e,type:n,action:a,data:t};d(o)},u=function(e){var s=JSON.parse(e.data);(s||{}).action&&s.action===n.ACTION.CONNECT&&(a=e.source,t=e.origin,o=s.id,r.initialized=!0,r.enabled&&f())},c=function(e){if(r.enabled){var a=JSON.parse(e);if((a||{}).id)switch(a.action){case n.ACTION.ECHIP_SET:i(a.data,function(){p(a.id)});break;case n.ACTION.ECHIP_GET:A(a.id,s(a))}}},f=function(){if(o){var e={actions:[]};r.actions.eChipSet&&e.actions.push(n.ACTION.ECHIP_SET),r.actions.eChipGet&&e.actions.push(n.ACTION.ECHIP_GET),l(o,n.TYPE.RESPONSE,n.ACTION.CONNECT,e)}},A=function(e,a){l(e,n.TYPE.RESPONSE,n.ACTION.ECHIP_GET,a)},p=function(e){var a={success:!0};l(e,n.TYPE.RESPONSE,n.ACTION.ECHIP_SET,a)};return e.enable=function(e,n){"function"==typeof e&&(r.actions.eChipGet=!0,s=e),"function"==typeof n&&(r.actions.eChipSet=!0,i=n),r.enabled=!0,r.initialized&&f()},e.disable=function(){r.enabled=!1,r.actions.eChipGet=!1,r.actions.eChipSet=!1,s=null,i=null,r.initialized&&f()},window.addEventListener("message",m),e}()},{}]},{},[2])(2)}); |
@@ -12,21 +12,27 @@ var gulp = require('gulp'); | ||
gulp.task('bundle', function () { | ||
browserify(mainjs, {standalone: 'keu'}).bundle() | ||
.pipe(source(mainjs)) | ||
.pipe(rename({ | ||
dirname : "/", | ||
basename : "keu" | ||
browserify(mainjs, { | ||
standalone: 'keu' | ||
}) | ||
.bundle() | ||
.pipe(source(mainjs)) | ||
.pipe(rename({ | ||
dirname: "/", | ||
basename: "keu" | ||
})) | ||
.pipe(gulp.dest('./dist')); | ||
.pipe(gulp.dest('./dist')); | ||
}); | ||
gulp.task('bundle-min', function () { | ||
browserify(mainjs, {standalone: 'keu'}).bundle() | ||
.pipe(source(mainjs)) | ||
.pipe(streamify(uglify())) | ||
.pipe(rename({ | ||
dirname : "/", | ||
basename : "keu", | ||
suffix : ".min" | ||
browserify(mainjs, { | ||
standalone: 'keu' | ||
}) | ||
.bundle() | ||
.pipe(source(mainjs)) | ||
.pipe(streamify(uglify())) | ||
.pipe(rename({ | ||
dirname: "/", | ||
basename: "keu", | ||
suffix: ".min" | ||
})) | ||
.pipe(gulp.dest('./dist')); | ||
.pipe(gulp.dest('./dist')); | ||
}); | ||
@@ -33,0 +39,0 @@ |
@@ -5,18 +5,6 @@ The MIT License (MIT) | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
{ | ||
"name": "keiser-echip-utilities", | ||
"version": "0.1.1", | ||
"description": "Keiser eChip Utilities", | ||
"main": "./src/main.js", | ||
"scripts": { | ||
"build": "gulp", | ||
"watch": "gulp watch" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/KeiserCorp/Keiser.Air.eChipUtilities.git" | ||
}, | ||
"author": "Zachary Cardoza", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/KeiserCorp/Keiser.Air.eChipUtilities/issues" | ||
}, | ||
"homepage": "https://github.com/KeiserCorp/Keiser.Air.eChipUtilities#readme", | ||
"devDependencies": { | ||
"browserify": "^12.0.1", | ||
"gulp": "^3.9.0", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-streamify": "^1.0.2", | ||
"gulp-uglify": "^1.5.1", | ||
"gulp-watch": "^4.3.5", | ||
"vinyl-source-stream": "^1.1.0" | ||
} | ||
"name": "keiser-echip-utilities", | ||
"version": "0.1.2", | ||
"description": "Keiser eChip Utilities", | ||
"main": "./src/main.js", | ||
"author": "Zachary Cardoza", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/KeiserCorp/Keiser.Air.eChipUtilities.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/KeiserCorp/Keiser.Air.eChipUtilities/issues" | ||
}, | ||
"homepage": "https://github.com/KeiserCorp/Keiser.Air.eChipUtilities#readme", | ||
"scripts": { | ||
"build": "gulp", | ||
"watch": "gulp watch" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^12.0.1", | ||
"gulp": "^3.9.0", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-streamify": "^1.0.2", | ||
"gulp-uglify": "^1.5.1", | ||
"gulp-watch": "^4.3.5", | ||
"vinyl-source-stream": "^1.1.0" | ||
} | ||
} |
@@ -1,12 +0,7 @@ | ||
Keiser eChip Utilities | ||
======================== | ||
# Keiser eChip Utilities | ||
## Project | ||
Utilities to assist development of applications utilizing the Keiser eChip and Keiser eChip Portal Tool. | ||
## Getting Started | ||
You have following options to get started: | ||
- Download the [latest release](https://github.com/KeiserCorp/Keiser.Air.eChipUtilities/releases/latest) | ||
@@ -16,8 +11,7 @@ - Clone the repo: `git clone git://github.com/KeiserCorp/Keiser.Air.eChipUtilities.git` | ||
## Loading | ||
Each release includes a minified distribution version of the library which can be loaded with a module loader, or as a stand alone library. The unminified source files are also able to be loaded with tools like [browserify](http://browserify.org/). | ||
Module load the library with [CommonJS](http://www.commonjs.org/): | ||
``` | ||
@@ -28,5 +22,7 @@ var keu = require('keiser-echip-utilities'); | ||
Including the library as a stand-alone library: | ||
``` | ||
<script src="keu.min.js"></script> | ||
``` | ||
``` | ||
@@ -36,7 +32,4 @@ var keu = window.keu; | ||
## API | ||
The library is namespaced to allow modular loading of individual library sections as needed. | ||
- [Portal Messenger](#portal-messenger) | ||
@@ -46,3 +39,2 @@ - [Machine](#machine) | ||
### Portal Messenger | ||
The `portalMessenger` library allows communication with the Keiser eChip Portal Tool. | ||
@@ -60,15 +52,14 @@ | ||
``` | ||
var onGeRequest = function(){ return getUserData(user.id); }; | ||
var onGetRequest = function(){ return getUserData(user.id); }; | ||
var onSetRequest = function(data, onSuccess){ | ||
saveUserData(data); | ||
saveUserData(data); | ||
onSuccess(); | ||
}; | ||
keu.portalMessenger.enable(onGeRequest, onSetRequest); | ||
keu.portalMessenger.enable(onGetRequest, onSetRequest); | ||
``` | ||
#### `portalMessenger.disable()` | ||
Stops communication with the Keiser eChip Portal Tool. Communication can not be resumed after a `disable` call until a new connection request is made by the portal. | ||
Stops communication with the Keiser eChip Portal Tool. Communication can be resumed by using the `enable` method. | ||
### Machine | ||
#### `machine.getMachineDetails(modelNum)` | ||
@@ -80,2 +71,3 @@ Retreives machine details based on model number argument (`modelNum`). | ||
``` | ||
``` | ||
@@ -88,10 +80,6 @@ { | ||
## Contributors | ||
- [bayssmekanique](https://github.com/bayssmekanique) | ||
* [bayssmekanique](https://github.com/bayssmekanique) | ||
## Copyright and License | ||
Copyright [Keiser Corporation](http://keiser.com/) under the [MIT license](LICENSE.md). | ||
Copyright [Keiser Corporation](http://keiser.com/) under the [MIT license](LICENSE.md). |
@@ -9,168 +9,167 @@ module.exports = function () { | ||
const MACHINES = [{ | ||
models : [0x1121, 0x112A], | ||
name : 'Leg Extension A250' | ||
}, { | ||
models : [0x1122, 0x112B], | ||
name : 'Leg Extension A250, Range Limiter' | ||
}, { | ||
models : [0x1131, 0x113A], | ||
name : 'Leg Extension A300 120 degree' | ||
}, { | ||
models : [0x1132, 0x113B], | ||
name : 'Leg Extension A300 90 degree' | ||
}, { | ||
models : [0x1221, 0x122A], | ||
name : 'Leg Curl A250' | ||
}, { | ||
models : [0x1222, 0x122B], | ||
name : 'Leg Curl A250, Range Limiter' | ||
}, { | ||
models : [0x1231, 0x123A], | ||
name : 'Leg Curl A300' | ||
}, { | ||
models : [0x1321, 0x132A], | ||
name : 'Chest Press A250' | ||
}, { | ||
models : [0x1331, 0x133A], | ||
name : 'Chest Press A300' | ||
}, { | ||
models : [0x1335, 0x133B], | ||
name : 'Biaxial Chest Press A300' | ||
}, { | ||
models : [0x1336, 0x133C], | ||
name : 'Straight Push Chest Press A300' | ||
}, { | ||
models : [0x1337], | ||
name : 'Straight Push Chest Press A300 2010-3-1' | ||
}, { | ||
models : [0x1338], | ||
name : 'Straight Push Chest Press A300 2010-9-1' | ||
}, { | ||
models : [0x1431, 0x143A], | ||
name : 'Shoulder Raise A300' | ||
}, { | ||
models : [0x1531, 0x153A], | ||
name : 'Squat A300' | ||
}, { | ||
models : [0x1532, 0x153B], | ||
name : 'Squat A300' | ||
}, { | ||
models : [0x1621, 0x162A], | ||
name : 'Military Press A250' | ||
}, { | ||
models : [0x1631, 0x163A], | ||
name : 'Military Press A300' | ||
}, { | ||
models : [0x1721, 0x172A], | ||
name : 'Arm Curl A250' | ||
}, { | ||
models : [0x1736, 0x173B], | ||
name : 'Arm Curl A300' | ||
}, { | ||
models : [0x1831, 0x183A], | ||
name : 'Shrug A300' | ||
}, { | ||
models : [0x1921, 0x192A], | ||
name : 'Tricep A250' | ||
}, { | ||
models : [0x1931, 0x193A], | ||
name : 'Tricep A300' | ||
}, { | ||
models : [0x1937], | ||
name : 'Engineering Test Tricep, one sided' | ||
}, { | ||
models : [0x2021, 0x202A], | ||
name : 'Upper Back A250' | ||
}, { | ||
models : [0x2031, 0x2035, 0x203A, 0x203B], | ||
name : 'Upper Back A300' | ||
}, { | ||
models : [0x2121, 0x212A], | ||
name : 'Lat Pulldown A250' | ||
}, { | ||
models : [0x2131, 0x213A], | ||
name : 'Lat Pulldown A300' | ||
}, { | ||
models : [0x2221, 0x222A], | ||
name : 'Seated Butterfly A250' | ||
}, { | ||
models : [0x2231, 0x223A], | ||
name : 'Seated Butterfly A300' | ||
}, { | ||
models : [0x2235, 0x223B], | ||
name : 'Seated Butterfly A350' | ||
}, { | ||
models : [0x2331, 0x233A], | ||
name : 'Abductor A300' | ||
}, { | ||
models : [0x2431, 0x243A], | ||
name : 'Adductor A300' | ||
}, { | ||
models : [0x2521, 0x252A], | ||
name : 'Leg Press A250' | ||
}, { | ||
models : [0x2531, 0x253A], | ||
name : 'Leg Press A300' | ||
}, { | ||
models : [0x2621, 0x262A], | ||
name : 'Standing Hip A250' | ||
}, { | ||
models : [0x2631, 0x263A], | ||
name : 'Standing Hip A300' | ||
}, { | ||
models : [0x2721, 0x272A], | ||
name : 'Abdominal A250' | ||
}, { | ||
models : [0x2731, 0x273A], | ||
name : 'Abdominal A300' | ||
}, { | ||
models : [0x2821, 0x282A], | ||
name : 'Lower Back A250' | ||
}, { | ||
models : [0x2822, 0x282B], | ||
name : 'Lower Back A250, Range Limiter' | ||
}, { | ||
models : [0x2831, 0x2836, 0x283A, 0x283B], | ||
name : 'Lower Back A300' | ||
}, { | ||
models : [0x2936, 0x293A], | ||
name : 'Seated Calf A300' | ||
}, { | ||
models : [0x3000, 0x300A], | ||
name : 'Performance Zone' | ||
}, { | ||
models : [0x3010, 0x301A], | ||
name : 'Performance Trainer' | ||
}, { | ||
models : [0x3020, 0x302A], | ||
name : 'Functional Trainer' | ||
}, { | ||
models : [0x3030, 0x303A], | ||
name : 'Triple Trainer' | ||
}, { | ||
models : [0x3040, 0x304A], | ||
name : 'Functional Wall Trainer' | ||
}, { | ||
models : [0x3100], | ||
name : 'Rack, Seat Settings' | ||
}, { | ||
models : [0x3103, 0x3104, 0x3105, 0x3106, 0x3110, 0x3111, 0x3120], | ||
name : 'Rack, Iron Weight' | ||
}, { | ||
models : [0x3231], | ||
name : 'Single Runner' | ||
}, { | ||
models : [0x3232, 0x323A], | ||
name : 'Dual Runner' | ||
}, { | ||
models : [0x9990], | ||
name : 'One arm bandit test stand' | ||
}, { | ||
models : [0x9999], | ||
name : 'Pressure Gauge PSI' | ||
}, { | ||
models : [0x9998], | ||
name : 'Pressure Gauge KPA' | ||
} | ||
]; | ||
models: [0x1121, 0x112A], | ||
name: 'Leg Extension A250' | ||
}, { | ||
models: [0x1122, 0x112B], | ||
name: 'Leg Extension A250, Range Limiter' | ||
}, { | ||
models: [0x1131, 0x113A], | ||
name: 'Leg Extension A300 120 degree' | ||
}, { | ||
models: [0x1132, 0x113B], | ||
name: 'Leg Extension A300 90 degree' | ||
}, { | ||
models: [0x1221, 0x122A], | ||
name: 'Leg Curl A250' | ||
}, { | ||
models: [0x1222, 0x122B], | ||
name: 'Leg Curl A250, Range Limiter' | ||
}, { | ||
models: [0x1231, 0x123A], | ||
name: 'Leg Curl A300' | ||
}, { | ||
models: [0x1321, 0x132A], | ||
name: 'Chest Press A250' | ||
}, { | ||
models: [0x1331, 0x133A], | ||
name: 'Chest Press A300' | ||
}, { | ||
models: [0x1335, 0x133B], | ||
name: 'Biaxial Chest Press A300' | ||
}, { | ||
models: [0x1336, 0x133C], | ||
name: 'Straight Push Chest Press A300' | ||
}, { | ||
models: [0x1337], | ||
name: 'Straight Push Chest Press A300 2010-3-1' | ||
}, { | ||
models: [0x1338], | ||
name: 'Straight Push Chest Press A300 2010-9-1' | ||
}, { | ||
models: [0x1431, 0x143A], | ||
name: 'Shoulder Raise A300' | ||
}, { | ||
models: [0x1531, 0x153A], | ||
name: 'Squat A300' | ||
}, { | ||
models: [0x1532, 0x153B], | ||
name: 'Squat A300' | ||
}, { | ||
models: [0x1621, 0x162A], | ||
name: 'Military Press A250' | ||
}, { | ||
models: [0x1631, 0x163A], | ||
name: 'Military Press A300' | ||
}, { | ||
models: [0x1721, 0x172A], | ||
name: 'Arm Curl A250' | ||
}, { | ||
models: [0x1736, 0x173B], | ||
name: 'Arm Curl A300' | ||
}, { | ||
models: [0x1831, 0x183A], | ||
name: 'Shrug A300' | ||
}, { | ||
models: [0x1921, 0x192A], | ||
name: 'Tricep A250' | ||
}, { | ||
models: [0x1931, 0x193A], | ||
name: 'Tricep A300' | ||
}, { | ||
models: [0x1937], | ||
name: 'Engineering Test Tricep, one sided' | ||
}, { | ||
models: [0x2021, 0x202A], | ||
name: 'Upper Back A250' | ||
}, { | ||
models: [0x2031, 0x2035, 0x203A, 0x203B], | ||
name: 'Upper Back A300' | ||
}, { | ||
models: [0x2121, 0x212A], | ||
name: 'Lat Pulldown A250' | ||
}, { | ||
models: [0x2131, 0x213A], | ||
name: 'Lat Pulldown A300' | ||
}, { | ||
models: [0x2221, 0x222A], | ||
name: 'Seated Butterfly A250' | ||
}, { | ||
models: [0x2231, 0x223A], | ||
name: 'Seated Butterfly A300' | ||
}, { | ||
models: [0x2235, 0x223B], | ||
name: 'Seated Butterfly A350' | ||
}, { | ||
models: [0x2331, 0x233A], | ||
name: 'Abductor A300' | ||
}, { | ||
models: [0x2431, 0x243A], | ||
name: 'Adductor A300' | ||
}, { | ||
models: [0x2521, 0x252A], | ||
name: 'Leg Press A250' | ||
}, { | ||
models: [0x2531, 0x253A], | ||
name: 'Leg Press A300' | ||
}, { | ||
models: [0x2621, 0x262A], | ||
name: 'Standing Hip A250' | ||
}, { | ||
models: [0x2631, 0x263A], | ||
name: 'Standing Hip A300' | ||
}, { | ||
models: [0x2721, 0x272A], | ||
name: 'Abdominal A250' | ||
}, { | ||
models: [0x2731, 0x273A], | ||
name: 'Abdominal A300' | ||
}, { | ||
models: [0x2821, 0x282A], | ||
name: 'Lower Back A250' | ||
}, { | ||
models: [0x2822, 0x282B], | ||
name: 'Lower Back A250, Range Limiter' | ||
}, { | ||
models: [0x2831, 0x2836, 0x283A, 0x283B], | ||
name: 'Lower Back A300' | ||
}, { | ||
models: [0x2936, 0x293A], | ||
name: 'Seated Calf A300' | ||
}, { | ||
models: [0x3000, 0x300A], | ||
name: 'Performance Zone' | ||
}, { | ||
models: [0x3010, 0x301A], | ||
name: 'Performance Trainer' | ||
}, { | ||
models: [0x3020, 0x302A], | ||
name: 'Functional Trainer' | ||
}, { | ||
models: [0x3030, 0x303A], | ||
name: 'Triple Trainer' | ||
}, { | ||
models: [0x3040, 0x304A], | ||
name: 'Functional Wall Trainer' | ||
}, { | ||
models: [0x3100], | ||
name: 'Rack, Seat Settings' | ||
}, { | ||
models: [0x3103, 0x3104, 0x3105, 0x3106, 0x3110, 0x3111, 0x3120], | ||
name: 'Rack, Iron Weight' | ||
}, { | ||
models: [0x3231], | ||
name: 'Single Runner' | ||
}, { | ||
models: [0x3232, 0x323A], | ||
name: 'Dual Runner' | ||
}, { | ||
models: [0x9990], | ||
name: 'One arm bandit test stand' | ||
}, { | ||
models: [0x9999], | ||
name: 'Pressure Gauge PSI' | ||
}, { | ||
models: [0x9998], | ||
name: 'Pressure Gauge KPA' | ||
}]; | ||
@@ -195,3 +194,2 @@ /***************************************** | ||
return machine; | ||
} | ||
(); | ||
}(); |
@@ -8,3 +8,2 @@ module.exports = function () { | ||
return keu; | ||
} | ||
(); | ||
}(); |
@@ -5,11 +5,14 @@ module.exports = function () { | ||
/***************************************** | ||
* Constants | ||
*****************************************/ | ||
const MESSENGER_CONST = { | ||
TYPE : { | ||
RESPONSE : 'response', | ||
REQUEST : 'request' | ||
TYPE: { | ||
RESPONSE: 'response', | ||
REQUEST: 'request' | ||
}, | ||
ACTION : { | ||
CONNECT : 'connect', | ||
ECHIP_SET : 'echip-set', | ||
ECHIP_GET : 'echip-get' | ||
ACTION: { | ||
CONNECT: 'connect', | ||
ECHIP_SET: 'echip-set', | ||
ECHIP_GET: 'echip-get' | ||
} | ||
@@ -24,8 +27,8 @@ } | ||
var status = { | ||
initialized : false, | ||
connected : false, | ||
enabled : false, | ||
actions : { | ||
eChipSet : false, | ||
eChipGet : false | ||
initialized: false, | ||
connected: false, | ||
enabled: false, | ||
actions: { | ||
eChipSet: false, | ||
eChipGet: false | ||
} | ||
@@ -66,6 +69,6 @@ }; | ||
var messageObject = { | ||
id : id, | ||
type : type, | ||
action : action, | ||
data : data | ||
id: id, | ||
type: type, | ||
action: action, | ||
data: data | ||
}; | ||
@@ -80,3 +83,4 @@ sendMessage(messageObject); | ||
var messageObject = JSON.parse(messageEvent.data); | ||
if ((messageObject || {}).action && messageObject.action === MESSENGER_CONST.ACTION.CONNECT) { | ||
if ((messageObject || {}) | ||
.action && messageObject.action === MESSENGER_CONST.ACTION.CONNECT) { | ||
appWindow = messageEvent.source; | ||
@@ -98,3 +102,4 @@ appOrigin = messageEvent.origin; | ||
var messageObject = JSON.parse(messageData); | ||
if ((messageObject || {}).id) { | ||
if ((messageObject || {}) | ||
.id) { | ||
switch (messageObject.action) { | ||
@@ -120,3 +125,3 @@ case MESSENGER_CONST.ACTION.ECHIP_SET: | ||
var data = { | ||
actions : [] | ||
actions: [] | ||
}; | ||
@@ -139,3 +144,3 @@ if (status.actions.eChipSet) { | ||
var data = { | ||
success : true | ||
success: true | ||
}; | ||
@@ -168,4 +173,9 @@ composeMessage(id, MESSENGER_CONST.TYPE.RESPONSE, MESSENGER_CONST.ACTION.ECHIP_SET, data); | ||
status.enabled = false; | ||
status.actions.eChipGet = false; | ||
status.actions.eChipSet = false; | ||
onGetRequestCallback = null; | ||
onSetRequestCallback = null; | ||
if (status.initialized) { | ||
connect(); | ||
} | ||
}; | ||
@@ -175,3 +185,2 @@ | ||
return messenger; | ||
} | ||
(); | ||
}(); |
763
30449
79