Manser
March 26th, 2009, 12:48 AM
I set up a serial device for a bose dsp!
I poll all slots and channels of the bose.
this works great. Poll interval is 30ms, parser timeout is 20ms, noResponseTimout 25ms.
I stop polling when I send commands from girder.
All this works great. But it fills me up the queue with commands which is possible.
the problem now is that if once the queue is full it just stop sending any commands.
Log looks then:
OnQueueFull: 100
OnQueueFull: 100
OnQueueFull: 100
OnQueueFull: 100
How can I manage that:
OnQueueFull = function(self)
self.Transport:ClearQueue()
print("Reset durch Bose ESP88")
gir.TriggerEventEx("Reset", 18, 0, 0)
end,
ClearQueue() does not help, all I can do is a script reset!
But there must be a better way to handle this!!!
-[[
Bose ESP88
--]]
local Super = require('transport.Base')
local prepare = require('transport.PrepareSettings')
local constants = require('transport.constants')
local table = require('table')
local print = print
local math = require('math')
local gir = require("gir")
local string = string
module("transport.devices.BoseESP88")
local DefaultSettings = prepare(
{
Transport = {
Post = {
NoResponseTimeout = 25,
},
},
Parser = {
Type = constants.parser.TERMINATED,
Terminator = '\r',
Timeout = 20,
},
MaxQueuedItems = 100,
},
{
Transport = {
Post = {
Baud = 38400,
Flow = 'N',
Parity = 'N',
DataBits = 8,
StopBits = 1,
},
},
}
)
local Object = Super:Subclass ( {
Name = 'Bose ESP88',
Description = [[<b>Bose ESP88</b><br>
<color=#444444>Bose Serial Driver by Manser Bild- und Tonkonzepte GmbH </color>]],
GUIDefaults = {
allowedtransports = {
[constants.transport.GIP] = false,
[constants.transport.SERIAL] = true,
},
defaulttransport = constants.transport.GIP,
hostname = "192.168.1.70",
port = 4998,
},
GetSettings = function ( self )
return table.copy(DefaultSettings[self.TransportType])
end,
--GetConsoleLogLevel = function(self)
-- return 0 -- temporary 0 = alles
--end,
OnQueueFull = function(self)
self.Transport:ClearQueue()
print("Reset durch Bose ESP88")
gir.TriggerEventEx("Reset", 18, 0, 0)
end,
OnDisconnected = function(self)
end,
OnConnectFailed = function ( self )
print(self.Name .. ": Connect Failed")
end,
OnBuildCommand = function (self, data )
return data ..'\r'
end,
OnReceiveData = function(self, Event)
--print(self.Name .. " Received: " .. Event:GetData())
local empfang = Event:GetData()
if string.sub(empfang,1,2) == "GM" then
gir.TriggerEventEx("Mute_Daten", 18, 0, Event:GetData())
end
if string.sub(empfang,1,2) == "GV" then
gir.TriggerEventEx("Vol_Daten", 18, 0, Event:GetData())
end
if string.sub(empfang,1,2) == "GL" then
gir.TriggerEventEx("Sig_Daten", 18, 0, Event:GetData())
end
if string.sub(empfang,1,2) == "GN" then
gir.TriggerEventEx("Mute_Group_Daten", 18, 0, Event:GetData())
end
if string.sub(empfang,1,2) == "GG" then
gir.TriggerEventEx("Vol_Group_Daten", 18, 0, Event:GetData())
end
end,
} )
Name = Object.Name
Description = Object.Description
GUIDefaults = Object.GUIDefaults
function New (self,settings)
return Object:New(settings)
end
The solution could probably be just not to queue any command - But How?
I poll all slots and channels of the bose.
this works great. Poll interval is 30ms, parser timeout is 20ms, noResponseTimout 25ms.
I stop polling when I send commands from girder.
All this works great. But it fills me up the queue with commands which is possible.
the problem now is that if once the queue is full it just stop sending any commands.
Log looks then:
OnQueueFull: 100
OnQueueFull: 100
OnQueueFull: 100
OnQueueFull: 100
How can I manage that:
OnQueueFull = function(self)
self.Transport:ClearQueue()
print("Reset durch Bose ESP88")
gir.TriggerEventEx("Reset", 18, 0, 0)
end,
ClearQueue() does not help, all I can do is a script reset!
But there must be a better way to handle this!!!
-[[
Bose ESP88
--]]
local Super = require('transport.Base')
local prepare = require('transport.PrepareSettings')
local constants = require('transport.constants')
local table = require('table')
local print = print
local math = require('math')
local gir = require("gir")
local string = string
module("transport.devices.BoseESP88")
local DefaultSettings = prepare(
{
Transport = {
Post = {
NoResponseTimeout = 25,
},
},
Parser = {
Type = constants.parser.TERMINATED,
Terminator = '\r',
Timeout = 20,
},
MaxQueuedItems = 100,
},
{
Transport = {
Post = {
Baud = 38400,
Flow = 'N',
Parity = 'N',
DataBits = 8,
StopBits = 1,
},
},
}
)
local Object = Super:Subclass ( {
Name = 'Bose ESP88',
Description = [[<b>Bose ESP88</b><br>
<color=#444444>Bose Serial Driver by Manser Bild- und Tonkonzepte GmbH </color>]],
GUIDefaults = {
allowedtransports = {
[constants.transport.GIP] = false,
[constants.transport.SERIAL] = true,
},
defaulttransport = constants.transport.GIP,
hostname = "192.168.1.70",
port = 4998,
},
GetSettings = function ( self )
return table.copy(DefaultSettings[self.TransportType])
end,
--GetConsoleLogLevel = function(self)
-- return 0 -- temporary 0 = alles
--end,
OnQueueFull = function(self)
self.Transport:ClearQueue()
print("Reset durch Bose ESP88")
gir.TriggerEventEx("Reset", 18, 0, 0)
end,
OnDisconnected = function(self)
end,
OnConnectFailed = function ( self )
print(self.Name .. ": Connect Failed")
end,
OnBuildCommand = function (self, data )
return data ..'\r'
end,
OnReceiveData = function(self, Event)
--print(self.Name .. " Received: " .. Event:GetData())
local empfang = Event:GetData()
if string.sub(empfang,1,2) == "GM" then
gir.TriggerEventEx("Mute_Daten", 18, 0, Event:GetData())
end
if string.sub(empfang,1,2) == "GV" then
gir.TriggerEventEx("Vol_Daten", 18, 0, Event:GetData())
end
if string.sub(empfang,1,2) == "GL" then
gir.TriggerEventEx("Sig_Daten", 18, 0, Event:GetData())
end
if string.sub(empfang,1,2) == "GN" then
gir.TriggerEventEx("Mute_Group_Daten", 18, 0, Event:GetData())
end
if string.sub(empfang,1,2) == "GG" then
gir.TriggerEventEx("Vol_Group_Daten", 18, 0, Event:GetData())
end
end,
} )
Name = Object.Name
Description = Object.Description
GUIDefaults = Object.GUIDefaults
function New (self,settings)
return Object:New(settings)
end
The solution could probably be just not to queue any command - But How?