2727
2828from domain import Domain , scan_domains , ResourceNotFound
2929
30+ from ossie .cf import CF
3031from ossie .properties import __TYPE_MAP as TYPE_MAP
3132from ossie .properties import props_from_dict , props_to_dict
3233
3334from tornado .websocket import WebSocketClosedError
34- from tornado import ioloop
35+ from tornado import ioloop , log
3536
3637import collections
3738
@@ -192,30 +193,15 @@ def release_application(self, domain_name, app_id):
192193 @background_task
193194 def application_configure (self , domain_name , app_id , new_properties ):
194195 app = self ._get_application (domain_name , app_id )
195- props = Redhawk ._application_externalProps (app )
196-
196+ props = app ._getPropertySet ()
197197 changes = Redhawk ._get_prop_changes (props , new_properties )
198198 return app .configure (changes )
199199
200- '''
201- Helper function to streamline getting a property list similar to what one
202- gets from components, devices, etc.
203- '''
204- @staticmethod
205- def _application_externalProps (app ):
206- props = []
207- for epid , t in app ._externalProps .iteritems ():
208- pid = t [0 ] # First item is the property id relative to the component
209- cid = t [1 ] # Second item in tuple is prefix of component identifier
210- for comp in app .comps :
211- if comp .identifier .startswith (cid ):
212- for prop in comp ._properties :
213- if prop .id == pid :
214- props .append (prop )
215- return props
216-
217200 ##############################
218201 # COMMON PROPERTIES
202+ '''
203+ Cleans out IDs being unicode, etc. since CF can't handle unicode strings.
204+ '''
219205 @staticmethod
220206 def _clean_property (property ):
221207 if isinstance (property , basestring ):
@@ -231,16 +217,22 @@ def _clean_property(property):
231217 # CF.Properties and dict() of { 'id': value, ... }
232218 # Use force to treat all ID matches as required changes
233219 def _get_prop_changes (current_props , new_properties , force = False ):
234- changes = {}
220+ changes = []
235221 for prop in current_props :
236222 if prop .id in new_properties :
237223 if new_properties [prop .id ] != prop .queryValue () or force :
238- changes [str (prop .id )] = prop .fromAny (
239- prop .toAny (
240- Redhawk ._clean_property (new_properties [prop .id ])
224+ changes .append (
225+ CF .DataType (
226+ prop .id ,
227+ prop .toAny (
228+ Redhawk ._clean_property (new_properties [prop .id ])
229+ )
241230 )
242231 )
243- return props_from_dict (changes )
232+ log .app_log .debug ('Current properties: {}' .format (current_props ))
233+ log .app_log .debug ('New properties: {}' .format (new_properties ))
234+ log .app_log .debug ('Changes: {}' .format (changes ))
235+ return changes
244236
245237 ##############################
246238 # COMPONENT
0 commit comments