Best JavaScript code snippet using playwright-internal
0061.js
Source:0061.js
...140 position = {141 value: 506142 };143 status =144 processKey(msg, buffer, "numberStagesMultiStage", 56, 2, position, cb) &&145 processParser(msg, buffer, "numberStagesMultiStage", "number", 2, position, cb) &&146 processKey(msg, buffer, "numberStageResults", 57, 2, position, cb) &&147 processParser(msg, buffer, "numberStageResults", "number", 2, position, cb) &&148 processKey(msg, buffer, "stageResult", 58, 2, position, cb) &&149 processParser(msg, buffer, "stageResult", "string", (11 * msg.payload.numberStageResults), position, cb);150 revision = 6;151 break;152 case 7:153 position = {154 value: 506155 };156 status =157 processKey(msg, buffer, "compensatedAngle", 56, 2, position, cb) &&158 processParser(msg, buffer, "compensatedAngle", "number", 7, position, cb) &&159 processKey(msg, buffer, "finalAngleDecimal", 57, 2, position, cb) &&160 processParser(msg, buffer, "finalAngleDecimal", "number", 7, position, cb);161 if (status) {162 msg.payload.compensatedAngle = (msg.payload.compensatedAngle / 100);163 msg.payload.finalAngleDecimal = (msg.payload.finalAngleDecimal / 100);164 revision = 6;165 }166 break;167 }168 switch (revision) {169 case 999:170 position = {171 value: 0172 };173 status =174 processParser(msg, buffer, "numberVIN", "rawString", 25, position, cb) &&175 processParser(msg, buffer, "jobID", "number", 2, position, cb) &&176 processParser(msg, buffer, "parameterSetID", "number", 3, position, cb) &&177 processParser(msg, buffer, "batchSize", "number", 4, position, cb) &&178 processParser(msg, buffer, "batchCounter", "number", 4, position, cb) &&179 processParser(msg, buffer, "batchStatus", "number", 1, position, cb) &&180 processParser(msg, buffer, "tighteningStatus", "number", 1, position, cb) &&181 processParser(msg, buffer, "torqueStatus", "number", 1, position, cb) &&182 processParser(msg, buffer, "angleStatus", "number", 1, position, cb) &&183 processParser(msg, buffer, "torque", "number", 6, position, cb) &&184 processParser(msg, buffer, "angle", "number", 5, position, cb) &&185 processParser(msg, buffer, "timeStamp", "string", 19, position, cb) &&186 processParser(msg, buffer, "timeLastChange", "string", 19, position, cb) &&187 processParser(msg, buffer, "tighteningID", "number", 10, position, cb);188 if (status) {189 msg.payload._torqueStatus = msg.payload.torqueStatus;190 msg.payload.torqueStatus = constantsMID["status"][msg.payload.torqueStatus.toString()];191 msg.payload._angleStatus = msg.payload.angleStatus;192 msg.payload.angleStatus = constantsMID["status"][msg.payload.angleStatus.toString()];193 msg.payload.torque = (msg.payload.torque / 100);194 msg.payload._tighteningStatus = msg.payload.tighteningStatus;195 msg.payload.tighteningStatus = checkOK(msg.payload.tighteningStatus);196 msg.payload._batchStatus = msg.payload.batchStatus;197 msg.payload.batchStatus = checkOK(msg.payload.batchStatus);198 cb(null, msg);199 }200 break;201 case 6:202 position = {203 value: 486204 };205 status =206 processKey(msg, buffer, "prevailTorqueCompensateValue", 54, 2, position, cb) &&207 processParser(msg, buffer, "prevailTorqueCompensateValue", "number", 6, position, cb) &&208 processKey(msg, buffer, "tighteningErrorStatus2", 55, 2, position, cb) &&209 processParser(msg, buffer, "tighteningErrorStatus2", "number", 10, position, cb);210 if (status) {211 msg.payload._tighteningErrorStatus2 = msg.payload.tighteningErrorStatus2;212 msg.payload.tighteningErrorStatus2 = checkBitMap("tighteningErrorStatus2", msg.payload.tighteningErrorStatus2, 32);213 msg.payload.prevailTorqueCompensateValue = (msg.payload.prevailTorqueCompensateValue / 100);214 }215 case 5:216 position = {217 value: 480218 };219 status =220 processKey(msg, buffer, "customerToghteningErrorCode", 53, 2, position, cb) &&221 processParser(msg, buffer, "customerToghteningErrorCode", "string", 4, position, cb);222 case 4:223 position = {224 value: 399225 };226 status =227 processKey(msg, buffer, "identifierPart2", 50, 2, position, cb) &&228 processParser(msg, buffer, "identifierPart2", "string", 25, position, cb) &&229 processKey(msg, buffer, "identifierPart3", 51, 2, position, cb) &&230 processParser(msg, buffer, "identifierPart3", "string", 25, position, cb) &&231 processKey(msg, buffer, "identifierPart4", 52, 2, position, cb) &&232 processParser(msg, buffer, "identifierPart4", "string", 25, position, cb);233 case 3:234 position = {235 value: 365236 };237 status =238 processKey(msg, buffer, "parameterSetName", 47, 2, position, cb) &&239 processParser(msg, buffer, "parameterSetName", "string", 25, position, cb) &&240 processKey(msg, buffer, "torqueValuesUnit", 48, 2, position, cb) &&241 processParser(msg, buffer, "torqueValuesUnit", "number", 1, position, cb) &&242 processKey(msg, buffer, "resultType", 49, 2, position, cb) &&243 processParser(msg, buffer, "resultType", "number", 2, position, cb);244 if (status) {245 msg.payload._torqueValuesUnit = msg.payload.torqueValuesUnit;246 msg.payload.torqueValuesUnit = constantsMID["torqueValuesUnit"][msg.payload.torqueValuesUnit.toString()];247 msg.payload._resultType = msg.payload.resultType;248 msg.payload.resultType = constantsMID["resultType"][msg.payload.resultType.toString()];249 }250 case 2:251 position = {252 value: 0253 };254 status =255 processKey(msg, buffer, "cellID", 1, 2, position, cb) &&256 processParser(msg, buffer, "cellID", "number", 4, position, cb) &&257 processKey(msg, buffer, "channelID", 2, 2, position, cb) &&258 processParser(msg, buffer, "channelID", "number", 2, position, cb) &&259 processKey(msg, buffer, "torqueControllerName", 3, 2, position, cb) &&260 processParser(msg, buffer, "torqueControllerName", "string", 25, position, cb) &&261 processKey(msg, buffer, "numberVIN", 4, 2, position, cb) &&262 processParser(msg, buffer, "numberVIN", "rawString", 25, position, cb) &&263 processKey(msg, buffer, "jobID", 5, 2, position, cb) &&264 processParser(msg, buffer, "jobID", "number", 4, position, cb) &&265 processKey(msg, buffer, "parameterSetID", 6, 2, position, cb) &&266 processParser(msg, buffer, "parameterSetID", "number", 3, position, cb) &&267 processKey(msg, buffer, "strategy", 7, 2, position, cb) &&268 processParser(msg, buffer, "strategy", "number", 2, position, cb) &&269 processKey(msg, buffer, "strategyOptions", 8, 2, position, cb) &&270 processParser(msg, buffer, "strategyOptions", "number", 5, position, cb) &&271 processKey(msg, buffer, "batchSize", 9, 2, position, cb) &&272 processParser(msg, buffer, "batchSize", "number", 4, position, cb) &&273 processKey(msg, buffer, "batchCounter", 10, 2, position, cb) &&274 processParser(msg, buffer, "batchCounter", "number", 4, position, cb) &&275 processKey(msg, buffer, "tighteningStatus", 11, 2, position, cb) &&276 processParser(msg, buffer, "tighteningStatus", "number", 1, position, cb) &&277 processKey(msg, buffer, "batchStatus", 12, 2, position, cb) &&278 processParser(msg, buffer, "batchStatus", "number", 1, position, cb) &&279 processKey(msg, buffer, "torqueStatus", 13, 2, position, cb) &&280 processParser(msg, buffer, "torqueStatus", "number", 1, position, cb) &&281 processKey(msg, buffer, "angleStatus", 14, 2, position, cb) &&282 processParser(msg, buffer, "angleStatus", "number", 1, position, cb) &&283 processKey(msg, buffer, "rundownAngleStatus", 15, 2, position, cb) &&284 processParser(msg, buffer, "rundownAngleStatus", "number", 1, position, cb) &&285 processKey(msg, buffer, "currentMonitoringStatus", 16, 2, position, cb) &&286 processParser(msg, buffer, "currentMonitoringStatus", "number", 1, position, cb) &&287 processKey(msg, buffer, "selftapStatus", 17, 2, position, cb) &&288 processParser(msg, buffer, "selftapStatus", "number", 1, position, cb) &&289 processKey(msg, buffer, "prevailTorqueMonitoringStatus", 18, 2, position, cb) &&290 processParser(msg, buffer, "prevailTorqueMonitoringStatus", "number", 1, position, cb) &&291 processKey(msg, buffer, "prevailTorqueCompensateStatus", 19, 2, position, cb) &&292 processParser(msg, buffer, "prevailTorqueCompensateStatus", "number", 1, position, cb) &&293 processKey(msg, buffer, "tighteningErrorStatus", 20, 2, position, cb) &&294 processParser(msg, buffer, "tighteningErrorStatus", "number", 10, position, cb) &&295 processKey(msg, buffer, "torqueMinLimit", 21, 2, position, cb) &&296 processParser(msg, buffer, "torqueMinLimit", "number", 6, position, cb) &&297 processKey(msg, buffer, "torqueMaxLimit", 22, 2, position, cb) &&298 processParser(msg, buffer, "torqueMaxLimit", "number", 6, position, cb) &&299 processKey(msg, buffer, "torqueFinalTarget", 23, 2, position, cb) &&300 processParser(msg, buffer, "torqueFinalTarget", "number", 6, position, cb) &&301 processKey(msg, buffer, "torque", 24, 2, position, cb) &&302 processParser(msg, buffer, "torque", "number", 6, position, cb) &&303 processKey(msg, buffer, "angleMin", 25, 2, position, cb) &&304 processParser(msg, buffer, "angleMin", "number", 5, position, cb) &&305 processKey(msg, buffer, "angleMax", 26, 2, position, cb) &&306 processParser(msg, buffer, "angleMax", "number", 5, position, cb) &&307 processKey(msg, buffer, "finalAngleTarget", 27, 2, position, cb) &&308 processParser(msg, buffer, "finalAngleTarget", "number", 5, position, cb) &&309 processKey(msg, buffer, "angle", 28, 2, position, cb) &&310 processParser(msg, buffer, "angle", "number", 5, position, cb) &&311 processKey(msg, buffer, "rundownAngleMin", 29, 2, position, cb) &&312 processParser(msg, buffer, "rundownAngleMin", "number", 5, position, cb) &&313 processKey(msg, buffer, "rundownAngleMax", 30, 2, position, cb) &&314 processParser(msg, buffer, "rundownAngleMax", "number", 5, position, cb) &&315 processKey(msg, buffer, "rundownAngle", 31, 2, position, cb) &&316 processParser(msg, buffer, "rundownAngle", "number", 5, position, cb) &&317 processKey(msg, buffer, "currentMonitoringMin", 32, 2, position, cb) &&318 processParser(msg, buffer, "currentMonitoringMin", "number", 3, position, cb) &&319 processKey(msg, buffer, "currentMonitoringMax", 33, 2, position, cb) &&320 processParser(msg, buffer, "currentMonitoringMax", "number", 3, position, cb) &&321 processKey(msg, buffer, "currentMonitoringValue", 34, 2, position, cb) &&322 processParser(msg, buffer, "currentMonitoringValue", "number", 3, position, cb) &&323 processKey(msg, buffer, "selftapMin", 35, 2, position, cb) &&324 processParser(msg, buffer, "selftapMin", "number", 6, position, cb) &&325 processKey(msg, buffer, "selftapMax", 36, 2, position, cb) &&326 processParser(msg, buffer, "selftapMax", "number", 6, position, cb) &&327 processKey(msg, buffer, "selftapTorque", 37, 2, position, cb) &&328 processParser(msg, buffer, "selftapTorque", "number", 6, position, cb) &&329 processKey(msg, buffer, "prevailTorqueMonitoringMin", 38, 2, position, cb) &&330 processParser(msg, buffer, "prevailTorqueMonitoringMin", "number", 6, position, cb) &&331 processKey(msg, buffer, "prevailTorqueMonitoringMax", 39, 2, position, cb) &&332 processParser(msg, buffer, "prevailTorqueMonitoringMax", "number", 6, position, cb) &&333 processKey(msg, buffer, "prevailTorque", 40, 2, position, cb) &&334 processParser(msg, buffer, "prevailTorque", "number", 6, position, cb) &&335 processKey(msg, buffer, "tighteningID", 41, 2, position, cb) &&336 processParser(msg, buffer, "tighteningID", "number", 10, position, cb) &&337 processKey(msg, buffer, "jobSequenceNumber", 42, 2, position, cb) &&338 processParser(msg, buffer, "jobSequenceNumber", "number", 5, position, cb) &&339 processKey(msg, buffer, "syncTighteningID", 43, 2, position, cb) &&340 processParser(msg, buffer, "syncTighteningID", "number", 5, position, cb) &&341 processKey(msg, buffer, "toolSerialNumber", 44, 2, position, cb) &&342 processParser(msg, buffer, "toolSerialNumber", "string", 14, position, cb) &&343 processKey(msg, buffer, "timeStamp", 45, 2, position, cb) &&344 processParser(msg, buffer, "timeStamp", "string", 19, position, cb) &&345 processKey(msg, buffer, "timeLastChange", 46, 2, position, cb) &&346 processParser(msg, buffer, "timeLastChange", "string", 19, position, cb);347 if (status) {348 msg.payload._strategy = msg.payload.strategy;349 msg.payload.strategy = constantsMID["strategy"][msg.payload.strategy.toString()];350 msg.payload._strategyOptions = msg.payload.strategyOptions;351 msg.payload.strategyOptions = checkBitMap("strategyOptions", msg.payload.strategyOptions, 11);352 msg.payload._torqueStatus = msg.payload.torqueStatus;353 msg.payload.torqueStatus = constantsMID["status"][msg.payload.torqueStatus.toString()];354 msg.payload._angleStatus = msg.payload.angleStatus;355 msg.payload.angleStatus = constantsMID["status"][msg.payload.angleStatus.toString()];356 msg.payload._rundownAngleStatus = msg.payload.rundownAngleStatus;357 msg.payload.rundownAngleStatus = constantsMID["status"][msg.payload.rundownAngleStatus.toString()];358 msg.payload._currentMonitoringStatus = msg.payload.currentMonitoringStatus;359 msg.payload.currentMonitoringStatus = constantsMID["status"][msg.payload.currentMonitoringStatus.toString()];360 msg.payload._selftapStatus = msg.payload.selftapStatus;361 msg.payload.selftapStatus = constantsMID["status"][msg.payload.selftapStatus.toString()];362 msg.payload._prevailTorqueMonitoringStatus = msg.payload.prevailTorqueMonitoringStatus;363 msg.payload.prevailTorqueMonitoringStatus = constantsMID["status"][msg.payload.prevailTorqueMonitoringStatus.toString()];364 msg.payload._prevailTorqueCompensateStatus = msg.payload.prevailTorqueCompensateStatus;365 msg.payload.prevailTorqueCompensateStatus = constantsMID["status"][msg.payload.prevailTorqueCompensateStatus.toString()];366 msg.payload._tighteningErrorStatus = msg.payload.tighteningErrorStatus;367 msg.payload.tighteningErrorStatus = checkBitMap("tighteningErrorStatus", msg.payload.tighteningErrorStatus, 32);368 msg.payload.torqueMinLimit = (msg.payload.torqueMinLimit / 100);369 msg.payload.torqueMaxLimit = (msg.payload.torqueMaxLimit / 100);370 msg.payload.torqueFinalTarget = (msg.payload.torqueFinalTarget / 100);371 msg.payload.torque = (msg.payload.torque / 100);372 msg.payload.selftapMin = (msg.payload.selftapMin / 100);373 msg.payload.selftapMax = (msg.payload.selftapMax / 100);374 msg.payload.selftapTorque = (msg.payload.selftapTorque / 100);375 msg.payload.prevailTorqueMonitoringMin = (msg.payload.prevailTorqueMonitoringMin / 100);376 msg.payload.prevailTorqueMonitoringMax = (msg.payload.prevailTorqueMonitoringMax / 100);377 msg.payload.prevailTorque = (msg.payload.prevailTorque / 100);378 msg.payload._tighteningStatus = msg.payload.tighteningStatus;379 msg.payload.tighteningStatus = checkOK(msg.payload.tighteningStatus);380 msg.payload._batchStatus = msg.payload.batchStatus;381 msg.payload.batchStatus = checkOK(msg.payload.batchStatus);382 cb(null, msg);383 }384 break;385 case 1:386 position = {387 value: 0388 };389 status =390 processKey(msg, buffer, "cellID", 1, 2, position, cb) &&391 processParser(msg, buffer, "cellID", "number", 4, position, cb) &&392 processKey(msg, buffer, "channelID", 2, 2, position, cb) &&393 processParser(msg, buffer, "channelID", "number", 2, position, cb) &&394 processKey(msg, buffer, "torqueControllerName", 3, 2, position, cb) &&395 processParser(msg, buffer, "torqueControllerName", "string", 25, position, cb) &&396 processKey(msg, buffer, "numberVIN", 4, 2, position, cb) &&397 processParser(msg, buffer, "numberVIN", "rawString", 25, position, cb) &&398 processKey(msg, buffer, "jobID", 5, 2, position, cb) &&399 processParser(msg, buffer, "jobID", "number", 2, position, cb) &&400 processKey(msg, buffer, "parameterSetID", 6, 2, position, cb) &&401 processParser(msg, buffer, "parameterSetID", "number", 3, position, cb) &&402 processKey(msg, buffer, "batchSize", 7, 2, position, cb) &&403 processParser(msg, buffer, "batchSize", "number", 4, position, cb) &&404 processKey(msg, buffer, "batchCounter", 8, 2, position, cb) &&405 processParser(msg, buffer, "batchCounter", "number", 4, position, cb) &&406 processKey(msg, buffer, "tighteningStatus", 9, 2, position, cb) &&407 processParser(msg, buffer, "tighteningStatus", "number", 1, position, cb) &&408 processKey(msg, buffer, "torqueStatus", 10, 2, position, cb) &&409 processParser(msg, buffer, "torqueStatus", "number", 1, position, cb) &&410 processKey(msg, buffer, "angleStatus", 11, 2, position, cb) &&411 processParser(msg, buffer, "angleStatus", "number", 1, position, cb) &&412 processKey(msg, buffer, "torqueMinLimit", 12, 2, position, cb) &&413 processParser(msg, buffer, "torqueMinLimit", "number", 6, position, cb) &&414 processKey(msg, buffer, "torqueMaxLimit", 13, 2, position, cb) &&415 processParser(msg, buffer, "torqueMaxLimit", "number", 6, position, cb) &&416 processKey(msg, buffer, "torqueFinalTarget", 14, 2, position, cb) &&417 processParser(msg, buffer, "torqueFinalTarget", "number", 6, position, cb) &&418 processKey(msg, buffer, "torque", 15, 2, position, cb) &&419 processParser(msg, buffer, "torque", "number", 6, position, cb) &&420 processKey(msg, buffer, "angleMin", 16, 2, position, cb) &&421 processParser(msg, buffer, "angleMin", "number", 5, position, cb) &&422 processKey(msg, buffer, "angleMax", 17, 2, position, cb) &&423 processParser(msg, buffer, "angleMax", "number", 5, position, cb) &&424 processKey(msg, buffer, "finalAngleTarget", 18, 2, position, cb) &&425 processParser(msg, buffer, "finalAngleTarget", "number", 5, position, cb) &&426 processKey(msg, buffer, "angle", 19, 2, position, cb) &&427 processParser(msg, buffer, "angle", "number", 5, position, cb) &&428 processKey(msg, buffer, "timeStamp", 20, 2, position, cb) &&429 processParser(msg, buffer, "timeStamp", "string", 19, position, cb) &&430 processKey(msg, buffer, "timeLastChange", 21, 2, position, cb) &&431 processParser(msg, buffer, "timeLastChange", "string", 19, position, cb) &&432 processKey(msg, buffer, "batchStatus", 22, 2, position, cb) &&433 processParser(msg, buffer, "batchStatus", "number", 1, position, cb) &&434 processKey(msg, buffer, "tighteningID", 23, 2, position, cb) &&435 processParser(msg, buffer, "tighteningID", "number", 10, position, cb);436 if (status) {437 msg.payload._torqueStatus = msg.payload.torqueStatus;438 msg.payload.torqueStatus = constantsMID["status"][msg.payload.torqueStatus.toString()];439 msg.payload._angleStatus = msg.payload.angleStatus;440 msg.payload.angleStatus = constantsMID["status"][msg.payload.angleStatus.toString()];441 msg.payload.torqueMinLimit = (msg.payload.torqueMinLimit / 100);442 msg.payload.torqueMaxLimit = (msg.payload.torqueMaxLimit / 100);443 msg.payload.torqueFinalTarget = (msg.payload.torqueFinalTarget / 100);444 msg.payload.torque = (msg.payload.torque / 100);445 msg.payload._tighteningStatus = msg.payload.tighteningStatus;446 msg.payload.tighteningStatus = checkOK(msg.payload.tighteningStatus);447 msg.payload._batchStatus = msg.payload.batchStatus;448 msg.payload.batchStatus = checkOK(msg.payload.batchStatus);...
0065.js
Source:0065.js
...84 };85 msg.revision = msg.revision || 1;86 switch (msg.revision) {87 case 7:88 processKey(msg, buffer, "tighteningID", 1, 2, position, cb) &&89 processParser(msg, buffer, "tighteningID", "number", 10, position, cb) &&90 processKey(msg, buffer, "numberVIN", 2, 2, position, cb) &&91 processParser(msg, buffer, "numberVIN", "rawString", 25, position, cb) &&92 processKey(msg, buffer, "jobID", 3, 2, position, cb) &&93 processParser(msg, buffer, "jobID", "number", 4, position, cb) &&94 processKey(msg, buffer, "parameterSetID", 4, 2, position, cb) &&95 processParser(msg, buffer, "parameterSetID", "number", 3, position, cb) &&96 processKey(msg, buffer, "strategy", 5, 2, position, cb) &&97 processParser(msg, buffer, "strategy", "number", 2, position, cb) &&98 processKey(msg, buffer, "strategyOptions", 6, 2, position, cb) &&99 processParser(msg, buffer, "strategyOptions", "number", 5, position, cb) &&100 processKey(msg, buffer, "batchSize", 7, 2, position, cb) &&101 processParser(msg, buffer, "batchSize", "number", 4, position, cb) &&102 processKey(msg, buffer, "batchCounter", 8, 2, position, cb) &&103 processParser(msg, buffer, "batchCounter", "number", 4, position, cb) &&104 processKey(msg, buffer, "tighteningStatus", 9, 2, position, cb) &&105 processParser(msg, buffer, "tighteningStatus", "number", 1, position, cb) &&106 processKey(msg, buffer, "batchStatus", 10, 2, position, cb) &&107 processParser(msg, buffer, "batchStatus", "number", 1, position, cb) &&108 processKey(msg, buffer, "torqueStatus", 11, 2, position, cb) &&109 processParser(msg, buffer, "torqueStatus", "number", 1, position, cb) &&110 processKey(msg, buffer, "angleStatus", 12, 2, position, cb) &&111 processParser(msg, buffer, "angleStatus", "number", 1, position, cb) &&112 processKey(msg, buffer, "rundownAngleStatus", 13, 2, position, cb) &&113 processParser(msg, buffer, "rundownAngleStatus", "number", 1, position, cb) &&114 processKey(msg, buffer, "currentMonitoringStatus", 14, 2, position, cb) &&115 processParser(msg, buffer, "currentMonitoringStatus", "number", 1, position, cb) &&116 processKey(msg, buffer, "selftapStatus", 15, 2, position, cb) &&117 processParser(msg, buffer, "selftapStatus", "number", 1, position, cb) &&118 processKey(msg, buffer, "prevailTorqueMonitoringStatus", 16, 2, position, cb) &&119 processParser(msg, buffer, "prevailTorqueMonitoringStatus", "number", 1, position, cb) &&120 processKey(msg, buffer, "prevailTorqueCompensateStatus", 17, 2, position, cb) &&121 processParser(msg, buffer, "prevailTorqueCompensateStatus", "number", 1, position, cb) &&122 processKey(msg, buffer, "tighteningErrorStatus", 18, 2, position, cb) &&123 processParser(msg, buffer, "tighteningErrorStatus", "number", 10, position, cb) &&124 processKey(msg, buffer, "torque", 19, 2, position, cb) &&125 processParser(msg, buffer, "torque", "number", 6, position, cb) &&126 processKey(msg, buffer, "angle", 20, 2, position, cb) &&127 processParser(msg, buffer, "angle", "number", 5, position, cb) &&128 processKey(msg, buffer, "rundownAngle", 21, 2, position, cb) &&129 processParser(msg, buffer, "rundownAngle", "number", 5, position, cb) &&130 processKey(msg, buffer, "currentMonitoringValue", 22, 2, position, cb) &&131 processParser(msg, buffer, "currentMonitoringValue", "number", 3, position, cb) &&132 processKey(msg, buffer, "selftapTorque", 23, 2, position, cb) &&133 processParser(msg, buffer, "selftapTorque", "number", 6, position, cb) &&134 processKey(msg, buffer, "prevailTorque", 24, 2, position, cb) &&135 processParser(msg, buffer, "prevailTorque", "number", 6, position, cb) &&136 processKey(msg, buffer, "jobSequenceNumber", 25, 2, position, cb) &&137 processParser(msg, buffer, "jobSequenceNumber", "number", 5, position, cb) &&138 processKey(msg, buffer, "syncTighteningID", 26, 2, position, cb) &&139 processParser(msg, buffer, "syncTighteningID", "number", 5, position, cb) &&140 processKey(msg, buffer, "toolSerialNumber", 27, 2, position, cb) &&141 processParser(msg, buffer, "toolSerialNumber", "string", 14, position, cb) &&142 processKey(msg, buffer, "timeStamp", 28, 2, position, cb) &&143 processParser(msg, buffer, "timeStamp", "string", 19, position, cb) &&144 processKey(msg, buffer, "torqueValuesUnit", 29, 2, position, cb) &&145 processParser(msg, buffer, "torqueValuesUnit", "number", 1, position, cb) &&146 processKey(msg, buffer, "resultType", 30, 2, position, cb) &&147 processParser(msg, buffer, "resultType", "number", 2, position, cb) &&148 processKey(msg, buffer, "identifierPart2", 31, 2, position, cb) &&149 processParser(msg, buffer, "identifierPart2", "string", 25, position, cb) &&150 processKey(msg, buffer, "identifierPart3", 32, 2, position, cb) &&151 processParser(msg, buffer, "identifierPart3", "string", 25, position, cb) &&152 processKey(msg, buffer, "identifierPart4", 33, 2, position, cb) &&153 processParser(msg, buffer, "identifierPart4", "string", 25, position, cb) &&154 processKey(msg, buffer, "customerToghteningErrorCode", 34, 2, position, cb) &&155 processParser(msg, buffer, "customerToghteningErrorCode", "string", 4, position, cb) &&156 processKey(msg, buffer, "prevailTorqueCompensateValue", 35, 2, position, cb) &&157 processParser(msg, buffer, "prevailTorqueCompensateValue", "number", 6, position, cb) &&158 processKey(msg, buffer, "toghteningErrorStatus", 36, 2, position, cb) &&159 processParser(msg, buffer, "toghteningErrorStatus", "number", 10, position, cb) &&160 processKey(msg, buffer, "stationID", 37, 2, position, cb) &&161 processParser(msg, buffer, "stationID", "number", 10, position, cb) &&162 processKey(msg, buffer, "stationName", 38, 2, position, cb) &&163 processParser(msg, buffer, "stationName", "string", 25, position, cb) &&164 cb(null, msg);165 break;166 case 6:167 processKey(msg, buffer, "tighteningID", 1, 2, position, cb) &&168 processParser(msg, buffer, "tighteningID", "number", 10, position, cb) &&169 processKey(msg, buffer, "numberVIN", 2, 2, position, cb) &&170 processParser(msg, buffer, "numberVIN", "rawString", 25, position, cb) &&171 processKey(msg, buffer, "jobID", 3, 2, position, cb) &&172 processParser(msg, buffer, "jobID", "number", 4, position, cb) &&173 processKey(msg, buffer, "parameterSetID", 4, 2, position, cb) &&174 processParser(msg, buffer, "parameterSetID", "number", 3, position, cb) &&175 processKey(msg, buffer, "strategy", 5, 2, position, cb) &&176 processParser(msg, buffer, "strategy", "number", 2, position, cb) &&177 processKey(msg, buffer, "strategyOptions", 6, 2, position, cb) &&178 processParser(msg, buffer, "strategyOptions", "number", 5, position, cb) &&179 processKey(msg, buffer, "batchSize", 7, 2, position, cb) &&180 processParser(msg, buffer, "batchSize", "number", 4, position, cb) &&181 processKey(msg, buffer, "batchCounter", 8, 2, position, cb) &&182 processParser(msg, buffer, "batchCounter", "number", 4, position, cb) &&183 processKey(msg, buffer, "tighteningStatus", 9, 2, position, cb) &&184 processParser(msg, buffer, "tighteningStatus", "number", 1, position, cb) &&185 processKey(msg, buffer, "batchStatus", 10, 2, position, cb) &&186 processParser(msg, buffer, "batchStatus", "number", 1, position, cb) &&187 processKey(msg, buffer, "torqueStatus", 11, 2, position, cb) &&188 processParser(msg, buffer, "torqueStatus", "number", 1, position, cb) &&189 processKey(msg, buffer, "angleStatus", 12, 2, position, cb) &&190 processParser(msg, buffer, "angleStatus", "number", 1, position, cb) &&191 processKey(msg, buffer, "rundownAngleStatus", 13, 2, position, cb) &&192 processParser(msg, buffer, "rundownAngleStatus", "number", 1, position, cb) &&193 processKey(msg, buffer, "currentMonitoringStatus", 14, 2, position, cb) &&194 processParser(msg, buffer, "currentMonitoringStatus", "number", 1, position, cb) &&195 processKey(msg, buffer, "selftapStatus", 15, 2, position, cb) &&196 processParser(msg, buffer, "selftapStatus", "number", 1, position, cb) &&197 processKey(msg, buffer, "prevailTorqueMonitoringStatus", 16, 2, position, cb) &&198 processParser(msg, buffer, "prevailTorqueMonitoringStatus", "number", 1, position, cb) &&199 processKey(msg, buffer, "prevailTorqueCompensateStatus", 17, 2, position, cb) &&200 processParser(msg, buffer, "prevailTorqueCompensateStatus", "number", 1, position, cb) &&201 processKey(msg, buffer, "tighteningErrorStatus", 18, 2, position, cb) &&202 processParser(msg, buffer, "tighteningErrorStatus", "number", 10, position, cb) &&203 processKey(msg, buffer, "torque", 19, 2, position, cb) &&204 processParser(msg, buffer, "torque", "number", 6, position, cb) &&205 processKey(msg, buffer, "angle", 20, 2, position, cb) &&206 processParser(msg, buffer, "angle", "number", 5, position, cb) &&207 processKey(msg, buffer, "rundownAngle", 21, 2, position, cb) &&208 processParser(msg, buffer, "rundownAngle", "number", 5, position, cb) &&209 processKey(msg, buffer, "currentMonitoringValue", 22, 2, position, cb) &&210 processParser(msg, buffer, "currentMonitoringValue", "number", 3, position, cb) &&211 processKey(msg, buffer, "selftapTorque", 23, 2, position, cb) &&212 processParser(msg, buffer, "selftapTorque", "number", 6, position, cb) &&213 processKey(msg, buffer, "prevailTorque", 24, 2, position, cb) &&214 processParser(msg, buffer, "prevailTorque", "number", 6, position, cb) &&215 processKey(msg, buffer, "jobSequenceNumber", 25, 2, position, cb) &&216 processParser(msg, buffer, "jobSequenceNumber", "number", 5, position, cb) &&217 processKey(msg, buffer, "syncTighteningID", 26, 2, position, cb) &&218 processParser(msg, buffer, "syncTighteningID", "number", 5, position, cb) &&219 processKey(msg, buffer, "toolSerialNumber", 27, 2, position, cb) &&220 processParser(msg, buffer, "toolSerialNumber", "string", 14, position, cb) &&221 processKey(msg, buffer, "timeStamp", 28, 2, position, cb) &&222 processParser(msg, buffer, "timeStamp", "string", 19, position, cb) &&223 processKey(msg, buffer, "torqueValuesUnit", 29, 2, position, cb) &&224 processParser(msg, buffer, "torqueValuesUnit", "number", 1, position, cb) &&225 processKey(msg, buffer, "resultType", 30, 2, position, cb) &&226 processParser(msg, buffer, "resultType", "number", 2, position, cb) &&227 processKey(msg, buffer, "identifierPart2", 31, 2, position, cb) &&228 processParser(msg, buffer, "identifierPart2", "string", 25, position, cb) &&229 processKey(msg, buffer, "identifierPart3", 32, 2, position, cb) &&230 processParser(msg, buffer, "identifierPart3", "string", 25, position, cb) &&231 processKey(msg, buffer, "identifierPart4", 33, 2, position, cb) &&232 processParser(msg, buffer, "identifierPart4", "string", 25, position, cb) &&233 processKey(msg, buffer, "customerToghteningErrorCode", 34, 2, position, cb) &&234 processParser(msg, buffer, "customerToghteningErrorCode", "string", 4, position, cb) &&235 processKey(msg, buffer, "prevailTorqueCompensateValue", 35, 2, position, cb) &&236 processParser(msg, buffer, "prevailTorqueCompensateValue", "number", 6, position, cb) &&237 processKey(msg, buffer, "toghteningErrorStatus", 36, 2, position, cb) &&238 processParser(msg, buffer, "toghteningErrorStatus", "number", 10, position, cb) &&239 cb(null, msg);240 break;241 case 5:242 processKey(msg, buffer, "tighteningID", 1, 2, position, cb) &&243 processParser(msg, buffer, "tighteningID", "number", 10, position, cb) &&244 processKey(msg, buffer, "numberVIN", 2, 2, position, cb) &&245 processParser(msg, buffer, "numberVIN", "rawString", 25, position, cb) &&246 processKey(msg, buffer, "jobID", 3, 2, position, cb) &&247 processParser(msg, buffer, "jobID", "number", 4, position, cb) &&248 processKey(msg, buffer, "parameterSetID", 4, 2, position, cb) &&249 processParser(msg, buffer, "parameterSetID", "number", 3, position, cb) &&250 processKey(msg, buffer, "strategy", 5, 2, position, cb) &&251 processParser(msg, buffer, "strategy", "number", 2, position, cb) &&252 processKey(msg, buffer, "strategyOptions", 6, 2, position, cb) &&253 processParser(msg, buffer, "strategyOptions", "number", 5, position, cb) &&254 processKey(msg, buffer, "batchSize", 7, 2, position, cb) &&255 processParser(msg, buffer, "batchSize", "number", 4, position, cb) &&256 processKey(msg, buffer, "batchCounter", 8, 2, position, cb) &&257 processParser(msg, buffer, "batchCounter", "number", 4, position, cb) &&258 processKey(msg, buffer, "tighteningStatus", 9, 2, position, cb) &&259 processParser(msg, buffer, "tighteningStatus", "number", 1, position, cb) &&260 processKey(msg, buffer, "batchStatus", 10, 2, position, cb) &&261 processParser(msg, buffer, "batchStatus", "number", 1, position, cb) &&262 processKey(msg, buffer, "torqueStatus", 11, 2, position, cb) &&263 processParser(msg, buffer, "torqueStatus", "number", 1, position, cb) &&264 processKey(msg, buffer, "angleStatus", 12, 2, position, cb) &&265 processParser(msg, buffer, "angleStatus", "number", 1, position, cb) &&266 processKey(msg, buffer, "rundownAngleStatus", 13, 2, position, cb) &&267 processParser(msg, buffer, "rundownAngleStatus", "number", 1, position, cb) &&268 processKey(msg, buffer, "currentMonitoringStatus", 14, 2, position, cb) &&269 processParser(msg, buffer, "currentMonitoringStatus", "number", 1, position, cb) &&270 processKey(msg, buffer, "selftapStatus", 15, 2, position, cb) &&271 processParser(msg, buffer, "selftapStatus", "number", 1, position, cb) &&272 processKey(msg, buffer, "prevailTorqueMonitoringStatus", 16, 2, position, cb) &&273 processParser(msg, buffer, "prevailTorqueMonitoringStatus", "number", 1, position, cb) &&274 processKey(msg, buffer, "prevailTorqueCompensateStatus", 17, 2, position, cb) &&275 processParser(msg, buffer, "prevailTorqueCompensateStatus", "number", 1, position, cb) &&276 processKey(msg, buffer, "tighteningErrorStatus", 18, 2, position, cb) &&277 processParser(msg, buffer, "tighteningErrorStatus", "number", 10, position, cb) &&278 processKey(msg, buffer, "torque", 19, 2, position, cb) &&279 processParser(msg, buffer, "torque", "number", 6, position, cb) &&280 processKey(msg, buffer, "angle", 20, 2, position, cb) &&281 processParser(msg, buffer, "angle", "number", 5, position, cb) &&282 processKey(msg, buffer, "rundownAngle", 21, 2, position, cb) &&283 processParser(msg, buffer, "rundownAngle", "number", 5, position, cb) &&284 processKey(msg, buffer, "currentMonitoringValue", 22, 2, position, cb) &&285 processParser(msg, buffer, "currentMonitoringValue", "number", 3, position, cb) &&286 processKey(msg, buffer, "selftapTorque", 23, 2, position, cb) &&287 processParser(msg, buffer, "selftapTorque", "number", 6, position, cb) &&288 processKey(msg, buffer, "prevailTorque", 24, 2, position, cb) &&289 processParser(msg, buffer, "prevailTorque", "number", 6, position, cb) &&290 processKey(msg, buffer, "jobSequenceNumber", 25, 2, position, cb) &&291 processParser(msg, buffer, "jobSequenceNumber", "number", 5, position, cb) &&292 processKey(msg, buffer, "syncTighteningID", 26, 2, position, cb) &&293 processParser(msg, buffer, "syncTighteningID", "number", 5, position, cb) &&294 processKey(msg, buffer, "toolSerialNumber", 27, 2, position, cb) &&295 processParser(msg, buffer, "toolSerialNumber", "string", 14, position, cb) &&296 processKey(msg, buffer, "timeStamp", 28, 2, position, cb) &&297 processParser(msg, buffer, "timeStamp", "string", 19, position, cb) &&298 processKey(msg, buffer, "torqueValuesUnit", 29, 2, position, cb) &&299 processParser(msg, buffer, "torqueValuesUnit", "number", 1, position, cb) &&300 processKey(msg, buffer, "resultType", 30, 2, position, cb) &&301 processParser(msg, buffer, "resultType", "number", 2, position, cb) &&302 processKey(msg, buffer, "identifierPart2", 31, 2, position, cb) &&303 processParser(msg, buffer, "identifierPart2", "string", 25, position, cb) &&304 processKey(msg, buffer, "identifierPart3", 32, 2, position, cb) &&305 processParser(msg, buffer, "identifierPart3", "string", 25, position, cb) &&306 processKey(msg, buffer, "identifierPart4", 33, 2, position, cb) &&307 processParser(msg, buffer, "identifierPart4", "string", 25, position, cb) &&308 processKey(msg, buffer, "customerToghteningErrorCode", 34, 2, position, cb) &&309 processParser(msg, buffer, "customerToghteningErrorCode", "string", 4, position, cb) &&310 cb(null, msg);311 break;312 case 4:313 processKey(msg, buffer, "tighteningID", 1, 2, position, cb) &&314 processParser(msg, buffer, "tighteningID", "number", 10, position, cb) &&315 processKey(msg, buffer, "numberVIN", 2, 2, position, cb) &&316 processParser(msg, buffer, "numberVIN", "rawString", 25, position, cb) &&317 processKey(msg, buffer, "jobID", 3, 2, position, cb) &&318 processParser(msg, buffer, "jobID", "number", 4, position, cb) &&319 processKey(msg, buffer, "parameterSetID", 4, 2, position, cb) &&320 processParser(msg, buffer, "parameterSetID", "number", 3, position, cb) &&321 processKey(msg, buffer, "strategy", 5, 2, position, cb) &&322 processParser(msg, buffer, "strategy", "number", 2, position, cb) &&323 processKey(msg, buffer, "strategyOptions", 6, 2, position, cb) &&324 processParser(msg, buffer, "strategyOptions", "number", 5, position, cb) &&325 processKey(msg, buffer, "batchSize", 7, 2, position, cb) &&326 processParser(msg, buffer, "batchSize", "number", 4, position, cb) &&327 processKey(msg, buffer, "batchCounter", 8, 2, position, cb) &&328 processParser(msg, buffer, "batchCounter", "number", 4, position, cb) &&329 processKey(msg, buffer, "tighteningStatus", 9, 2, position, cb) &&330 processParser(msg, buffer, "tighteningStatus", "number", 1, position, cb) &&331 processKey(msg, buffer, "batchStatus", 10, 2, position, cb) &&332 processParser(msg, buffer, "batchStatus", "number", 1, position, cb) &&333 processKey(msg, buffer, "torqueStatus", 11, 2, position, cb) &&334 processParser(msg, buffer, "torqueStatus", "number", 1, position, cb) &&335 processKey(msg, buffer, "angleStatus", 12, 2, position, cb) &&336 processParser(msg, buffer, "angleStatus", "number", 1, position, cb) &&337 processKey(msg, buffer, "rundownAngleStatus", 13, 2, position, cb) &&338 processParser(msg, buffer, "rundownAngleStatus", "number", 1, position, cb) &&339 processKey(msg, buffer, "currentMonitoringStatus", 14, 2, position, cb) &&340 processParser(msg, buffer, "currentMonitoringStatus", "number", 1, position, cb) &&341 processKey(msg, buffer, "selftapStatus", 15, 2, position, cb) &&342 processParser(msg, buffer, "selftapStatus", "number", 1, position, cb) &&343 processKey(msg, buffer, "prevailTorqueMonitoringStatus", 16, 2, position, cb) &&344 processParser(msg, buffer, "prevailTorqueMonitoringStatus", "number", 1, position, cb) &&345 processKey(msg, buffer, "prevailTorqueCompensateStatus", 17, 2, position, cb) &&346 processParser(msg, buffer, "prevailTorqueCompensateStatus", "number", 1, position, cb) &&347 processKey(msg, buffer, "tighteningErrorStatus", 18, 2, position, cb) &&348 processParser(msg, buffer, "tighteningErrorStatus", "number", 10, position, cb) &&349 processKey(msg, buffer, "torque", 19, 2, position, cb) &&350 processParser(msg, buffer, "torque", "number", 6, position, cb) &&351 processKey(msg, buffer, "angle", 20, 2, position, cb) &&352 processParser(msg, buffer, "angle", "number", 5, position, cb) &&353 processKey(msg, buffer, "rundownAngle", 21, 2, position, cb) &&354 processParser(msg, buffer, "rundownAngle", "number", 5, position, cb) &&355 processKey(msg, buffer, "currentMonitoringValue", 22, 2, position, cb) &&356 processParser(msg, buffer, "currentMonitoringValue", "number", 3, position, cb) &&357 processKey(msg, buffer, "selftapTorque", 23, 2, position, cb) &&358 processParser(msg, buffer, "selftapTorque", "number", 6, position, cb) &&359 processKey(msg, buffer, "prevailTorque", 24, 2, position, cb) &&360 processParser(msg, buffer, "prevailTorque", "number", 6, position, cb) &&361 processKey(msg, buffer, "jobSequenceNumber", 25, 2, position, cb) &&362 processParser(msg, buffer, "jobSequenceNumber", "number", 5, position, cb) &&363 processKey(msg, buffer, "syncTighteningID", 26, 2, position, cb) &&364 processParser(msg, buffer, "syncTighteningID", "number", 5, position, cb) &&365 processKey(msg, buffer, "toolSerialNumber", 27, 2, position, cb) &&366 processParser(msg, buffer, "toolSerialNumber", "string", 14, position, cb) &&367 processKey(msg, buffer, "timeStamp", 28, 2, position, cb) &&368 processParser(msg, buffer, "timeStamp", "string", 19, position, cb) &&369 processKey(msg, buffer, "torqueValuesUnit", 29, 2, position, cb) &&370 processParser(msg, buffer, "torqueValuesUnit", "number", 1, position, cb) &&371 processKey(msg, buffer, "resultType", 30, 2, position, cb) &&372 processParser(msg, buffer, "resultType", "number", 2, position, cb) &&373 processKey(msg, buffer, "identifierPart2", 31, 2, position, cb) &&374 processParser(msg, buffer, "identifierPart2", "string", 25, position, cb) &&375 processKey(msg, buffer, "identifierPart3", 32, 2, position, cb) &&376 processParser(msg, buffer, "identifierPart3", "string", 25, position, cb) &&377 processKey(msg, buffer, "identifierPart4", 33, 2, position, cb) &&378 processParser(msg, buffer, "identifierPart4", "string", 25, position, cb) &&379 cb(null, msg);380 break;381 case 3:382 processKey(msg, buffer, "tighteningID", 1, 2, position, cb) &&383 processParser(msg, buffer, "tighteningID", "number", 10, position, cb) &&384 processKey(msg, buffer, "numberVIN", 2, 2, position, cb) &&385 processParser(msg, buffer, "numberVIN", "rawString", 25, position, cb) &&386 processKey(msg, buffer, "jobID", 3, 2, position, cb) &&387 processParser(msg, buffer, "jobID", "number", 4, position, cb) &&388 processKey(msg, buffer, "parameterSetID", 4, 2, position, cb) &&389 processParser(msg, buffer, "parameterSetID", "number", 3, position, cb) &&390 processKey(msg, buffer, "strategy", 5, 2, position, cb) &&391 processParser(msg, buffer, "strategy", "number", 2, position, cb) &&392 processKey(msg, buffer, "strategyOptions", 6, 2, position, cb) &&393 processParser(msg, buffer, "strategyOptions", "number", 5, position, cb) &&394 processKey(msg, buffer, "batchSize", 7, 2, position, cb) &&395 processParser(msg, buffer, "batchSize", "number", 4, position, cb) &&396 processKey(msg, buffer, "batchCounter", 8, 2, position, cb) &&397 processParser(msg, buffer, "batchCounter", "number", 4, position, cb) &&398 processKey(msg, buffer, "tighteningStatus", 9, 2, position, cb) &&399 processParser(msg, buffer, "tighteningStatus", "number", 1, position, cb) &&400 processKey(msg, buffer, "batchStatus", 10, 2, position, cb) &&401 processParser(msg, buffer, "batchStatus", "number", 1, position, cb) &&402 processKey(msg, buffer, "torqueStatus", 11, 2, position, cb) &&403 processParser(msg, buffer, "torqueStatus", "number", 1, position, cb) &&404 processKey(msg, buffer, "angleStatus", 12, 2, position, cb) &&405 processParser(msg, buffer, "angleStatus", "number", 1, position, cb) &&406 processKey(msg, buffer, "rundownAngleStatus", 13, 2, position, cb) &&407 processParser(msg, buffer, "rundownAngleStatus", "number", 1, position, cb) &&408 processKey(msg, buffer, "currentMonitoringStatus", 14, 2, position, cb) &&409 processParser(msg, buffer, "currentMonitoringStatus", "number", 1, position, cb) &&410 processKey(msg, buffer, "selftapStatus", 15, 2, position, cb) &&411 processParser(msg, buffer, "selftapStatus", "number", 1, position, cb) &&412 processKey(msg, buffer, "prevailTorqueMonitoringStatus", 16, 2, position, cb) &&413 processParser(msg, buffer, "prevailTorqueMonitoringStatus", "number", 1, position, cb) &&414 processKey(msg, buffer, "prevailTorqueCompensateStatus", 17, 2, position, cb) &&415 processParser(msg, buffer, "prevailTorqueCompensateStatus", "number", 1, position, cb) &&416 processKey(msg, buffer, "tighteningErrorStatus", 18, 2, position, cb) &&417 processParser(msg, buffer, "tighteningErrorStatus", "number", 10, position, cb) &&418 processKey(msg, buffer, "torque", 19, 2, position, cb) &&419 processParser(msg, buffer, "torque", "number", 6, position, cb) &&420 processKey(msg, buffer, "angle", 20, 2, position, cb) &&421 processParser(msg, buffer, "angle", "number", 5, position, cb) &&422 processKey(msg, buffer, "rundownAngle", 21, 2, position, cb) &&423 processParser(msg, buffer, "rundownAngle", "number", 5, position, cb) &&424 processKey(msg, buffer, "currentMonitoringValue", 22, 2, position, cb) &&425 processParser(msg, buffer, "currentMonitoringValue", "number", 3, position, cb) &&426 processKey(msg, buffer, "selftapTorque", 23, 2, position, cb) &&427 processParser(msg, buffer, "selftapTorque", "number", 6, position, cb) &&428 processKey(msg, buffer, "prevailTorque", 24, 2, position, cb) &&429 processParser(msg, buffer, "prevailTorque", "number", 6, position, cb) &&430 processKey(msg, buffer, "jobSequenceNumber", 25, 2, position, cb) &&431 processParser(msg, buffer, "jobSequenceNumber", "number", 5, position, cb) &&432 processKey(msg, buffer, "syncTighteningID", 26, 2, position, cb) &&433 processParser(msg, buffer, "syncTighteningID", "number", 5, position, cb) &&434 processKey(msg, buffer, "toolSerialNumber", 27, 2, position, cb) &&435 processParser(msg, buffer, "toolSerialNumber", "string", 14, position, cb) &&436 processKey(msg, buffer, "timeStamp", 28, 2, position, cb) &&437 processParser(msg, buffer, "timeStamp", "string", 19, position, cb) &&438 processKey(msg, buffer, "torqueValuesUnit", 29, 2, position, cb) &&439 processParser(msg, buffer, "torqueValuesUnit", "number", 1, position, cb) &&440 processKey(msg, buffer, "resultType", 30, 2, position, cb) &&441 processParser(msg, buffer, "resultType", "number", 2, position, cb) &&442 cb(null, msg);443 break;444 case 2:445 processKey(msg, buffer, "tighteningID", 1, 2, position, cb) &&446 processParser(msg, buffer, "tighteningID", "number", 10, position, cb) &&447 processKey(msg, buffer, "numberVIN", 2, 2, position, cb) &&448 processParser(msg, buffer, "numberVIN", "rawString", 25, position, cb) &&449 processKey(msg, buffer, "jobID", 3, 2, position, cb) &&450 processParser(msg, buffer, "jobID", "number", 4, position, cb) &&451 processKey(msg, buffer, "parameterSetID", 4, 2, position, cb) &&452 processParser(msg, buffer, "parameterSetID", "number", 3, position, cb) &&453 processKey(msg, buffer, "strategy", 5, 2, position, cb) &&454 processParser(msg, buffer, "strategy", "number", 2, position, cb) &&455 processKey(msg, buffer, "strategyOptions", 6, 2, position, cb) &&456 processParser(msg, buffer, "strategyOptions", "number", 5, position, cb) &&457 processKey(msg, buffer, "batchSize", 7, 2, position, cb) &&458 processParser(msg, buffer, "batchSize", "number", 4, position, cb) &&459 processKey(msg, buffer, "batchCounter", 8, 2, position, cb) &&460 processParser(msg, buffer, "batchCounter", "number", 4, position, cb) &&461 processKey(msg, buffer, "tighteningStatus", 9, 2, position, cb) &&462 processParser(msg, buffer, "tighteningStatus", "number", 1, position, cb) &&463 processKey(msg, buffer, "batchStatus", 10, 2, position, cb) &&464 processParser(msg, buffer, "batchStatus", "number", 1, position, cb) &&465 processKey(msg, buffer, "torqueStatus", 11, 2, position, cb) &&466 processParser(msg, buffer, "torqueStatus", "number", 1, position, cb) &&467 processKey(msg, buffer, "angleStatus", 12, 2, position, cb) &&468 processParser(msg, buffer, "angleStatus", "number", 1, position, cb) &&469 processKey(msg, buffer, "rundownAngleStatus", 13, 2, position, cb) &&470 processParser(msg, buffer, "rundownAngleStatus", "number", 1, position, cb) &&471 processKey(msg, buffer, "currentMonitoringStatus", 14, 2, position, cb) &&472 processParser(msg, buffer, "currentMonitoringStatus", "number", 1, position, cb) &&473 processKey(msg, buffer, "selftapStatus", 15, 2, position, cb) &&474 processParser(msg, buffer, "selftapStatus", "number", 1, position, cb) &&475 processKey(msg, buffer, "prevailTorqueMonitoringStatus", 16, 2, position, cb) &&476 processParser(msg, buffer, "prevailTorqueMonitoringStatus", "number", 1, position, cb) &&477 processKey(msg, buffer, "prevailTorqueCompensateStatus", 17, 2, position, cb) &&478 processParser(msg, buffer, "prevailTorqueCompensateStatus", "number", 1, position, cb) &&479 processKey(msg, buffer, "tighteningErrorStatus", 18, 2, position, cb) &&480 processParser(msg, buffer, "tighteningErrorStatus", "number", 10, position, cb) &&481 processKey(msg, buffer, "torque", 19, 2, position, cb) &&482 processParser(msg, buffer, "torque", "number", 6, position, cb) &&483 processKey(msg, buffer, "angle", 20, 2, position, cb) &&484 processParser(msg, buffer, "angle", "number", 5, position, cb) &&485 processKey(msg, buffer, "rundownAngle", 21, 2, position, cb) &&486 processParser(msg, buffer, "rundownAngle", "number", 5, position, cb) &&487 processKey(msg, buffer, "currentMonitoringValue", 22, 2, position, cb) &&488 processParser(msg, buffer, "currentMonitoringValue", "number", 3, position, cb) &&489 processKey(msg, buffer, "selftapTorque", 23, 2, position, cb) &&490 processParser(msg, buffer, "selftapTorque", "number", 6, position, cb) &&491 processKey(msg, buffer, "prevailTorque", 24, 2, position, cb) &&492 processParser(msg, buffer, "prevailTorque", "number", 6, position, cb) &&493 processKey(msg, buffer, "jobSequenceNumber", 25, 2, position, cb) &&494 processParser(msg, buffer, "jobSequenceNumber", "number", 5, position, cb) &&495 processKey(msg, buffer, "syncTighteningID", 26, 2, position, cb) &&496 processParser(msg, buffer, "syncTighteningID", "number", 5, position, cb) &&497 processKey(msg, buffer, "toolSerialNumber", 27, 2, position, cb) &&498 processParser(msg, buffer, "toolSerialNumber", "string", 14, position, cb) &&499 processKey(msg, buffer, "timeStamp", 28, 2, position, cb) &&500 processParser(msg, buffer, "timeStamp", "string", 19, position, cb) &&501 cb(null, msg);502 break;503 case 1:504 processKey(msg, buffer, "tighteningID", 1, 2, position, cb) &&505 processParser(msg, buffer, "tighteningID", "number", 10, position, cb) &&506 processKey(msg, buffer, "numberVIN", 2, 2, position, cb) &&507 processParser(msg, buffer, "numberVIN", "rawString", 25, position, cb) &&508 processKey(msg, buffer, "parameterSetID", 3, 2, position, cb) &&509 processParser(msg, buffer, "parameterSetID", "number", 3, position, cb) &&510 processKey(msg, buffer, "batchCounter", 4, 2, position, cb) &&511 processParser(msg, buffer, "batchCounter", "number", 4, position, cb) &&512 processKey(msg, buffer, "tighteningStatus", 5, 2, position, cb) &&513 processParser(msg, buffer, "tighteningStatus", "number", 1, position, cb) &&514 processKey(msg, buffer, "torqueStatus", 6, 2, position, cb) &&515 processParser(msg, buffer, "torqueStatus", "number", 1, position, cb) &&516 processKey(msg, buffer, "angleStatus", 7, 2, position, cb) &&517 processParser(msg, buffer, "angleStatus", "number", 1, position, cb) &&518 processKey(msg, buffer, "torque", 8, 2, position, cb) &&519 processParser(msg, buffer, "torque", "number", 6, position, cb) &&520 processKey(msg, buffer, "angle", 9, 2, position, cb) &&521 processParser(msg, buffer, "angle", "number", 5, position, cb) &&522 processKey(msg, buffer, "timeStamp", 10, 2, position, cb) &&523 processParser(msg, buffer, "timeStamp", "string", 19, position, cb) &&524 processKey(msg, buffer, "batchStatus", 11, 2, position, cb) &&525 processParser(msg, buffer, "batchStatus", "number", 1, position, cb) &&526 cb(null, msg);527 break;528 default:529 cb(new Error(`[Parser MID${msg.mid}] invalid revision [${msg.revision}]`));530 break;531 }532}533function serializer(msg, opts, cb) {534 let buf;535 let statusprocess = false;536 let position = {537 value: 0538 };...
0002.js
Source:0002.js
...37 };38 msg.revision = msg.revision || 1;39 switch (msg.revision) {40 case 6:41 processKey(msg, buffer, "cellID", 1, 2, position, cb) &&42 processParser(msg, buffer, "cellID", "number", 4, position, cb) &&43 processKey(msg, buffer, "channelID", 2, 2, position, cb) &&44 processParser(msg, buffer, "channelID", "number", 2, position, cb) &&45 processKey(msg, buffer, "controllerName", 3, 2, position, cb) &&46 processParser(msg, buffer, "controllerName", "string", 25, position, cb) &&47 processKey(msg, buffer, "supplierCode", 4, 2, position, cb) &&48 processParser(msg, buffer, "supplierCode", "string", 3, position, cb) &&49 processKey(msg, buffer, "openProtocolVersion", 5, 2, position, cb) &&50 processParser(msg, buffer, "openProtocolVersion", "string", 19, position, cb) &&51 processKey(msg, buffer, "controllerSoftwareVersion", 6, 2, position, cb) &&52 processParser(msg, buffer, "controllerSoftwareVersion", "string", 19, position, cb) &&53 processKey(msg, buffer, "toolSoftwareVersion", 7, 2, position, cb) &&54 processParser(msg, buffer, "toolSoftwareVersion", "string", 19, position, cb) &&55 processKey(msg, buffer, "rbuType", 8, 2, position, cb) &&56 processParser(msg, buffer, "rbuType", "string", 24, position, cb) &&57 processKey(msg, buffer, "controllerSerialNumber", 9, 2, position, cb) &&58 processParser(msg, buffer, "controllerSerialNumber", "string", 10, position, cb) &&59 processKey(msg, buffer, "systemType", 10, 2, position, cb) &&60 processParser(msg, buffer, "systemType", "number", 3, position, cb) &&61 processKey(msg, buffer, "systemSubtype", 11, 2, position, cb) &&62 processParser(msg, buffer, "systemSubtype", "number", 3, position, cb) &&63 processKey(msg, buffer, "sequenceNumberSupport", 12, 2, position, cb) &&64 processParser(msg, buffer, "sequenceNumberSupport", "number", 1, position, cb) &&65 processKey(msg, buffer, "linkingHandlingSupport", 13, 2, position, cb) &&66 processParser(msg, buffer, "linkingHandlingSupport", "number", 1, position, cb) &&67 cb(null, msg);68 break;69 case 5:70 processKey(msg, buffer, "cellID", 1, 2, position, cb) &&71 processParser(msg, buffer, "cellID", "number", 4, position, cb) &&72 processKey(msg, buffer, "channelID", 2, 2, position, cb) &&73 processParser(msg, buffer, "channelID", "number", 2, position, cb) &&74 processKey(msg, buffer, "controllerName", 3, 2, position, cb) &&75 processParser(msg, buffer, "controllerName", "string", 25, position, cb) &&76 processKey(msg, buffer, "supplierCode", 4, 2, position, cb) &&77 processParser(msg, buffer, "supplierCode", "string", 3, position, cb) &&78 processKey(msg, buffer, "openProtocolVersion", 5, 2, position, cb) &&79 processParser(msg, buffer, "openProtocolVersion", "string", 19, position, cb) &&80 processKey(msg, buffer, "controllerSoftwareVersion", 6, 2, position, cb) &&81 processParser(msg, buffer, "controllerSoftwareVersion", "string", 19, position, cb) &&82 processKey(msg, buffer, "toolSoftwareVersion", 7, 2, position, cb) &&83 processParser(msg, buffer, "toolSoftwareVersion", "string", 19, position, cb) &&84 processKey(msg, buffer, "rbuType", 8, 2, position, cb) &&85 processParser(msg, buffer, "rbuType", "string", 24, position, cb) &&86 processKey(msg, buffer, "controllerSerialNumber", 9, 2, position, cb) &&87 processParser(msg, buffer, "controllerSerialNumber", "string", 10, position, cb) &&88 processKey(msg, buffer, "systemType", 10, 2, position, cb) &&89 processParser(msg, buffer, "systemType", "number", 3, position, cb) &&90 processKey(msg, buffer, "systemSubtype", 11, 2, position, cb) &&91 processParser(msg, buffer, "systemSubtype", "number", 3, position, cb) &&92 cb(null, msg);93 break;94 case 4:95 processKey(msg, buffer, "cellID", 1, 2, position, cb) &&96 processParser(msg, buffer, "cellID", "number", 4, position, cb) &&97 processKey(msg, buffer, "channelID", 2, 2, position, cb) &&98 processParser(msg, buffer, "channelID", "number", 2, position, cb) &&99 processKey(msg, buffer, "controllerName", 3, 2, position, cb) &&100 processParser(msg, buffer, "controllerName", "string", 25, position, cb) &&101 processKey(msg, buffer, "supplierCode", 4, 2, position, cb) &&102 processParser(msg, buffer, "supplierCode", "string", 3, position, cb) &&103 processKey(msg, buffer, "openProtocolVersion", 5, 2, position, cb) &&104 processParser(msg, buffer, "openProtocolVersion", "string", 19, position, cb) &&105 processKey(msg, buffer, "controllerSoftwareVersion", 6, 2, position, cb) &&106 processParser(msg, buffer, "controllerSoftwareVersion", "string", 19, position, cb) &&107 processKey(msg, buffer, "toolSoftwareVersion", 7, 2, position, cb) &&108 processParser(msg, buffer, "toolSoftwareVersion", "string", 19, position, cb) &&109 processKey(msg, buffer, "rbuType", 8, 2, position, cb) &&110 processParser(msg, buffer, "rbuType", "string", 24, position, cb) &&111 processKey(msg, buffer, "controllerSerialNumber", 9, 2, position, cb) &&112 processParser(msg, buffer, "controllerSerialNumber", "string", 10, position, cb) &&113 cb(null, msg);114 break;115 case 3:116 processKey(msg, buffer, "cellID", 1, 2, position, cb) &&117 processParser(msg, buffer, "cellID", "number", 4, position, cb) &&118 processKey(msg, buffer, "channelID", 2, 2, position, cb) &&119 processParser(msg, buffer, "channelID", "number", 2, position, cb) &&120 processKey(msg, buffer, "controllerName", 3, 2, position, cb) &&121 processParser(msg, buffer, "controllerName", "string", 25, position, cb) &&122 processKey(msg, buffer, "supplierCode", 4, 2, position, cb) &&123 processParser(msg, buffer, "supplierCode", "string", 3, position, cb) &&124 processKey(msg, buffer, "openProtocolVersion", 5, 2, position, cb) &&125 processParser(msg, buffer, "openProtocolVersion", "string", 19, position, cb) &&126 processKey(msg, buffer, "controllerSoftwareVersion", 6, 2, position, cb) &&127 processParser(msg, buffer, "controllerSoftwareVersion", "string", 19, position, cb) &&128 processKey(msg, buffer, "toolSoftwareVersion", 7, 2, position, cb) &&129 processParser(msg, buffer, "toolSoftwareVersion", "string", 19, position, cb) &&130 cb(null, msg);131 break;132 case 2:133 processKey(msg, buffer, "cellID", 1, 2, position, cb) &&134 processParser(msg, buffer, "cellID", "number", 4, position, cb) &&135 processKey(msg, buffer, "channelID", 2, 2, position, cb) &&136 processParser(msg, buffer, "channelID", "number", 2, position, cb) &&137 processKey(msg, buffer, "controllerName", 3, 2, position, cb) &&138 processParser(msg, buffer, "controllerName", "string", 25, position, cb) &&139 processKey(msg, buffer, "supplierCode", 4, 2, position, cb) &&140 processParser(msg, buffer, "supplierCode", "string", 3, position, cb) &&141 cb(null, msg);142 break;143 case 1:144 processKey(msg, buffer, "cellID", 1, 2, position, cb) &&145 processParser(msg, buffer, "cellID", "number", 4, position, cb) &&146 processKey(msg, buffer, "channelID", 2, 2, position, cb) &&147 processParser(msg, buffer, "channelID", "number", 2, position, cb) &&148 processKey(msg, buffer, "controllerName", 3, 2, position, cb) &&149 processParser(msg, buffer, "controllerName", "string", 25, position, cb) &&150 cb(null, msg);151 break;152 default:153 cb(new Error(`[Parser MID${msg.mid}] invalid revision [${msg.revision}]`));154 break;155 }156}157function serializer(msg, opts, cb) {158 let buf;159 let statusprocess = false;160 let position = {161 value: 0162 };...
index.js
Source:index.js
1var http = require('http'); // if going through a proxy that uses SSL change to "require('https');"2var path = ''; //assign variable for path3// Your external IP. Alexa can only access publically-accessible IPs. No LAN access unfortunately.4// Make sure to set up port forwarding on port 8080 to your DTV's IP on your router.5// In my case I had to move receiver to DMZ6////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////7////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8var wan_ip = 'XXX.XXX.XXX.XXX'; //updated to avoid confussion9//externalIP or FQDN //////////////////////////////////////////////////////////////////////////10//var wan_ip = '<some fqdn>';11////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////12////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////13/**14 * App ID for the skill15 */16 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////17var APP_ID = "amzn1.ask.skill.[App ID]"; 18///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////19/**20* The AlexaSkill prototype and helper functions21 */22var AlexaSkill = require('./AlexaSkill');23 24var DTVControl = function () {25 AlexaSkill.call(this, APP_ID);26};27// Extend AlexaSkill28DTVControl.prototype = Object.create(AlexaSkill.prototype);29DTVControl.prototype.constructor = DTVControl;30//Ignore Certificate errors if using HTTPS communication31process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";32DTVControl.prototype.intentHandlers = {33 DirectvIntent: function (intent, session, response) {34 35 //No matter what she wants to tell you her opinion.36 37 function satisfyAlexa() {38 response.tell("OK");39 };40 41 // Obtain User Intent42 switch(intent.slots.Control.value) {43 44 // Same button is used45 case "play":46 case "resume":47 path = '/remote/processKey?key=play&hold=keyPress';48 break;49 50 case "pause":51 case "freeze":52 path = '/remote/processKey?key=pause&hold=keyPress';53 break;54 55 case "guide":56 path = '/remote/processKey?key=guide&hold=keyPress'57 break;58 59 case "power":60 path = '/remote/processKey?key=power&hold=keyPress';61 break;62 63 case "format":64 path = '/remote/processKey?key=format&hold=keyPress';65 break;66 67 case "rewind":68 path = '/remote/processKey?key=rew&hold=keyPress';69 break;70 71 case "replay":72 path = '/remote/processKey?key=replay&hold=keyPress';73 break;74 75 case "stop":76 path= '/remote/processKey?key=stop&hold=keyPress';77 break;78 79 case "advance":80 path= '/remote/processKey?key=advance&hold=keyPress';81 break;82 83 case "fast forward":84 path = '/remote/processKey?key=ffwd&hold=keyPress';85 break;86 87 case "record":88 case "save":89 path = '/remote/processKey?key=record&hold=keyPress';90 break;91 92 case "active":93 path= '/remote/processKey?key=active&hold=keyPress';94 break;95 96 case "list":97 case "recorded shows":98 case "DVR":99 path = '/remote/processKey?key=list&hold=keyPress';100 break;101 102 case "exit":103 case "end":104 case "leave":105 path = '/remote/processKey?key=exit&hold=keyPress';106 break;107 108 case "back":109 path= '/remote/processKey?key=back&hold=keyPress';110 break;111 112 case "menu":113 path = '/remote/processKey?key=menu&hold=keyPress';114 break;115 116 case "info":117 path= '/remote/processKey?key=info&hold=keyPress';118 break;119 120 case "up":121 path = '/remote/processKey?key=up&hold=keyPress';122 break;123 124 case "down":125 path = '/remote/processKey?key=down&hold=keyPress';126 break;127 case "left":128 path= '/remote/processKey?key=left&hold=keyPress';129 break;130 131 case "right":132 path= '/remote/processKey?key=right&hold=keyPress';133 break;134 135 case "select":136 case "enter":137 path= '/remote/processKey?key=select&hold=keyPress';138 break;139 140 case "channel up":141 case "page up":142 path= '/remote/processKey?key=chanup&hold=keyPress';143 break;144 145 case "channel down":146 case "page down":147 path = '/remote/processKey?key=chandown&hold=keyPress';148 break;149 150 case "previous":151 path= '/remote/processKey?key=prev&hold=keyPress';152 break;153 154 case "CNN":155 path = '/tv/tune?major=202';156 157 break;158 159 case "CBS":160 path = '/tv/tune?major=391';161 162 break;163 164 case "ABC":165 path = '/tv/tune?major=397';166 167 break;168 169 case "amc":170 path = '/tv/tune?major=254';171 172 break;173 174 case "animal planet":175 path = '/tv/tune?major=282';176 177 break;178 179 case "b.e.t.":180 case "BET":181 case "bet":182 path = '/tv/tune?major=329';183 184 break;185 186 case "bravo":187 path = '/tv/tune?major=237';188 189 break;190 191 case "comedy central":192 path = '/tv/tune?major=249';193 194 break;195 196 case "c span":197 case "C span":198 path = '/tv/tune?major=250';199 200 break;201 202 case "cartoon network":203 path = '/tv/tune?major=296';204 205 break;206 207 case "discovery":208 path = '/tv/tune?major=278';209 210 break;211 212 case "Disney channel":213 path = '/tv/tune?major=290';214 215 break;216 217 case "Disney junior":218 path = '/tv/tune?major=289';219 220 break;221 222 case "Disney xD":223 case "Disney x.d.":224 path = '/tv/tune?major=292';225 226 break;227 228 case "food network":229 path = '/tv/tune?major=231';230 231 break;232 233 case "fox news":234 path = '/tv/tune?major=360';235 236 break;237 238 case "fox":239 path = '/tv/tune?major=360';240 241 break;242 243 case "fx":244 path = '/tv/tune?major=248';245 246 break;247 248 case "h.g.t.v.":249 case "hgtv":250 case "HGTV":251 path = '/tv/tune?major=229';252 253 break;254 255 case "history channel":256 path = '/tv/tune?major=269';257 258 break;259 260 case "lifetime":261 path = '/tv/tune?major=252';262 263 break;264 265 case "MSNBC":266 path = '/tv/tune?major=356';267 268 break;269 270 case "MTV":271 path = '/tv/tune?major=331';272 273 break;274 275 case "MTV 2":276 path = '/tv/tune?major=333';277 278 break;279 280 case "national geographic":281 path = '/tv/tune?major=276';282 283 break;284 285 case "nick junior":286 path = '/tv/tune?major=301';287 288 break;289 290 case "spike":291 path = '/tv/tune?major=241';292 293 break;294 case "syfy":295 path = '/tv/tune?major=244';296 297 break;298 299 case "TBS":300 case "t.b.s.":301 case "tbs":302 path = '/tv/tune?major=247';303 304 break;305 306 case "TNT":307 path = '/tv/tune?major=245';308 309 break;310 311 case "true TV":312 path = '/tv/tune?major=246';313 314 break;315 316 case "vh 1":317 path = '/tv/tune?major=335';318 319 break;320 321 case "ESPN":322 path = '/tv/tune?major=206';323 324 break;325 326 case "ESPN 2":327 path = '/tv/tune?major=209';328 329 break;330 331 case "NBC sports":332 path = '/tv/tune?major=220';333 334 break;335 336 case "NBC":337 path = '/tv/tune?major=393';338 339 break;340 341 case "fox sports":342 path = '/tv/tune?major=219';343 344 break;345 346 347 348 default:349 350 if (! isNaN(intent.slots.Channel.value) ) {351 path = '/tv/tune?major=' + intent.slots.Channel.value ;352 }353 else {354 response.tell("I didn't understand.");}355 break;356 357 } 358 var options = {359 host: wan_ip,360 port: 8080, // default port for DTV interface361 path: '' + path, // Modify if path is prefixed 362 method: 'GET' //, //(remove first comment slashes if using the "auth" option below)363 // auth: 'username:password' // this is used if going through authenticated proxy (this is BASIC AUTH)364 };365 var req = http.request(options, satisfyAlexa);366 req.end(); 367 }368}369exports.handler = function (event, context) {370 371 var dtvControl = new DTVControl();372 dtvControl.execute(event, context);373 ...
runIntegrationTests.js
Source:runIntegrationTests.js
1const colors = require('colors');2const { spawn } = require('child_process');3const path = require('path');4// need to manually flag when tests fail because of5// an error in mochajs that hasn't been addressed6let hasFailingTests = false;7const launchRegex = {8 webapp: /\s*currently running at (tcp|https?):\/\/(localhost|([0-9]+.){3}[0-9]+):[0-9]{4}/gm9};10const serversListening = {11 webapp: false12};13const cmdStrings = {14 webapp: 'node server/app.js',15 tests: 'npm run test'16};17/**18 * refs for node process handlers based on process key19 */20const processHandlers = {21 webapp: undefined,22 tests: undefined23};24let areTestsRunning = false;25function spawnProcess({ processKey, onServerEvent }) {26 if(processKey == 'tests' && !areTestsRunning) {27 areTestsRunning = true;28 }29 const cmd = cmdStrings[processKey];30 const processHandler = spawn(cmd, { shell: true, cwd: path.resolve('./') });31 processHandlers[processKey] = processHandler;32 processHandler.stdout.on('data', m => {33 const message = m.toString().replace(/\u001b\[.*?m/g, '');34 console.log(`${`[${processKey}]`.bold.yellow}: ${m}`);35 switch (processKey) {36 case 'webapp': {37 if(!serversListening[processKey] && launchRegex[processKey].test(message)) {38 onServerEvent({ serverType: processKey, event: 'server-start' });39 }40 break;41 }42 case 'tests':43 hasFailingTests = hasFailingTests || (44 /[1-9]([0-9]?)+ failing/gm.test(message) ||45 /ERR!/gm.test(message)46 );47 break;48 default:49 break;50 }51 });52 processHandler.stderr.on('data', m => {53 const message = m.toString().replace(/\u001b\[.*?m/g, '');54 // check if any of the tests reported as failing55 hasFailingTests = hasFailingTests || (56 /[1-9]([0-9]?)+ failing/g.test(message) ||57 /ERR!/g.test(message)58 );59 console.log(`${processKey.yellow.bold} ${'error'.red} -> ${message}`);60 });61 processHandler.stdout.on('close', exitCode => {62 console.log(`process close event for ${processKey.bold.yellow} reached`);63 Object.entries(processHandlers).forEach(([key, handler]) => {64 if(serversListening[key]) {65 handler.stdin.pause();66 serversListening[key] = false;67 }68 handler.kill();69 });70 if((processKey == 'tests') && !exitCode && !hasFailingTests) {71 console.log('tests successful â
, exiting...');72 process.exit(0);73 }74 else if(exitCode) {75 console.log('process error occurred');76 process.exit(1);77 }78 else {79 process.exit(1);80 }81 });82 processHandler.on('exit', (exitCode, _s) => {83 if((exitCode != 0) || hasFailingTests) {84 process.exit(1);85 }86 });87}88spawnProcess({ processKey: 'webapp', onServerEvent: ({ serverType, event }) => {89 switch (event) {90 case 'server-start': {91 console.log(`${serverType.bold.yellow} has started listening ð`);92 serversListening[serverType] = true;93 break;94 }95 case 'server-stop': {96 console.log(`${serverType.bold.yellow} has stopped listening ð´`);97 serversListening[serverType] = false;98 break;99 }100 }101 if(serversListening.webapp && !areTestsRunning) {102 console.log(`time to run through tests!`);103 spawnProcess({ processKey: 'tests' });104 }...
Input.js
Source:Input.js
...17 : "keyboard-letter"18 return (19 <div20 className={classes}21 onClick={() => processKey(letter)}22 >23 {letter}24 </div>25 )26}27const Keyboard = ({ guesses, processKey }) => {28 const { showKeyboard = true } = useGameContext()29 if (!showKeyboard) {30 return null31 }32 return (33 <div className="keyboard">34 <div className="keyboard-row">35 {Array.from(FIRST_ROW).map((letter) => (36 <Key37 key={letter}38 guesses={guesses}39 letter={letter}40 processKey={processKey}41 />42 ))}43 </div>44 <div className="keyboard-row keyboard-row-2">45 {Array.from(SECOND_ROW).map((letter) => (46 <Key47 key={letter}48 guesses={guesses}49 letter={letter}50 processKey={processKey}51 />52 ))}53 </div>54 <div className="keyboard-row">55 <div56 className="keyboard-letter keyboard-wide"57 onClick={() => processKey('backspace')}58 >59 â«60 </div>61 {Array.from(THIRD_ROW).map((letter) => (62 <Key63 key={letter}64 guesses={guesses}65 letter={letter}66 processKey={processKey}67 />68 ))}69 <div70 className="keyboard-letter keyboard-semi-wide"71 onClick={() => processKey('enter')}72 >73 â74 </div>75 </div>76 </div>77 )78}79const Input = ({80 guesses,81 isValidGuess,82 length,83 onGuessChange,84 onSubmit,85}) => {86 const [guess, setGuess] = useState('')87 const [submitting, setSubmitting] = useState(false)88 const processKey = useCallback((key) => {89 if (LETTERS.includes(key)) {90 setGuess((current) => (91 (current + key).slice(0, length)92 ))93 } else if (key === BACKSPACE) {94 setGuess((current) => current.slice(0, current.length - 1))95 } else if (key === ENTER) {96 setSubmitting(true)97 }98 }, [length])99 const onKeyDown = useCallback((event) => {100 if (event.altKey || event.ctrlKey || event.metaKey) {101 return102 }103 const key = event.key.toLowerCase()104 processKey(key)105 }, [processKey])106 useEventListener('keydown', onKeyDown)107 useEffect(() => {108 if (submitting) {109 if (isValidGuess(guess)) {110 onGuessChange('')111 onSubmit(guess)112 setGuess('')113 }114 setSubmitting(false)115 }116 }, [guess, isValidGuess, onGuessChange, onSubmit, submitting])117 useEffect(() => {118 onGuessChange(guess)...
contract.test.js
Source:contract.test.js
1const {GatewayType} = require('../src/contract-consts');2const {Processes} = require('../src/contracts/Processes');3const assert = require('chai').assert4const makeFakeContext = require('./make-fake-context')5describe('temp', async function(){6 beforeEach(async function(){7 })8 it('temp', async function(){9 })10})11describe('Processes Contract', async function(){12 let ctx = makeFakeContext(); //Mock-stub saves states locally and will lose them if re-instantiated -13 // do not overwrite in beforeEach14 let testContract = new Processes();15 beforeEach(async function(){16 })17 describe('Sample usage', async function(){18 let processKey;19 beforeEach(async function(){20 })21 it('create Process', async function(){22 processKey = await testContract.createProcess(ctx);23 })24 it('create root Task 1', async function(){25 await testContract.createTask(ctx, processKey, 1, '', '', '[]',26 GatewayType.NONE.id, '[]');27 })28 it('create task 2, requiring task 1', async function(){29 await testContract.createTask(ctx, processKey, 2, '', '', '[]',30 GatewayType.NONE.id, '[1]');31 })32 it('cannot execute task 2 before 1', async function(){33 let success = await testContract.executeTask(ctx, processKey, 2);34 assert.isFalse(success)35 })36 it('no tasks completed', async function(){37 assert.isFalse(await testContract.getTaskCompleted(ctx, processKey, 1));38 assert.isFalse(await testContract.getTaskCompleted(ctx, processKey, 2));39 })40 it('execute task 1', async function(){41 let success = await testContract.executeTask(ctx, processKey, 1);42 assert.isTrue(success);43 })44 it('execute task 2', async function(){45 let success = await testContract.executeTask(ctx, processKey, 2);46 assert.isTrue(success);47 })48 it('both tasks completed', async function(){49 assert.isTrue(await testContract.getTaskCompleted(ctx, processKey, 1));50 assert.isTrue(await testContract.getTaskCompleted(ctx, processKey, 2));51 })52 it('created variable', async function(){53 await testContract.createVariable(ctx, processKey, 1, 0, '');54 })55 it('updated variable', async function(){56 await testContract.setVariableValue(ctx, processKey, 1, 'abc');57 })58 it('accessed variable', async function(){59 let val = await testContract.getVariableValue(ctx, processKey, 1);60 assert.equal(val, 'abc')61 })62 it('eventLog is correct', async function(){63 let eL = JSON.parse(await testContract.getEventLog(ctx, processKey))64 assert.deepEqual(eL, [1,2]);65 })66 })...
storage.js
Source:storage.js
1const flag = 'POSTER_EDITOR_'2function processKey(key) {3 return flag + key4}5function setLocal(key, data) {6 if (!data) {7 localStorage.removeItem(processKey(key))8 }9 localStorage.setItem(processKey(key), JSON.stringify(data))10}11function removeLocal(key) {12 localStorage.removeItem(processKey(key))13}14function getLocal(key) {15 return JSON.parse(localStorage.getItem(processKey(key)))16}17function setSession(key, data) {18 if (!data) {19 sessionStorage.removeItem(processKey(key))20 }21 sessionStorage.setItem(processKey(key), JSON.stringify(data))22}23function removeSession(key) {24 sessionStorage.removeItem(processKey(key))25}26function getSession(key) {27 return JSON.parse(sessionStorage.getItem(processKey(key)))28}29export default {30 setLocal,31 removeLocal,32 getLocal,33 setSession,34 removeSession,35 getSession...
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.click('text=Get started');7 await page.waitForTimeout(1000);
Using AI Code Generation
1const { Playwright } = require('playwright-core/lib/server/playwright');2const { Internal } = require('playwright-core/lib/server/internal');3const { Browser } = require('playwright-core/lib/server/browser');4const { Page } = require('playwright-core/lib/server/page');5const { ElementHandle } = require('playwright-core/lib/server/elementHandler');6const playwright = new Playwright();7const internal = new Internal(playwright);8const browser = new Browser(internal, 'chromium', 'chromium', null, null);9const page = new Page(browser, null, 'page', null, null);10const elementHandle = new ElementHandle(page, null, 'elementHandle', null);11const key = 'a';12const options = { text: 'b' };13elementHandle.processKey(key, options);14const { Playwright } = require('playwright-core/lib/server/playwright');15const { Internal } = require('playwright-core/lib/server/internal');16const { Browser } = require('playwright-core/lib/server/browser');17const { Page } = require('playwright-core/lib/server/page');18const { ElementHandle } = require('playwright-core/lib/server/elementHandler');19const playwright = new Playwright();20const internal = new Internal(playwright);21const browser = new Browser(internal, 'chromium', 'chromium', null, null);22const page = new Page(browser, null, 'page', null, null);23const elementHandle = new ElementHandle(page, null, 'elementHandle', null);24const key = 'a';25const options = { text: 'b' };26elementHandle.processKey(key, options);27const { Playwright } = require('playwright-core/lib/server/playwright');28const { Internal } = require('playwright-core/lib/server/internal');29const { Browser } = require('playwright-core/lib/server/browser');30const { Page } = require('playwright-core/lib/server/page');31const { ElementHandle } = require('playwright-core/lib/server/elementHandler');32const playwright = new Playwright();33const internal = new Internal(playwright);34const browser = new Browser(internal,
Using AI Code Generation
1const { Keyboard } = require('playwright');2const keyboard = new Keyboard();3keyboard.processKey('a', 'keydown');4const { Keyboard } = require('playwright');5const keyboard = new Keyboard();6keyboard.processKey('a', 'keydown');7const { Keyboard } = require('playwright');8const keyboard = new Keyboard();9keyboard.processKey('a', 'keydown');10const { Keyboard } = require('playwright');11const keyboard = new Keyboard();12keyboard.processKey('a', 'keydown');13const { Keyboard } = require('playwright');14const keyboard = new Keyboard();15keyboard.processKey('a', 'keydown');16const { Keyboard } = require('playwright');17const keyboard = new Keyboard();18keyboard.processKey('a', 'keydown');19const { Keyboard } = require('playwright');20const keyboard = new Keyboard();21keyboard.processKey('a', 'keydown');22const { Keyboard } = require('playwright');23const keyboard = new Keyboard();24keyboard.processKey('a', 'keydown');25const { Keyboard } = require('playwright');26const keyboard = new Keyboard();27keyboard.processKey('a', 'keydown');28const { Keyboard } = require('playwright');29const keyboard = new Keyboard();30keyboard.processKey('a', 'keydown');31const { Keyboard } = require('playwright');32const keyboard = new Keyboard();33keyboard.processKey('a', 'keydown');
Using AI Code Generation
1const { processKey } = require('playwright/lib/server/chromium/crInput');2const { KeyInput } = require('playwright/lib/server/common/input');3const keyInput = new KeyInput();4const key = 'a';5const text = 'a';6const code = 'KeyA';7const keydown = true;8const modifiers = 0;9const location = 0;10const autoRepeat = false;11const shiftKey = false;12const ctrlKey = false;13const altKey = false;14const metaKey = false;15const isKeypad = false;16const isSystemKey = false;17const defaultPrevented = false;18const result = processKey(key, text, code, keydown, modifiers, location, autoRepeat, shiftKey, ctrlKey, altKey, metaKey, isKeypad, isSystemKey, defaultPrevented);19console.log(result);20const { processKey } = require('playwright/lib/server/chromium/crInput');21const { KeyInput } = require('playwright/lib/server/common/input');22const keyInput = new KeyInput();23const key = 'a';24const text = 'a';25const code = 'KeyA';26const keydown = true;27const modifiers = 0;28const location = 0;29const autoRepeat = false;30const shiftKey = false;31const ctrlKey = false;32const altKey = false;33const metaKey = false;34const isKeypad = false;35const isSystemKey = false;36const defaultPrevented = false;37const result = processKey(key, text, code, keydown, modifiers, location, autoRepeat, shiftKey, ctrlKey, altKey, metaKey, isKeypad, isSystemKey, defaultPrevented);38console.log(result);39const { processKey } = require('playwright/lib/server/chromium/crInput');40const { KeyInput } = require('playwright/lib/server/common/input');41const keyInput = new KeyInput();42const key = 'a';43const text = 'a';44const code = 'KeyA';45const keydown = true;46const modifiers = 0;47const location = 0;48const autoRepeat = false;49const shiftKey = false;50const ctrlKey = false;51const altKey = false;
Using AI Code Generation
1const { processKey } = require('playwright/lib/server/webkit/wkBrowser');2const key = 'Tab';3const modifiers = 0;4const text = '';5const unmodifiedText = '';6const keydownDefaultPrevented = false;7const keyCode = 9;8const code = 'Tab';9const location = 0;10const isKeypad = false;11const autoRepeat = false;12const isComposing = false;13const windowsVirtualKeyCode = 9;14const nativeVirtualKeyCode = 9;15const macCharCode = 9;16const autoRepeat = false;17const isKeypad = false;18const type = 'keydown';19const shiftKey = false;20const ctrlKey = false;21const altKey = false;22const metaKey = false;23const timestamp = 0;24const isAutoRepeat = false;25const key = 'Tab';26const modifiers = 0;27const text = '';28const unmodifiedText = '';29const keydownDefaultPrevented = false;30const keyCode = 9;31const code = 'Tab';32const location = 0;33const isKeypad = false;34const autoRepeat = false;35const isComposing = false;36const windowsVirtualKeyCode = 9;37const nativeVirtualKeyCode = 9;38const macCharCode = 9;39const autoRepeat = false;40const isKeypad = false;41const type = 'keydown';42const shiftKey = false;43const ctrlKey = false;44const altKey = false;45const metaKey = false;46const timestamp = 0;47const isAutoRepeat = false;48const key = 'Tab';49const modifiers = 0;50const text = '';51const unmodifiedText = '';52const keydownDefaultPrevented = false;53const keyCode = 9;54const code = 'Tab';55const location = 0;56const isKeypad = false;57const autoRepeat = false;58const isComposing = false;59const windowsVirtualKeyCode = 9;60const nativeVirtualKeyCode = 9;61const macCharCode = 9;62const autoRepeat = false;63const isKeypad = false;64const type = 'keydown';65const shiftKey = false;66const ctrlKey = false;67const altKey = false;68const metaKey = false;69const timestamp = 0;70const isAutoRepeat = false;71const key = 'Tab';72const modifiers = 0;73const text = '';74const unmodifiedText = '';75const keydownDefaultPrevented = false;
Using AI Code Generation
1const {processKey} = require('playwright/lib/server/input');2const {createHash} = require('crypto');3const {createServer} = require('http');4const server = createServer((req, res) => {5 const key = req.url.slice(1);6 const text = String.fromCharCode(parseInt(key, 16));7 const hash = createHash('sha1').update(text).digest('hex');8 console.log(`key: ${key}, text: ${text}, hash: ${hash}`);9 processKey(hash, text);10 res.end();11});12server.listen(0, () => {13 const port = server.address().port;14 console.log(`Listening on port ${port}`);15});16 const input = document.getElementById('input');17 input.addEventListener('keydown', (event) => {18 });
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!