Removed "sim/" auto add feature

Removed “sim/“ auto add feature. There are some drefs (custom/art) that
do not start with “sim/“
This commit is contained in:
Chris Teubert
2015-04-03 10:47:55 -07:00
parent 3f0274a74c
commit 0c2e786890
9 changed files with 6 additions and 28 deletions

View File

@@ -105,7 +105,7 @@ int main() {
// SendDREF (Landing Gear)
printf("- Stowing Landing Gear\n");
strcpy(DREF, "cockpit/switches/gear_handle_status"); // Gear handle data reference
strcpy(DREF, "sim/cockpit/switches/gear_handle_status"); // Gear handle data reference
DREFSizes[0] = strlen(DREF);
gear = 1; // Stow gear

View File

@@ -45,7 +45,7 @@ sendDATA(data);
pause(10) % Run sim for 10 seconds
%% Use DREF to raise landing gear
disp('Raising gear');
gearDREF = 'cockpit/switches/gear_handle_status';
gearDREF = 'sim/cockpit/switches/gear_handle_status';
sendDREF(gearDREF, 0);
pause(10) % Run sim for 10 seconds
%% Confirm gear and paus status by reading DREFs

View File

@@ -103,7 +103,7 @@ short requestDREFTest() // Request DREF Test (Required for next tests)
sendPort = openUDP( 49064, "127.0.0.1", 49009 );
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
strcpy(DREFArray[0],"sim/cockpit/switches/gear_handle_status");
strcpy(DREFArray[1],"cockpit2/switches/panel_brightness_ratio");
strcpy(DREFArray[1],"sim/cockpit2/switches/panel_brightness_ratio");
for (i=0;i<2;i++) {
DREFSizes[i] = (int) strlen(DREFArray[i]);
}

View File

@@ -106,7 +106,7 @@ void requestDREFTest() // Request DREF Test (Required for next tests)
sendPort = openUDP( 49064, "127.0.0.1", 49009 );
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
strcpy(DREFArray[0],"sim/cockpit/switches/gear_handle_status");
strcpy(DREFArray[1],"cockpit2/switches/panel_brightness_ratio");
strcpy(DREFArray[1],"sim/cockpit2/switches/panel_brightness_ratio");
for (i=0;i<2;i++) {
DREFSizes[i] = (int) strlen(DREFArray[i]);
}

View File

@@ -5,7 +5,7 @@ addpath('../../MATLAB')
import XPlaneConnect.*
DREFS = {'sim/cockpit/switches/gear_handle_status',...
'cockpit2/switches/panel_brightness_ratio'};
'sim/cockpit2/switches/panel_brightness_ratio'};
result = requestDREF(DREFS);

View File

@@ -829,7 +829,6 @@ int handleGETD(char buf[])
{
if (listLength > 0)
{
handleDREFSIM(DREFArray[i]);// Adds "sim/" if not present
connectionList[current_connection].XPLMRequestedDRefs[i] = XPLMFindDataRef(DREFArray[i]);
}
@@ -908,8 +907,6 @@ int handleDREF(char buf[])
}
// Handle DREF
handleDREFSIM(DREF);// Adds "sim/" if not present
sprintf(logmsg,"[DREF] Request to set DREF value received (Conn %i): %s",current_connection+1,DREF);
updateLog(logmsg,strlen(logmsg));

Binary file not shown.

View File

@@ -304,23 +304,6 @@ unsigned short getIP(struct sockaddr recvaddr, char *IP)
return ntohs((*sendaddr).sin_port);
}
int handleDREFSIM(char *DREF)
{
//checks if sim/ is at the beginning of the dref string. If not, adds it.
char firstFour[5] = {0};
char fullDREF[200] = {0};
memcpy(firstFour,DREF,4);
if (strcmp(firstFour,"sim/") != 0)
{
sprintf(fullDREF, "sim/%s",DREF);
memcpy(DREF,fullDREF,strlen(fullDREF));
}
return 0;
}
// DEBUGGING TOOLS
// --------------------------------
int printBufferToLog(struct XPCMessage & msg)

View File

@@ -41,9 +41,7 @@
unsigned short getIP(struct sockaddr recvaddr, char *IP);
int printBufferToLog(struct XPCMessage & msg);
int handleDREFSIM(char *DREF);
int fmini(int a, int b);