{"action":"created","issue":{"url":"https://api.github.com/repos/lucabaldini/xpedaq/issues/11","repository_url":"https://api.github.com/repos/lucabaldini/xpedaq","labels_url":"https://api.github.com/repos/lucabaldini/xpedaq/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/lucabaldini/xpedaq/issues/11/comments","events_url":"https://api.github.com/repos/lucabaldini/xpedaq/issues/11/events","html_url":"https://github.com/lucabaldini/xpedaq/issues/11","id":148669478,"number":11,"title":"Develop an application read/display the pedestals","user":{"login":"lucabaldini","id":8972541,"avatar_url":"https://avatars.githubusercontent.com/u/8972541?v=3","gravatar_id":"","url":"https://api.github.com/users/lucabaldini","html_url":"https://github.com/lucabaldini","followers_url":"https://api.github.com/users/lucabaldini/followers","following_url":"https://api.github.com/users/lucabaldini/following{/other_user}","gists_url":"https://api.github.com/users/lucabaldini/gists{/gist_id}","starred_url":"https://api.github.com/users/lucabaldini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucabaldini/subscriptions","organizations_url":"https://api.github.com/users/lucabaldini/orgs","repos_url":"https://api.github.com/users/lucabaldini/repos","events_url":"https://api.github.com/users/lucabaldini/events{/privacy}","received_events_url":"https://api.github.com/users/lucabaldini/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-15T14:03:07Z","updated_at":"2016-05-12T19:15:03Z","closed_at":null,"body":"We discussed this a little bit and concurred that:\r\n- this would be separate from the main DAQ program\r\n- it would support the pedestal acquisition both through a single cluster (flight mode) and with the 8 clusters in parallel\r\n- it would provide some minimal stat/visualization capability.\r\n\r\nWe still need to settle on what we would use for the visualization, as Qt does not provide anything out of the box."},"comment":{"url":"https://api.github.com/repos/lucabaldini/xpedaq/issues/comments/218857418","html_url":"https://github.com/lucabaldini/xpedaq/issues/11#issuecomment-218857418","issue_url":"https://api.github.com/repos/lucabaldini/xpedaq/issues/11","id":218857418,"user":{"login":"albertomanfreda","id":7805566,"avatar_url":"https://avatars.githubusercontent.com/u/7805566?v=3","gravatar_id":"","url":"https://api.github.com/users/albertomanfreda","html_url":"https://github.com/albertomanfreda","followers_url":"https://api.github.com/users/albertomanfreda/followers","following_url":"https://api.github.com/users/albertomanfreda/following{/other_user}","gists_url":"https://api.github.com/users/albertomanfreda/gists{/gist_id}","starred_url":"https://api.github.com/users/albertomanfreda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/albertomanfreda/subscriptions","organizations_url":"https://api.github.com/users/albertomanfreda/orgs","repos_url":"https://api.github.com/users/albertomanfreda/repos","events_url":"https://api.github.com/users/albertomanfreda/events{/privacy}","received_events_url":"https://api.github.com/users/albertomanfreda/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T19:15:03Z","updated_at":"2016-05-12T19:15:03Z","body":"We need a thread-safe way to pass the pDataBlock objects to the pedestal application as soon they are created in pDataCollector::run().\r\nThere is a nice example of something similar in the Qt documentation:\r\nhttp://doc.qt.io/qt-4.8/qt-threads-mandelbrot-example.html\r\n\r\nand judging by this example the best thing you can do is probably to simply 'emit' the pDataBlock (whether if by value or by const reference I am still not sure) in a signal like this:\r\n\r\nemit dataBlockRead(pDataBlock dataBlock)\r\n\r\nthat will be asynchronously received by the main application. We need to use a [QMutex](http://doc.qt.io/qt-4.8/qmutex.html) to ensure that this operation is thread safe.\r\nSince this is a **queued connection** (because it happens between different threads) the pDataBlock object will be implicitly copied by Qt, no matter how we pass it (see [this](http://stackoverflow.com/questions/18717816/does-emit-copy-its-arguments) discussion on stackoverflow) ). So we need to ensure that the copy of the pDataBlock object is made in the right way, i.e. that Qt knows how to copy a pDataObject correctly.\r\n\r\nWe can do that by using the Qt function qRegisterMetaType which (as stated [here](http://doc.qt.io/qt-4.8/qmetatype.html#qRegisterMetaType) ) works for 'any class or struct that has a public default constructor, a public copy constructor and a public destructor'. The conseqeunce is that the pDataBlock class must have them all.\r\n\r\n[Here](http://www.embeddeduse.com/2013/06/29/copied-or-not-copied-arguments-signals-slots/) is an interesting lesson about what happens behind the stage when arguments are passed by signal-slot connections."}}