Example #1
0
void GPS::handleInjectDataTopic()
{
	if (_orb_inject_data_fd == -1) {
		return;
	}

	bool updated = false;

	do {
		orb_check(_orb_inject_data_fd, &updated);

		if (updated) {
			struct gps_inject_data_s msg;
			orb_copy(ORB_ID(gps_inject_data), _orb_inject_data_fd, &msg);

			/* Write the message to the gps device. Note that the message could be fragmented.
			 * But as we don't write anywhere else to the device during operation, we don't
			 * need to assemble the message first.
			 */
			injectData(msg.data, msg.len);

			++_last_rate_rtcm_injection_count;
		}
	} while (updated);
}
Example #2
0
void GPS::handleInjectDataTopic()
{
    if (_orb_inject_data_fd[0] == -1) {
        return;
    }

    bool updated = false;

    do {
        int orb_inject_data_cur_fd = _orb_inject_data_fd[_orb_inject_data_next];
        orb_check(orb_inject_data_cur_fd, &updated);

        if (updated) {
            struct gps_inject_data_s msg;
            orb_copy(ORB_ID(gps_inject_data), orb_inject_data_cur_fd, &msg);
            injectData(msg.data, msg.len);

            _orb_inject_data_next = (_orb_inject_data_next + 1) % _orb_inject_data_fd_count;

            ++_last_rate_rtcm_injection_count;
        }
    } while (updated);
}