configure_file(${CMAKE_CURRENT_SOURCE_DIR}/exampleplugins.README.txt ${CMAKE_CURRENT_BINARY_DIR}/exampleplugins.README @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/examplesource.in.json ${CMAKE_CURRENT_BINARY_DIR}/examplesource @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/examplesink.in.json ${CMAKE_CURRENT_BINARY_DIR}/examplesink @ONLY)
+
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/exampleplugins.README DESTINATION ${DOC_INSTALL_DIR}/plugins)
+install (FILES ${CMAKE_CURRENT_BINARY_DIR}/examplesource DESTINATION ${PLUGIN_SEGMENT_INSTALL_PATH})
+install (FILES ${CMAKE_CURRENT_BINARY_DIR}/examplesink DESTINATION ${PLUGIN_SEGMENT_INSTALL_PATH})
add_subdirectory(common)
set(dbus_mapping_headers ${dbus_mapping_headers} ${CMAKE_CURRENT_SOURCE_DIR}/drivingsafety.h CACHE INTERNAL "dbus mapping headers")
set(dbus_mapping_headers ${dbus_mapping_headers} ${CMAKE_CURRENT_SOURCE_DIR}/personalization.h CACHE INTERNAL "dbus mapping headers")
-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/README ${CMAKE_CURRENT_BINARY_DIR}/dbus.README @ONLY)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/dbus.README DESTINATION ${DOC_INSTALL_DIR}/plugins)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dbus.in.json ${CMAKE_CURRENT_BINARY_DIR}/dbus @ONLY)
+install (FILES ${CMAKE_CURRENT_BINARY_DIR}/dbus DESTINATION ${PLUGIN_SEGMENT_INSTALL_PATH})
+
add_subdirectory(amb-qt)
self.commands.append(Autocomplete.Cmd('listen', 'Listen for changes on an ObjectName'))
self.commands.append(Autocomplete.Cmd('set', 'Set a property for an ObjectName'))
self.commands.append(Autocomplete.Cmd('getHistory', 'Get logged data within a time range'))
+ self.commands.append(Autocomplete.Cmd('enablePlugin', 'Get logged data within a time range'))
self.commands.append(Autocomplete.Cmd('quit', 'Exit ambctl'))
bus = dbus.SystemBus()
def changed(interface, properties, invalidated):
print json.dumps(properties, indent=2)
+def listPlugins():
+ list = {}
+ for root, dirs, files in os.walk('@PLUGIN_SEGMENT_INSTALL_PATH@'):
+ for file in files:
+ fullpath = root + "/" + file;
+ pluginFile = open(fullpath)
+ data = json.load(pluginFile)
+ pluginFile.close()
+ list.update({data["name"]:fullpath})
+
+ return list
+
+def enablePlugin(pluginName, enabled):
+ list = listPlugins()
+ if pluginName not in list:
+ return false
+
+ path = list[pluginName]
+ try :
+ file = open(path, 'rw+')
+ data = json.load(file)
+ data["enabled"] = enabled;
+ fixedData = json.JSONEncoder().encode(data)
+ file.truncate(0)
+ file.write(fixedData)
+ file.close()
+ except IOError, error:
+ print error
+ except:
+ print "Unknown error"
+
+
def processCommand(command, commandArgs, noMain=True):
if command == 'help':
object = managerInterface.FindObjectForZone(objectName, zone);
propertiesInterface = dbus.Interface(bus.get_object("org.automotive.message.broker", object),"org.automotive."+objectName)
print json.dumps(propertiesInterface.GetHistory(start, end), indent=2)
+ elif command == "enablePlugin":
+ if len(commandArgs) == 0:
+ commandArgs = ['help']
+ if commandArgs[0] == 'help':
+ print "[list] [pluginName] [on/off]"
+ return 1
+ elif commandArgs[0] == 'list':
+ for name, path in listPlugins():
+ print name
+ return 1
+ else:
+ if len(commandArgs) < 2:
+ return 1
+ enablePlugin(commandArgs[0], commandArgs[1] == "on")
+ return 1
+
else:
print "Invalid command"
return 1
row = ""
endRow = -1
if len(results) >= i+3:
- endRow = 3
- print "endRow: ", endRow
+ endRow = 2
for col in results[i : endRow]:
row += col
for i in range((longestLen + 5) - len(col)):