Skip to content

Commit

Permalink
Merge pull request #1225 from lamassu/release-10.0.5
Browse files Browse the repository at this point in the history
Release 10.0.5
  • Loading branch information
RafaelTaranto authored Nov 18, 2024
2 parents 2e523bf + 45f6280 commit 4d6626f
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 26 deletions.
26 changes: 17 additions & 9 deletions deploy/codebase/lamassu-machine-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,23 @@ function updateSupervisor (cb) {
const osuser = getOSUser()
const services = getServices()

async.series([
const commands = [
async.apply(command, `cp ${supervisorPath}/* /etc/supervisor/conf.d/`),
async.apply(command, `sed -i 's|^user=.*\$|user=${osuser}|;' /etc/supervisor/conf.d/lamassu-browser.conf || true`),
async.apply(command, `supervisorctl update ${services}`),
async.apply(command, `supervisorctl restart ${services}`),
], err => {
async.apply(command, `sed -i 's|^user=.*\$|user=${osuser}|;' /etc/supervisor/conf.d/lamassu-browser.conf || true`)
]

commands.push(async.apply(command, `supervisorctl update ${services}`))
commands.push(async.apply(command, `supervisorctl stop ${services}`))

if (machineCode == 'aveiro') {
LOG("Updating GSR50")
commands.push(async.apply(command, `cp ${applicationParentFolder}/lamassu-machine/lib/gsr50/binaries/* /opt/FujitsuGSR50/`))
commands.push(async.apply(command, `chmod +x /opt/FujitsuGSR50/FujitsuGSR50`))
}

commands.push(async.apply(command, `supervisorctl restart ${services}`))

async.series(commands, err => {
if (err) throw err;
cb()
})
Expand Down Expand Up @@ -182,10 +193,7 @@ function installDeviceConfig (cb) {
newDeviceConfig.billDispenser.cassettes = currentDeviceConfig.billDispenser.cassettes
}
if (currentDeviceConfig.billValidator) {
newDeviceConfig.billValidator.deviceType = currentDeviceConfig.billValidator.deviceType
if (currentDeviceConfig.billValidator.rs232) {
newDeviceConfig.billValidator.rs232.device = currentDeviceConfig.billValidator.rs232.device
}
newDeviceConfig.billValidator = currentDeviceConfig.billValidator
}
if (currentDeviceConfig.kioskPrinter) {
newDeviceConfig.kioskPrinter.model = currentDeviceConfig.kioskPrinter.model
Expand Down
1 change: 1 addition & 0 deletions lib/brain.js
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,7 @@ Brain.prototype.initValidator = function initValidator () {
console.log('Bill validator connected.')
},
{
numberOfCashboxes: this.rootConfig.billValidator.cashboxes ?? 1,
cassettes: this.trader.cassettes,
recyclers: this.trader.recyclers,
}
Expand Down
Binary file added lib/gsr50/binaries/FujitsuGSR50
Binary file not shown.
Binary file added lib/gsr50/binaries/FujitsuGSR50.dll
Binary file not shown.
35 changes: 21 additions & 14 deletions lib/gsr50/gsr50.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,11 @@ Gsr50.prototype.processUnitEvent = function processUnitEvent(data) {
}
}

Gsr50.prototype.run = function run (cb, { cassettes, recyclers }) {
Gsr50.prototype.run = function run (cb, { numberOfCashboxes, cassettes, recyclers }) {
const self = this

this.wss = new WebSocketServer({ port: 9001, host: 'localhost' })
this.numberOfCashboxes = numberOfCashboxes

this.wss.on('connection', function (ws) {
self.ws = ws
Expand Down Expand Up @@ -284,17 +285,23 @@ Gsr50.prototype.getDeviceCashUnits = function getDeviceCashUnits () {
Gsr50.prototype.setDeviceCashUnits = function setDeviceCashUnits (cassettes, recyclers) {
return this.getDeviceCashUnits()
.then(res => {
let units = {
cashbox: {
Number: 8,
Mode: CASH_UNIT_MODES.CashIn,
Position: CASH_UNIT_POSITIONS.cashbox1,
Currency: {
CurrencyCode: this.fiatCode
}
}
}

let units = _.reduce(
(acc, value) => {
return Object.assign(acc, {
// cashbox1 is not being used in the c# code, keeping for compatibility
[value === 0 ? 'cashbox' : `cashbox${value + 1}`]: {
Mode: CASH_UNIT_MODES.CashIn,
Position: CASH_UNIT_POSITIONS.cashbox1 + value,
Currency: {
CurrencyCode: this.fiatCode
}
}
})
},
{},
_.range(0, this.numberOfCashboxes)
)

if (cassettes) {
units = _.reduce(
(acc, value) => {
Expand All @@ -315,8 +322,8 @@ Gsr50.prototype.setDeviceCashUnits = function setDeviceCashUnits (cassettes, rec
_.range(0, _.size(cassettes))
)
}
if (recyclers) {

if (recyclers) {
units = _.reduce(
(acc, value) => {
const realName = RECYCLER_NAMES[value.name]
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lamassu-machine",
"license": "./LICENSE",
"version": "10.0.4",
"version": "10.0.5",
"dependencies": {
"@apollo/client": "3.11.8",
"@haensl/subset-sum": "^3.0.5",
Expand Down

0 comments on commit 4d6626f

Please sign in to comment.