Repetier Module - Response Handling

Hi, I was able to create a module that added a page and button to printer menu. I am able to call registered action and send a gcode command to printer. I am able to capture response on client but very stupid way. I registered response handler where i am testing for printer and response I am interested in. When there is a match I set a global variable. Using another registered action method I check this global variable and if it is set i return result. I am sure there is a better way how to achieve this. (just publish to RSCom on server and subscribe in angular controller somehow?). Thank you for any help/piece of code. Tom 

Comments

  • $rootScope.$on("log",  ?
  • Yes in deed. In printer configuration you can define your own events. Printer Settings->G-Codes->Response to Event. You can even define a group in the regular expression to get the content as value along with the triggering line. 

    Also inside a controller better use $scope.$on instead. If you bind to $rootScope you must unbind in destroy event or you will end up with multiple listeners!
Sign In or Register to comment.