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:
@@ -105,7 +105,7 @@ int main() {
|
|||||||
// SendDREF (Landing Gear)
|
// SendDREF (Landing Gear)
|
||||||
printf("- Stowing Landing Gear\n");
|
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);
|
DREFSizes[0] = strlen(DREF);
|
||||||
gear = 1; // Stow gear
|
gear = 1; // Stow gear
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ sendDATA(data);
|
|||||||
pause(10) % Run sim for 10 seconds
|
pause(10) % Run sim for 10 seconds
|
||||||
%% Use DREF to raise landing gear
|
%% Use DREF to raise landing gear
|
||||||
disp('Raising gear');
|
disp('Raising gear');
|
||||||
gearDREF = 'cockpit/switches/gear_handle_status';
|
gearDREF = 'sim/cockpit/switches/gear_handle_status';
|
||||||
sendDREF(gearDREF, 0);
|
sendDREF(gearDREF, 0);
|
||||||
pause(10) % Run sim for 10 seconds
|
pause(10) % Run sim for 10 seconds
|
||||||
%% Confirm gear and paus status by reading DREFs
|
%% Confirm gear and paus status by reading DREFs
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ short requestDREFTest() // Request DREF Test (Required for next tests)
|
|||||||
sendPort = openUDP( 49064, "127.0.0.1", 49009 );
|
sendPort = openUDP( 49064, "127.0.0.1", 49009 );
|
||||||
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
|
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
|
||||||
strcpy(DREFArray[0],"sim/cockpit/switches/gear_handle_status");
|
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++) {
|
for (i=0;i<2;i++) {
|
||||||
DREFSizes[i] = (int) strlen(DREFArray[i]);
|
DREFSizes[i] = (int) strlen(DREFArray[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ void requestDREFTest() // Request DREF Test (Required for next tests)
|
|||||||
sendPort = openUDP( 49064, "127.0.0.1", 49009 );
|
sendPort = openUDP( 49064, "127.0.0.1", 49009 );
|
||||||
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
|
recvPort = openUDP( 49008, "127.0.0.1", 49009 );
|
||||||
strcpy(DREFArray[0],"sim/cockpit/switches/gear_handle_status");
|
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++) {
|
for (i=0;i<2;i++) {
|
||||||
DREFSizes[i] = (int) strlen(DREFArray[i]);
|
DREFSizes[i] = (int) strlen(DREFArray[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ addpath('../../MATLAB')
|
|||||||
import XPlaneConnect.*
|
import XPlaneConnect.*
|
||||||
|
|
||||||
DREFS = {'sim/cockpit/switches/gear_handle_status',...
|
DREFS = {'sim/cockpit/switches/gear_handle_status',...
|
||||||
'cockpit2/switches/panel_brightness_ratio'};
|
'sim/cockpit2/switches/panel_brightness_ratio'};
|
||||||
|
|
||||||
result = requestDREF(DREFS);
|
result = requestDREF(DREFS);
|
||||||
|
|
||||||
|
|||||||
@@ -829,7 +829,6 @@ int handleGETD(char buf[])
|
|||||||
{
|
{
|
||||||
if (listLength > 0)
|
if (listLength > 0)
|
||||||
{
|
{
|
||||||
handleDREFSIM(DREFArray[i]);// Adds "sim/" if not present
|
|
||||||
connectionList[current_connection].XPLMRequestedDRefs[i] = XPLMFindDataRef(DREFArray[i]);
|
connectionList[current_connection].XPLMRequestedDRefs[i] = XPLMFindDataRef(DREFArray[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -908,8 +907,6 @@ int handleDREF(char buf[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle DREF
|
// 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);
|
sprintf(logmsg,"[DREF] Request to set DREF value received (Conn %i): %s",current_connection+1,DREF);
|
||||||
updateLog(logmsg,strlen(logmsg));
|
updateLog(logmsg,strlen(logmsg));
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -304,23 +304,6 @@ unsigned short getIP(struct sockaddr recvaddr, char *IP)
|
|||||||
return ntohs((*sendaddr).sin_port);
|
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
|
// DEBUGGING TOOLS
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
int printBufferToLog(struct XPCMessage & msg)
|
int printBufferToLog(struct XPCMessage & msg)
|
||||||
|
|||||||
@@ -41,9 +41,7 @@
|
|||||||
unsigned short getIP(struct sockaddr recvaddr, char *IP);
|
unsigned short getIP(struct sockaddr recvaddr, char *IP);
|
||||||
|
|
||||||
int printBufferToLog(struct XPCMessage & msg);
|
int printBufferToLog(struct XPCMessage & msg);
|
||||||
|
|
||||||
int handleDREFSIM(char *DREF);
|
|
||||||
|
|
||||||
int fmini(int a, int b);
|
int fmini(int a, int b);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user