testexecmgmt/ucc/Source/Uccs.v2/ServiceStubs/GPSSimulator/CAPICommandHandlerStub.cpp
changeset 0 3da2a79470a7
equal deleted inserted replaced
-1:000000000000 0:3da2a79470a7
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "CAPICommandHandlerStub.h"
       
    22 #include "APICommandHandler.h"
       
    23 
       
    24 CAPICommandHandlerStub::CAPICommandHandlerStub()
       
    25 {
       
    26 	iGPSSimulator = new CCGpssimulator();
       
    27 }
       
    28 
       
    29 CAPICommandHandlerStub::~CAPICommandHandlerStub()
       
    30 {
       
    31 	delete iGPSSimulator;
       
    32 }
       
    33 
       
    34 int CAPICommandHandlerStub::StartUccsService( char *aHostName,  int *aErrorCode, int *aUnused )
       
    35 {
       
    36 	int client_stub_error;
       
    37 	
       
    38 	*aErrorCode = 0;
       
    39 	
       
    40 	// connect to the remote service
       
    41 	client_stub_error = iGPSSimulator->Connect( aHostName );
       
    42 
       
    43 	// return the result
       
    44 	return client_stub_error;
       
    45 }
       
    46 
       
    47 int CAPICommandHandlerStub::StopUccsService( int *aErrorCode, int *aUnused )
       
    48 {
       
    49 	int client_stub_error;
       
    50 	*aErrorCode = 0;
       
    51 
       
    52 	// shutdown the stub -- force it to close
       
    53 	client_stub_error = iGPSSimulator->Disconnect();
       
    54 	
       
    55 	// done
       
    56 	return client_stub_error;
       
    57 }
       
    58 
       
    59 CDataRecord* CAPICommandHandlerStub::IssueCommand( CDataRecord* aRequest )
       
    60 {
       
    61 	int call_result, err, client_stub_error, method_id = -1;
       
    62 	
       
    63 	CDataRecord *request_reply;
       
    64 
       
    65 	TStartupInfo sarg_startup_info;
       
    66 	int rv_integer, sarg_integer;
       
    67 
       
    68 	// create a standard reply 
       
    69 	request_reply = CreateBaseReply( aRequest );
       
    70 
       
    71 	// get and check the method_id
       
    72 	err = request_reply->GetFieldAsInt( "METHODID", &method_id );
       
    73 	if( method_id == -1 )
       
    74 	{
       
    75 		UpdateCompletionCode( request_reply, ERR_INVALID_METHOD );
       
    76 		return request_reply;
       
    77 	}
       
    78 
       
    79 	// now dispatch and call the appropriate method
       
    80 	switch( method_id )
       
    81 	{
       
    82 		// ss_startuprpcservice
       
    83 		case 1:
       
    84 			{
       
    85 				// extract the parameters
       
    86 				sarg_startup_info.iEmpty = 0;
       
    87 
       
    88 				// make the call and update the return value
       
    89 				client_stub_error = iGPSSimulator->ss_startuprpcservice( sarg_startup_info, &rv_integer );
       
    90 				UpdateCompletionCode( request_reply, client_stub_error );		
       
    91 				if( client_stub_error != ERR_NONE )
       
    92 				{
       
    93 					break;
       
    94 				}
       
    95 				// set any return information
       
    96 				request_reply->NewField( "RESULT", rv_integer );
       
    97 			}
       
    98 			break;
       
    99 
       
   100 		// sc_shutdownrpcservice
       
   101 		case 2: 
       
   102 			{
       
   103 				// extract the parameters
       
   104 				GETINTEGERARGUMENT( "FORCE", &sarg_integer, 1, 1, aRequest, request_reply );
       
   105 
       
   106 				// make the call and update the return value
       
   107 				client_stub_error = iGPSSimulator->sc_shutdownrpcservice( sarg_integer, &rv_integer );
       
   108 				UpdateCompletionCode( request_reply, client_stub_error );
       
   109 				if( client_stub_error != ERR_NONE )
       
   110 				{
       
   111 					break;
       
   112 				}
       
   113 				// set the return values
       
   114 				request_reply->NewField( "RESULT", rv_integer );
       
   115 			}
       
   116 			break;
       
   117 
       
   118 		// startsimulator		
       
   119 		case 10:
       
   120 			{
       
   121 				// Make the call and update the return values
       
   122 				call_result = iGPSSimulator->startsimulator( &rv_integer );
       
   123 				UpdateCompletionCode( request_reply, call_result );
       
   124 				if( call_result != ERR_NONE )
       
   125 				{
       
   126 					break;
       
   127 				}
       
   128 				// set the return values
       
   129 				request_reply->NewField( "RESULT", rv_integer );
       
   130 			}
       
   131 			break;
       
   132 
       
   133 		// stopsimulator		
       
   134 		case 11:
       
   135 			{
       
   136 				// Make the call and update the return values
       
   137 				call_result = iGPSSimulator->stopsimulator( &rv_integer );
       
   138 				UpdateCompletionCode( request_reply, call_result );
       
   139 				if( call_result != ERR_NONE )
       
   140 				{
       
   141 					break;
       
   142 				}
       
   143 				// set the return values
       
   144 				request_reply->NewField( "RESULT", rv_integer );
       
   145 			}
       
   146 			break;
       
   147 			
       
   148 		// setfielddefault
       
   149 		case 12:
       
   150 			{
       
   151 				// Extract the parameters
       
   152 				int		fieldID;
       
   153 				int		state;
       
   154 				char*	value = NULL;
       
   155 	
       
   156 				GETINTEGERARGUMENT( "FIELD", &fieldID, 1, 0, aRequest, request_reply );
       
   157 				GETINTEGERARGUMENT( "STATE", &state, 2, 0, aRequest, request_reply );
       
   158 				GETSTRINGARGUMENT( "VALUE", &value, 3, 1, aRequest, request_reply );
       
   159 
       
   160 				TField	field = {0,0,0};
       
   161 				field.iFieldId = fieldID;
       
   162 				field.iState = state;
       
   163 				if( value!=NULL )
       
   164 				{
       
   165 					strcpy( field.iValue, value );
       
   166 				}
       
   167 
       
   168 				// Make the call and update the return values
       
   169 				call_result = iGPSSimulator->setfielddefault( field, &rv_integer );
       
   170 				UpdateCompletionCode( request_reply, call_result );
       
   171 				if( call_result != ERR_NONE )
       
   172 				{
       
   173 					break;
       
   174 				}
       
   175 				// set the return values
       
   176 				request_reply->NewField( "RESULT", rv_integer );
       
   177 			}
       
   178 			break;
       
   179 
       
   180 		// setsatellitedefault
       
   181 		case 13:
       
   182 			{
       
   183 				// Extract the parameters
       
   184 				int		elevation;
       
   185 				int		azimuth;
       
   186 				int		snr;
       
   187 				int		id;
       
   188 
       
   189 				GETINTEGERARGUMENT( "ELEVATION", &elevation, 1, 0, aRequest, request_reply );
       
   190 				GETINTEGERARGUMENT( "AZIMUTH", &azimuth, 2, 0, aRequest, request_reply );
       
   191 				GETINTEGERARGUMENT( "SNR", &snr, 3, 0, aRequest, request_reply );
       
   192 				GETINTEGERARGUMENT( "SATID", &id, 4, 0, aRequest, request_reply );
       
   193 
       
   194 				TSatellite	satellite;
       
   195 				satellite.iAzimuth = azimuth;
       
   196 				satellite.iElevation = elevation;
       
   197 				satellite.iSNR = snr;
       
   198 				satellite.iId = id;
       
   199 
       
   200 				// Make the call and update the return values
       
   201 				call_result = iGPSSimulator->setsatellitedefault( satellite, &rv_integer );
       
   202 				UpdateCompletionCode( request_reply, call_result );
       
   203 				if( call_result != ERR_NONE )
       
   204 				{
       
   205 					break;
       
   206 				}
       
   207 				// set the return values
       
   208 				request_reply->NewField( "RESULT", rv_integer );
       
   209 			}
       
   210 			break;
       
   211 
       
   212 		// positionset
       
   213 		case 14:
       
   214 			{
       
   215 				// Extract the parameters
       
   216 				char*	latitude;
       
   217 				char*	ns;
       
   218 				char*	longitude;
       
   219 				char*	ew;
       
   220 
       
   221 				GETSTRINGARGUMENT( "LATITUDE", &latitude, 1, 0, aRequest, request_reply );
       
   222 				GETSTRINGARGUMENT( "NS", &ns, 2, 0, aRequest, request_reply );
       
   223 				GETSTRINGARGUMENT( "LONGITUDE", &longitude, 3, 0, aRequest, request_reply );
       
   224 				GETSTRINGARGUMENT( "EW", &ew, 4, 0, aRequest, request_reply );
       
   225 
       
   226 				TPositionInfo	pos;
       
   227 				pos.iLatitude = atof( latitude );
       
   228 				pos.iNS = strcmp("N", ns)?1:0;
       
   229 				pos.iLongitude = atof( longitude );
       
   230 				pos.iEW = strcmp("E", ew)?1:0;
       
   231 
       
   232 				// Make the call and update the return values
       
   233 				call_result = iGPSSimulator->positionset( pos, &rv_integer );
       
   234 				UpdateCompletionCode( request_reply, call_result );
       
   235 				if( call_result != ERR_NONE )
       
   236 				{
       
   237 					break;
       
   238 				}
       
   239 				// set the return values
       
   240 				request_reply->NewField( "RESULT", rv_integer );
       
   241 			}
       
   242 			break;
       
   243 			
       
   244 		// courseset
       
   245 		case 15:
       
   246 			{
       
   247 				// Extract the parameters
       
   248 				int	speed;
       
   249 				int	direction;
       
   250 
       
   251 				GETINTEGERARGUMENT( "SPEED", &speed, 1, 0, aRequest, request_reply );
       
   252 				GETINTEGERARGUMENT( "DIRECTION", &direction, 2, 0, aRequest, request_reply );
       
   253 
       
   254 				TCourse	course;
       
   255 				course.iSpeed = (double)speed;
       
   256 				course.iDirection = (double)direction;
       
   257 
       
   258 				// Make the call and update the return values
       
   259 				call_result = iGPSSimulator->courseset( course, &rv_integer );
       
   260 				UpdateCompletionCode( request_reply, call_result );
       
   261 				if( call_result != ERR_NONE )
       
   262 				{
       
   263 					break;
       
   264 				}
       
   265 				// set the return values
       
   266 				request_reply->NewField( "RESULT", rv_integer );
       
   267 			}
       
   268 			break;
       
   269 			
       
   270 		// accuracyset
       
   271 		case 16:
       
   272 			{
       
   273 				// Extract the parameters
       
   274 				char* accuracyStr;
       
   275 				char* hwconstantStr;
       
   276 				GETSTRINGARGUMENT( "ACCURACY", &accuracyStr, 1, 0, aRequest, request_reply );
       
   277 				GETSTRINGARGUMENT( "HWCONSTANT", &hwconstantStr, 1, 0, aRequest, request_reply );
       
   278 
       
   279 				// Make the call and update the return values
       
   280 				TAccuracy accuracy;
       
   281 				accuracy.iAccuracy = atof(accuracyStr);
       
   282 				accuracy.iHWConstant = atof(hwconstantStr);
       
   283 				call_result = iGPSSimulator->accuracyset( accuracy, &rv_integer );
       
   284 				UpdateCompletionCode( request_reply, call_result );
       
   285 				if( call_result != ERR_NONE )
       
   286 				{
       
   287 					break;
       
   288 				}
       
   289 				// set the return values
       
   290 				request_reply->NewField( "RESULT", rv_integer );
       
   291 			}
       
   292 			break;
       
   293 
       
   294 		// satelliteset
       
   295 		case 17:
       
   296 			{
       
   297 				// Extract the parameters
       
   298 				int		elevation;
       
   299 				int		azimuth;
       
   300 				int		snr;
       
   301 				int		id;
       
   302 
       
   303 				GETINTEGERARGUMENT( "ELEVATION", &elevation, 1, 0, aRequest, request_reply );
       
   304 				GETINTEGERARGUMENT( "AZIMUTH", &azimuth, 2, 0, aRequest, request_reply );
       
   305 				GETINTEGERARGUMENT( "SNR", &snr, 3, 0, aRequest, request_reply );
       
   306 				GETINTEGERARGUMENT( "SATID", &id, 4, 0, aRequest, request_reply );
       
   307 
       
   308 				TSatellite	satellite;
       
   309 				satellite.iAzimuth = azimuth;
       
   310 				satellite.iElevation = elevation;
       
   311 				satellite.iSNR = snr;
       
   312 				satellite.iId = id;
       
   313 
       
   314 				// Make the call and update the return values
       
   315 				call_result = iGPSSimulator->satelliteset( satellite, &rv_integer );
       
   316 				UpdateCompletionCode( request_reply, call_result );
       
   317 				if( call_result != ERR_NONE )
       
   318 				{
       
   319 					break;
       
   320 				}
       
   321 				// set the return values
       
   322 				request_reply->NewField( "RESULT", rv_integer );
       
   323 			}
       
   324 			break;
       
   325 
       
   326 		// batchappendsentence
       
   327 		case 18:
       
   328 			{
       
   329 				// Extract the parameters
       
   330 				int		sentenceId;
       
   331 				int		frequency;
       
   332 
       
   333 				GETINTEGERARGUMENT( "SENTENCEID", &sentenceId, 1, 0, aRequest, request_reply );
       
   334 				GETINTEGERARGUMENT( "FREQUENCY", &frequency, 2, 0, aRequest, request_reply );
       
   335 
       
   336 				TAppendSentence sentence;
       
   337 				sentence.iSentenceId = sentenceId;
       
   338 				sentence.iFrequency = frequency;
       
   339 
       
   340 				// Make the call and update the return values
       
   341 				call_result = iGPSSimulator->batchappendsentence( sentence, &rv_integer );
       
   342 				UpdateCompletionCode( request_reply, call_result );
       
   343 				if( call_result != ERR_NONE )
       
   344 				{
       
   345 					break;
       
   346 				}
       
   347 				// set the return values
       
   348 				request_reply->NewField( "RESULT", rv_integer );
       
   349 			}
       
   350 			break;
       
   351 
       
   352 		// batchappendusersentence
       
   353 		case 19:
       
   354 			{
       
   355 				// Extract the parameters
       
   356 				int	sentenceId;
       
   357 				int	frequency = 1;
       
   358 				int numFields = 0;
       
   359 
       
   360 				GETINTEGERARGUMENT( "NUMFIELDS", &numFields, 1, 0, aRequest, request_reply );
       
   361 				GETINTEGERARGUMENT( "SENTENCEID", &sentenceId, 2, 0, aRequest, request_reply );
       
   362 				GETINTEGERARGUMENT( "FREQUENCY", &frequency, 3, 1, aRequest, request_reply );
       
   363 
       
   364 				TAppendSentence	sentence;
       
   365 				sentence.iSentenceId = sentenceId;
       
   366 				sentence.iFrequency = frequency;
       
   367 				TAppendUserSentence userSentence;
       
   368 				userSentence.iAppendSentence = sentence;
       
   369 
       
   370 				// Allocate enough space for the number of user fields
       
   371 				userSentence.iUserFields.iUserFields_len = numFields;
       
   372 				userSentence.iUserFields.iUserFields_val = new TField[numFields];
       
   373 				int count = 0;
       
   374 
       
   375 				// Check each possible field id to see if it has been entered in the script
       
   376 				for( int field_id = 1 ; field_id <= F_NUMBER_OF_FIELDS ; field_id++ )
       
   377 				{
       
   378 					string field_str;
       
   379 					switch( field_id )
       
   380 					{
       
   381 						case F_TIME:				field_str = "TIME"; break;
       
   382 						case F_STATUS:				field_str = "STATUS"; break;
       
   383 						case F_DATE:				field_str = "DATE"; break;
       
   384 						case F_LATITUDE:			field_str = "LATITUDE"; break;
       
   385 						case F_LAT_NORTH_SOUTH:		field_str = "LAT_NORTH_SOUTH"; break;
       
   386 						case F_LONGITUDE:			field_str = "LONGITUDE"; break;
       
   387 						case F_LON_EAST_WEST:		field_str = "LON_EAST_WEST"; break;
       
   388 						case F_SPEED_OVER_GROUND:	field_str = "SPEED"; break;
       
   389 						case F_COURSE_OVER_GROUND:	field_str = "COURSE"; break;
       
   390 						case F_MAGNETIC_VARIATION:	field_str = "MAGNETIC_VARIATION"; break;
       
   391 						case F_MAG_EAST_WEST:		field_str = "MAG_EAST_WEST"; break;
       
   392 						case F_MODE_INDICATOR:		field_str = "MODE_INDICATOR"; break;
       
   393 						case F_OPERATION_MODE:		field_str = "OPERATION_MODE"; break;
       
   394 						case F_FIX_MODE:			field_str = "FIX_MODE"; break;
       
   395 						case F_SATELLITE_ONE:		field_str = "SATELLITE_ONE"; break;
       
   396 						case F_SATELLITE_TWO:		field_str = "SATELLITE_TWO"; break;
       
   397 						case F_SATELLITE_THREE:		field_str = "SATELLITE_THREE"; break;
       
   398 						case F_SATELLITE_FOUR:		field_str = "SATELLITE_FOUR"; break;
       
   399 						case F_SATELLITE_FIVE:		field_str = "SATELLITE_FIVE"; break;
       
   400 						case F_SATELLITE_SIX:		field_str = "SATELLITE_SIX"; break;
       
   401 						case F_SATELLITE_SEVEN:		field_str = "SATELLITE_SEVEN"; break;
       
   402 						case F_SATELLITE_EIGHT:		field_str = "SATELLITE_EIGHT"; break;
       
   403 						case F_SATELLITE_NINE:		field_str = "SATELLITE_NINE"; break;
       
   404 						case F_SATELLITE_TEN:		field_str = "SATELLITE_TEN"; break;
       
   405 						case F_SATELLITE_ELEVEN:	field_str = "SATELLITE_ELEVEN"; break;
       
   406 						case F_SATELLITE_TWELVE:	field_str = "SATELLITE_TWELVE"; break;
       
   407 						case F_PDOP:				field_str = "PDOP"; break;
       
   408 						case F_HDOP:				field_str = "HDOP"; break;
       
   409 						case F_VDOP:				field_str = "VDOP"; break;
       
   410 						case F_SATELLITES_IN_USE:	field_str = "SATELLITES_IN_USE"; break;
       
   411 						case F_ANTENNA_ALTITUDE:	field_str = "ANTENNA_ALTITUDE"; break;
       
   412 						case F_ANTENNA_METERS:		field_str = "ANTENNA_METERS"; break;
       
   413 						case F_GEOIDAL_SEPARATION:	field_str = "GEOIDAL_SEPARATION"; break;
       
   414 						case F_GEOIDAL_METERS:		field_str = "GEOIDAL_METERS"; break;
       
   415 						case F_DIFFERENTIAL_AGE:	field_str = "DIFFERENTIAL_AGE"; break;
       
   416 						case F_DIFFERENTIAL_REF_ID:	field_str = "DIFFERENTIAL_REF_ID"; break;
       
   417 						case F_GPS_QUALITY:			field_str = "GPS_QUALITY"; break;
       
   418 						case F_NUMBER_OF_SENTENCES:	field_str = "NUMBER_OF_SENTENCES"; break;
       
   419 						case F_CHECKSUM:			field_str = "CHECKSUM"; break;
       
   420 						default:
       
   421 							break;
       
   422 					}
       
   423 					
       
   424 					// Append _STATE for each id for the state retrieval
       
   425 					string field_state_str = field_str + "_STATE";
       
   426 					char* field_state = NULL;
       
   427 					GETSTRINGARGUMENT( (char*)field_state_str.c_str(), &field_state, field_id+4, 1, aRequest, request_reply );
       
   428 
       
   429 					if( field_state != NULL && count<numFields )
       
   430 					{
       
   431 						userSentence.iUserFields.iUserFields_val[count].iFieldId = field_id;
       
   432 						userSentence.iUserFields.iUserFields_val[count].iState = atoi( field_state );
       
   433 
       
   434 						if( atoi(field_state) == S_VALUE )
       
   435 						{
       
   436 							char* field = NULL;
       
   437 							GETSTRINGARGUMENT( (char*)field_str.c_str(), &field, field_id+4+F_NUMBER_OF_FIELDS, 0, aRequest, request_reply );
       
   438 
       
   439 							if( field != NULL && count < numFields )
       
   440 							{
       
   441 								strcpy( userSentence.iUserFields.iUserFields_val[count++].iValue, field );
       
   442 							}							
       
   443 						}
       
   444 					}
       
   445 				}
       
   446 
       
   447 				// Make the call and update the return values
       
   448 				call_result = iGPSSimulator->batchappendusersentence( userSentence, &rv_integer );
       
   449 
       
   450 				// Cleanup the user fields now
       
   451 				delete[] userSentence.iUserFields.iUserFields_val;
       
   452 
       
   453 				UpdateCompletionCode( request_reply, call_result );
       
   454 				if( call_result != ERR_NONE )
       
   455 				{
       
   456 					break;
       
   457 				}
       
   458 				// set the return values
       
   459 				request_reply->NewField( "RESULT", rv_integer );
       
   460 			}
       
   461 			break;
       
   462 
       
   463 		// batchsetdelay
       
   464 		case 20:
       
   465 			{
       
   466 				// Extract the parameters
       
   467 				int	delay;
       
   468 
       
   469 				GETINTEGERARGUMENT( "DELAY", &delay, 1, 0, aRequest, request_reply );
       
   470 
       
   471 				// Make the call and update the return values
       
   472 				call_result = iGPSSimulator->batchsetdelay( delay, &rv_integer );
       
   473 				UpdateCompletionCode( request_reply, call_result );
       
   474 				if( call_result != ERR_NONE )
       
   475 				{
       
   476 					break;
       
   477 				}
       
   478 				// set the return values
       
   479 				request_reply->NewField( "RESULT", rv_integer );
       
   480 			}
       
   481 			break;
       
   482 
       
   483 		// batchreset
       
   484 		case 21:
       
   485 			{
       
   486 				// Make the call and update the return values
       
   487 				call_result = iGPSSimulator->batchreset( &rv_integer );
       
   488 				UpdateCompletionCode( request_reply, call_result );
       
   489 				if( call_result != ERR_NONE )
       
   490 				{
       
   491 					break;
       
   492 				}
       
   493 				// set the return values
       
   494 				request_reply->NewField( "RESULT", rv_integer );
       
   495 			}
       
   496 			break;
       
   497 			
       
   498 		// setcomport
       
   499 		case 22:
       
   500 			{
       
   501 				// Extract the parameters
       
   502 				char*	port;
       
   503 	
       
   504 				GETSTRINGARGUMENT( "COMPORT", &port, 1, 0, aRequest, request_reply );
       
   505 
       
   506 				// Make the call and update the return values
       
   507 				call_result = iGPSSimulator->setcomport( port, &rv_integer );
       
   508 				UpdateCompletionCode( request_reply, call_result );
       
   509 				if( call_result != ERR_NONE )
       
   510 				{
       
   511 					break;
       
   512 				}
       
   513 				// set the return values
       
   514 				request_reply->NewField( "RESULT", rv_integer );
       
   515 			}
       
   516 			break;
       
   517 
       
   518 		// setchunkmode
       
   519 		case 23:
       
   520 			{
       
   521 				// Extract the parameters
       
   522 				int	mode;
       
   523 	
       
   524 				GETINTEGERARGUMENT( "MODE", &mode, 1, 0, aRequest, request_reply );
       
   525 
       
   526 				// Make the call and update the return values
       
   527 				call_result = iGPSSimulator->setchunkmode( mode==0?false:true, &rv_integer );
       
   528 				UpdateCompletionCode( request_reply, call_result );
       
   529 				if( call_result != ERR_NONE )
       
   530 				{
       
   531 					break;
       
   532 				}
       
   533 				// set the return values
       
   534 				request_reply->NewField( "RESULT", rv_integer );
       
   535 			}
       
   536 			break;
       
   537 
       
   538 		// setchunksize
       
   539 		case 24:
       
   540 			{
       
   541 				// Extract the parameters
       
   542 				int	size;
       
   543 	
       
   544 				GETINTEGERARGUMENT( "SIZE", &size, 1, 0, aRequest, request_reply );
       
   545 
       
   546 				// Make the call and update the return values
       
   547 				call_result = iGPSSimulator->setchunksize( size, &rv_integer );
       
   548 				UpdateCompletionCode( request_reply, call_result );
       
   549 				if( call_result != ERR_NONE )
       
   550 				{
       
   551 					break;
       
   552 				}
       
   553 				// set the return values
       
   554 				request_reply->NewField( "RESULT", rv_integer );
       
   555 			}
       
   556 			break;
       
   557 			
       
   558 		// setchunkdelay
       
   559 		case 25:
       
   560 			{
       
   561 				// Extract the parameters
       
   562 				int	delay;
       
   563 	
       
   564 				GETINTEGERARGUMENT( "DELAY", &delay, 1, 0, aRequest, request_reply );
       
   565 
       
   566 				// Make the call and update the return values
       
   567 				call_result = iGPSSimulator->setchunkdelay( delay, &rv_integer );
       
   568 				UpdateCompletionCode( request_reply, call_result );
       
   569 				if( call_result != ERR_NONE )
       
   570 				{
       
   571 					break;
       
   572 				}
       
   573 				// set the return values
       
   574 				request_reply->NewField( "RESULT", rv_integer );
       
   575 			}
       
   576 			break;
       
   577 			
       
   578 		// startcomms
       
   579 		case 26:
       
   580 			{
       
   581 				// Make the call and update the return values
       
   582 				call_result = iGPSSimulator->startcomms( &rv_integer );
       
   583 				UpdateCompletionCode( request_reply, call_result );
       
   584 				if( call_result != ERR_NONE )
       
   585 				{
       
   586 					break;
       
   587 				}
       
   588 				// set the return values
       
   589 				request_reply->NewField( "RESULT", rv_integer );
       
   590 			}
       
   591 			break;
       
   592 
       
   593 		// stopcomms
       
   594 		case 27:
       
   595 			{
       
   596 				// Make the call and update the return values
       
   597 				call_result = iGPSSimulator->stopcomms( &rv_integer );
       
   598 				UpdateCompletionCode( request_reply, call_result );
       
   599 				if( call_result != ERR_NONE )
       
   600 				{
       
   601 					break;
       
   602 				}
       
   603 				// set the return values
       
   604 				request_reply->NewField( "RESULT", rv_integer );
       
   605 			}
       
   606 			break;
       
   607 
       
   608 		// batchappenduserstring
       
   609 		case 28:
       
   610 			{
       
   611 				// Extract the parameters
       
   612 				char*	userString;
       
   613 				int		frequency;
       
   614 
       
   615 				GETSTRINGARGUMENT( "STRING", &userString, 1, 0, aRequest, request_reply );
       
   616 				GETINTEGERARGUMENT( "FREQUENCY", &frequency, 2, 0, aRequest, request_reply );
       
   617 
       
   618 				TAppendString sentence;
       
   619 				strcpy( sentence.iUserString, userString );
       
   620 				sentence.iFrequency = frequency;
       
   621 
       
   622 				// Make the call and update the return values
       
   623 				call_result = iGPSSimulator->batchappenduserstring( sentence, &rv_integer );
       
   624 				UpdateCompletionCode( request_reply, call_result );
       
   625 				if( call_result != ERR_NONE )
       
   626 				{
       
   627 					break;
       
   628 				}
       
   629 				// set the return values
       
   630 				request_reply->NewField( "RESULT", rv_integer );
       
   631 			}
       
   632 			break;
       
   633 			
       
   634 		// Any other method id results in an invalid method id result
       
   635 		default:
       
   636 			{
       
   637 				UpdateCompletionCode( request_reply, ERR_INVALID_METHOD );
       
   638 			}
       
   639 			break;
       
   640 	}
       
   641 
       
   642 	// everything should be handled above 
       
   643 	return request_reply;
       
   644 }
       
   645 
       
   646 int CAPICommandHandlerStub::GetStatus()
       
   647 {
       
   648 	return -1;
       
   649 }
       
   650 
       
   651 char *CAPICommandHandlerStub::GetLastRPCError( int *aIntError )
       
   652 {
       
   653 	return iGPSSimulator->GetLastRPCError( aIntError );
       
   654 }