User Tools

Site Tools


misc:virtual2

Virtually Run the OS (without the car connected)

From a post:

I've succeed to run the infotainment system frontend without the need to be connected to the car This might be useful if someone wants to add / develop additional apps to the system. Here are the steps:

  1. extract e0000000001.dat.gz
  2. rename e0000000001.dat to rootfs.tar.gz
  3. extract ./jci/gui folder from rootfs.tar.gz
  4. configure/start a web server with root dir pointed to above extracted folder
  5. edit [guidir]/index.html file, and change:
    <script src="../../data/integration/developer_mode_GuiConfig.js" type="text/javascript"></script> 

    to:

    <script src="common/js/developer_mode_GuiConfig.js" type="text/javascript"></script> 
  6. edit [guidir]/common/js/GuiConfig.js and set following flags on true:
    this.debugMode = true;
    this.debugPanelEnabled = true; 
    this.screenNameLabelEnabled = true; 
    this.pcLogging = true;
  7. create test folder in: [guidir]/framework/test, and copy DebugTest.js to that folder
  8. for logging to be full verbose you can edit in [guidir]/framework/js/Log.js file the line:
     var permisLevel = this._logLevels[source];

    and change to:

    var permisLevel = this._DEBUG 

    in the Log.prototype._log function… Log output will be to the console (console tab in Opera inspect element)

  9. you can change the timeout from _getStartupSettings ([guidir]/framework/GuiFramework.js) function from a value of 20000 to 200 for the Home screen to load more quickly
  10. start Opera browser (version 12.17 worked for me) and navigate to localhost:webserverport

Using other browsers

Framework checks browser version, and expect it to be Opera newer that 12.10, although there might be problems running with modern version like 38.0. To make this running on any browser you need two fixes:

  1. Simulate browser version adding to the beginning of 'common/js/developer_mode_GuiConfig.js' file:
    window.opera = { version: function() { return 12.10 }}
  2. Fix menu highlight handler modifing _setHighlight function in file apps/system/controls/MainMenu/js/MainMenuCtrl.js, change line:
    this._fullyHighlightedIndex = null

    to

    this._fullyHighlightedIndex = index;

DebugTest.js

DebugTest.js intercepts comunication messages with MMUI and responds to them with appropriate messages. Currently the implemtation of DebugTest.js is minimal, but can be extended.

(Note that what it works are only some menus that I've implemented callbacks for in DebugTest.js file. (which is not much) You can try to add some more by inspecting the messages shown when connected to the car)

Here is the code for DebugTest.js

// implements external messages sent to GUI framework

function DebugTest()
{
	// init callback which will be called in debug mode simulating MMUI event
    framework.debug.setEvtToMmuiCallback("common", DebugTest.MmuiCallback);
    this.SendCarSettings();
}

DebugTest.prototype.SendCarSettings = function()
{
	framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"vehsettings","msgId":"IgnitionStatus","params":{"payload":{"evData":1}}} ));
	framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"vehsettings","msgId":"CanStatus","params":{"payload":{"evData":1}}} ));
	framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"vehsettings","msgId":"AutoDoorLockAT_Installed","params":{"payload":{"evData":0}}} ));
	framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"vehsettings","msgId":"AutoDoorLockMT_Installed","params":{"payload":{"evData":1}}} ));					
	framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"vehsettings","msgId":"AutoDoorRelock_Installed","params":{"payload":{"evData":1}}} ));
	framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"vehsettings","msgId":"ThreeFlash_Installed","params":{"payload":{"evData":1}}} ));
	framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"vehsettings","msgId":"AutoWiper_Installed","params":{"payload":{"evData":1}}} ));
	framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"vehsettings","msgId":"WalkAway_Installed","params":{"payload":{"evData":0}}} ));
	framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"vehsettings","msgId":"UnlockMode_Installed","params":{"payload":{"evData":0}}} ));
	//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"vehsettings","msgId":"GetKeylessLockBeepVol","params":{"payload":{"evData":3}}} ));
}

// when sending a message to MMUI this function will be called
// Here you can send a fake message back to GUI framework
DebugTest.MmuiCallback = function(uiaId, eventId, params)
{
	log.debug("TO MMUI MESSAGE: uiaId:" + uiaId + ", eventId:" + eventId + ", params:" + params);
	var msg_type = "";
	var app_id = "";
	var event_id = "";
	var params_obj = null;

	switch (eventId)
	{
		case "Global.InitGui":
		case "Global.IntentHome":
			framework.debug.fakeCtxtChgMsgs("system", "HomeScreen");
			break;
		case "Global.GoBack":
			framework.debug.goBackOnFakeGoBackStack();
			break;
		case "SelectApplications":
			framework.debug.fakeCtxtChgMsgs("system", "Applications");
			break;
		case "SelectEntertainment":
			framework.debug.fakeCtxtChgMsgs("system", "Entertainment");
			break;
		case "SelectCommunication":
			framework.debug.fakeCtxtChgMsgs("system", "Communication");
			break;
		case "SelectNavigation":
			framework.debug.fakeCtxtChgMsgs("system", "Navigation");
			break;
		case "SelectSettings":
			framework.debug.fakeCtxtChgMsgs("system", "Settings");
			framework.debug.fakeCtxtChgMsgs("syssettings","DisplayTab");
			//this.SendCarSettings();
			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"vehsettings","msgId":"IgnitionStatus","params":{"payload":{"evData":1}}} ));
			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"vehsettings","msgId":"CanStatus","params":{"payload":{"evData":1}}} ));
			break;
		case "Global.IntentSettingsTab":
			switch (params.payload.settingsTab)
			{
				case "HUD":
					//not implemented in debug mode iet
					//framework.debug.fakeCtxtChgMsgs("syssettings","HUDTab");
					break;
				case "Display":
					framework.debug.fakeCtxtChgMsgs("syssettings","DisplayTab");
					break;
				case "Safety":
					framework.debug.fakeCtxtChgMsgs("vehsettings","SafetyTab");
					break;
				case "Sound":
					framework.debug.fakeCtxtChgMsgs("audiosettings","SoundTab");
					break;
				case "Clock":
					framework.debug.fakeCtxtChgMsgs("syssettings","ClockTab");
					break;
				case "Vehicle":
					framework.debug.fakeCtxtChgMsgs("vehsettings","VehicleSettingsTab");
			
					break;
				case "Devices":
					framework.debug.fakeCtxtChgMsgs("syssettings","DevicesTab");
					break;
				case "System":
					framework.debug.fakeCtxtChgMsgs("syssettings","SystemTab");
					break;
			}
			break;
		case "GoDoorLock":
			framework.debug.fakeCtxtChgMsgs("vehsettings","DoorLock");
			break;
		case "GoUnlockMode":
			framework.debug.fakeCtxtChgMsgs("vehsettings","UnlockMode");
		case "GoDoorLockMode":
			framework.debug.fakeCtxtChgMsgs("vehsettings","DoorLockMode");

	}
	return true;
}




			//framework.debug.sendMmuiMsg(JSON.stringify());

			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"transition","enabled":true}));
			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"ctxtChg","uiaId":"syssettings","ctxtId":"DevicesTab","contextSeq":73,"params":{}} ));
			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"ctxtChg","uiaId":"vehsettings","ctxtId":"VehicleSettingsTab","contextSeq":74,"params":{}} ));
			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"focusStack","appIdList":[{"id":"netmgmt"},{"id":"syssettings"},{"id":"vehsettings"},{"id":"audiosettings"},{"id":"system"}]} ));
			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"focusStack","appIdList":[{"id":"syssettings"},{"id":"vehsettings"},{"id":"system"}]} ));
			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"transition","enabled":false} ));

			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"system","msgId":"StatusUpdateAudioSource","params":{"payload":{"statusAudio":{"audioSource":"TV","audioActive":"Off"}}}} ));
			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"transition","enabled":true} ));
			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"ctxtChg","uiaId":"system","ctxtId":"HomeScreen","contextSeq":75,"params":{}} ));
			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"ctxtChg","uiaId":"backupparking","ctxtId":"Idle","contextSeq":76,"params":{}} ));
			//framework.debug.sendMmuiMsg(JSON.stringify({"msgType":"msg","uiaId":"emnavi","msgId":"EndStateSbn_NextTurn","params":{}} ));

			//msg_type = "msg";
			//msg_type = "ctxtChg";
			//app_id = "system";
			//event_id = "StatusMenu";
			//params_obj = {
			//	"payload": {
			//		"statusMenu" : {
			//			"appName":"system",
			//			"appStatus":"Available",
			//			"label":"App1Button2"
			//		}
			//	}
			//};
			//framework.debug.fakeMsgTypeMsg(app_id, event_id, params_obj);