debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/service/TRKConnectedService.java
changeset 1009 64772cb3290b
parent 894 48b544aebc83
child 1115 f2b4c39f3e7b
equal deleted inserted replaced
1007:3cb773e29ddc 1009:64772cb3290b
    84 	
    84 	
    85 	private static final Version VERSIONS3_VERSION = new Version(3, 2, 4);
    85 	private static final Version VERSIONS3_VERSION = new Version(3, 2, 4);
    86 	private static final byte[] TRK_PING = {0x7e, 0x0, 0x0, (byte) 0xff, 0x7e};
    86 	private static final byte[] TRK_PING = {0x7e, 0x0, 0x0, (byte) 0xff, 0x7e};
    87 	private static final byte[] TRK_VERSION = {0x7e, 0x08, 0x01, (byte) 0xf6, 0x7e};
    87 	private static final byte[] TRK_VERSION = {0x7e, 0x08, 0x01, (byte) 0xf6, 0x7e};
    88 	private static final byte[] TRK_VERSIONS3 = {0x7e, 0x51, 0x02, (byte) 0xac, 0x7e};
    88 	private static final byte[] TRK_VERSIONS3 = {0x7e, 0x51, 0x02, (byte) 0xac, 0x7e};
    89 	private static final byte[] SYS_TRK_RESPONSE = 
    89 	private static final int SYS_TRK_RESPONSE_STR_OFFSET = 10;
    90 		{0x7e, (byte) 0x80, 0x02, 0x00, 0x03, 0x02, 0x03, 0x06, 0x04, 0x00, 0x0a, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x54, 0x52, 0x4b, (byte) 0xcb, 0x7e};
    90 	private static final byte[] SYS_TRK_RESPONSE_STR = 
       
    91 					{0x0a, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x54, 0x52, 0x4b};
       
    92 	private static final int REQUIRED_MSG_LEN = 
       
    93 					SYS_TRK_RESPONSE_STR.length + SYS_TRK_RESPONSE_STR_OFFSET;
    91 	
    94 	
    92 	private Pair<String, Version> deviceOS;
    95 	private Pair<String, Version> deviceOS;
    93 	private TRKService trkService;
    96 	private TRKService trkService;
    94 	static Class<?> startTCFServer = TCFClassFactory.class; // force the tcf plugin to load
    97 	static Class<?> startTCFServer = TCFClassFactory.class; // force the tcf plugin to load
    95 
    98 
   203 								waitForSingleTCMessage(stream);
   206 								waitForSingleTCMessage(stream);
   204 								if (stream.peekMessages() > 0) {
   207 								if (stream.peekMessages() > 0) {
   205 									tcMessage = stream.readMessage(); // version response
   208 									tcMessage = stream.readMessage(); // version response
   206 									message = tcMessage.getMessage();
   209 									message = tcMessage.getMessage();
   207 //									printMessage(message);
   210 //									printMessage(message);
   208 									boolean isSysTrk = Arrays.equals(message, SYS_TRK_RESPONSE);
   211 									boolean isSysTrk = false;
       
   212 									if (message.length >= REQUIRED_MSG_LEN) {
       
   213 										byte[] trkStr = new byte[SYS_TRK_RESPONSE_STR.length];
       
   214 										System.arraycopy(message, SYS_TRK_RESPONSE_STR_OFFSET, trkStr, 0, trkStr.length);
       
   215 //										printMessage(trkStr);
       
   216 //										printMessage(SYS_TRK_RESPONSE_STR);
       
   217 										isSysTrk = Arrays.equals(trkStr, SYS_TRK_RESPONSE_STR);
       
   218 									}
   209 									getProperties().put(PROP_SYS_TRK, Boolean.valueOf(isSysTrk).toString());
   219 									getProperties().put(PROP_SYS_TRK, Boolean.valueOf(isSysTrk).toString());
   210 								}
   220 								}
   211 							}
   221 							}
   212 						}
   222 						}
   213 						else
   223 						else