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

"currents" list attached in wrong place #229

Open
andyvan-trabus opened this issue Sep 10, 2021 · 0 comments
Open

"currents" list attached in wrong place #229

andyvan-trabus opened this issue Sep 10, 2021 · 0 comments

Comments

@andyvan-trabus
Copy link
Contributor

I see the following code in ais_py.cpp:

case AIS8_1_26_SENSOR_CURR_2D:
{
Ais8_1_26_Curr2D *rpt =
reinterpret_cast<Ais8_1_26_Curr2D *>(msg.reports[rpt_num]);
DictSafeSetItem(rpt_dict, "type", rpt->type);
DictSafeSetItem(rpt_dict, "spare", rpt->spare);

    PyObject *curr_list = PyList_New(3);
    DictSafeSetItem(dict, "currents", curr_list);
    for (size_t idx = 0; idx < 3; idx++) {
      PyObject *curr_dict = PyDict_New();
      DictSafeSetItem(curr_dict, "speed", rpt->currents[idx].speed);
      DictSafeSetItem(curr_dict, "dir", rpt->currents[idx].dir);
      DictSafeSetItem(curr_dict, "depth", rpt->currents[idx].depth);
      PyList_SetItem(curr_list, idx, curr_dict);
    }
  }
  break;

The DictSafeSetItem call for "currents" should be specifying rpt as the first parameter, not dict. This same problem is present in the code for AIS8_1_26_SENSOR_HORZ_FLOW and AIS8_1_26_SENSOR_CURR_3D.

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

No branches or pull requests

1 participant