Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting byte[] datarefs crash XPlane #38

Open
kamgolabek opened this issue Aug 23, 2018 · 11 comments
Open

Setting byte[] datarefs crash XPlane #38

kamgolabek opened this issue Aug 23, 2018 · 11 comments
Assignees
Labels

Comments

@kamgolabek
Copy link

Like in title, while I am trying to set any data ref with byte[] type , XPlane is crashing.
For example:
set sim/aircraft/view/acf_tailnum sometexthere
cause XPlane crash.

@vranki
Copy link
Owner

vranki commented Aug 23, 2018

Sounds like a bug indeed. Can you or someone get a stack trace on what happens?

@vranki vranki added the bug label Aug 23, 2018
@kamgolabek
Copy link
Author

kamgolabek commented Aug 24, 2018

I did more investigation:

  1. Not causing crash, but value is not changed after this commands (tested on many datarefs)
    telnet localhost 51000
    sub sim/aircraft/view/acf_tailnum:string

    <- value returned here in readable form
    set sim/aircraft/view/acf_tailnum soemstringhere
    <- nothing happened
  2. Causing crash immediately
    telent localhost 51000
    sub sim/aircraft/view/acf_tailnum

    <- base64 value returned
    set sim/aircraft/view/acf_tailnum soemvalueHereORbase64encoded
    <- immediate crash XPlane

And in logs there is nothing about it..

@kamgolabek
Copy link
Author

kamgolabek commented Aug 24, 2018

Ok I have found in code of ExtPlane plugin: (dataref.cpp)
void DataDataRef::setValue(QByteArray &newValue) {
Q_UNUSED(newValue);
//TODO: @dankrusi: finish this implementation and test
qFatal("Writing of Data DataRefs is not yet supported");
/*
// Limit number of values to write to ref length or number of given values
int numberOfValuesToWrite = qMin(_length, values.size());

// Convert values to float and copy to _valueArray
for(int i=0;i<numberOfValuesToWrite;i++) {
    bool ok = true;
    float value = values[i].toFloat(&ok);
    if(!ok) {
        qDebug() << Q_FUNC_INFO << "Invalid value " << values[i] << "in array";
        return;
    }
    _valueArray[i]=value;
}
XPLMSetDatavf(_ref, _valueArray, 0, numberOfValuesToWrite);
*/

}

@vranki
Copy link
Owner

vranki commented Aug 24, 2018

Setting value seems unimplemented feature, but should never cause a crash. There should be "Writing of Data DataRefs is not yet supported" in log or console output.

@kamgolabek
Copy link
Author

okay.. but you can simply reproduce it by using telnet commands I pasted above.. and it crash..

@waynepiekarski
Copy link
Contributor

There probably won't be any logging, since stdout and stderr do not go anywhere on Windows within X-Plane. See issue #23

@Clamb94
Copy link

Clamb94 commented Nov 30, 2018

Is there any progress on this? I'm looking for a way to write data datarefs to X-Plane.
Do you guys have any other idea how to modify data datarefs via the network?

@kamgolabek
Copy link
Author

you can encode characters and save as int array..

@Clamb94
Copy link

Clamb94 commented Dec 14, 2018

you can encode characters and save as int array..

Thanks, I'll give a try

@Clamb94
Copy link

Clamb94 commented Dec 21, 2018

you can encode characters and save as int array..

Have you been able to do this? I tried:
set xxx [1,1]
But this causes a crash as well

@vranki
Copy link
Owner

vranki commented Dec 25, 2018

Pushed a potential implementation of setting byte array (data) datarefs to a feature branch. See README for instructions. This has not been tested properly (coding in train on laptop without X-Plane) but at least it compiles :) . Feel free to test. If it still crashes, a stack trace would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants