Skip to content

Commit

Permalink
Merge pull request #1443 from dwcaress/caress-tmp
Browse files Browse the repository at this point in the history
Caress tmp
  • Loading branch information
dwcaress authored Mar 10, 2024
2 parents 9c37fc0 + b027b5c commit 317037f
Show file tree
Hide file tree
Showing 7 changed files with 1,856 additions and 414 deletions.
846 changes: 440 additions & 406 deletions ChangeLog.html

Large diffs are not rendered by default.

29 changes: 22 additions & 7 deletions src/mbio/mbr_em710raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -4542,7 +4542,17 @@ store->pings[store->ping_index].png_ss_count);
done = true;

/* if necessary read over unread but expected bytes */
bytes_read = ftell(mbfp) - mb_io_ptr->file_bytes - 4;
if(mbfp != NULL){
// reading from file
bytes_read = ftell(mbfp) - mb_io_ptr->file_bytes - 4;
}
// else if(mbsp != NULL) {
// // reading from socket
// bytes_read = 0;
// } else {
// // error: neither file nor socket set
// }

if (!*label_save_flag && !good_end_bytes && bytes_read < record_size) {
#ifdef MBR_EM710RAW_DEBUG
fprintf(stderr, "skip over %d unread bytes of supported datagram type %x\n", record_size - bytes_read, type);
Expand All @@ -4554,8 +4564,8 @@ store->pings[store->ping_index].png_ss_count);
}

#ifdef MBR_EM710RAW_DEBUG
fprintf(stderr, "record_size:%d bytes read:%ld file_pos old:%ld new:%ld\n", record_size,
ftell(mbfp) - mb_io_ptr->file_bytes, mb_io_ptr->file_bytes, ftell(mbfp));
if(mbfp != NULL)
fprintf(stderr, "record_size:%d bytes read:%ld file_pos old:%ld new:%ld\n", record_size, ftell(mbfp) - mb_io_ptr->file_bytes, mb_io_ptr->file_bytes, ftell(mbfp));
fprintf(stderr, "done:%d status:%d error:%d\n", done, status, *error);
fprintf(stderr, "end of mbr_em710raw_rd_data loop:\n\n");
#endif
Expand All @@ -4565,10 +4575,15 @@ store->pings[store->ping_index].png_ss_count);
#endif

/* get file position */
if (*label_save_flag)
mb_io_ptr->file_bytes = ftell(mbfp) - 2;
else
mb_io_ptr->file_bytes = ftell(mbfp);
if (*label_save_flag) {
if(mbfp != NULL) {
mb_io_ptr->file_bytes = ftell(mbfp) - 2;
}
} else {
if(mbfp != NULL){
mb_io_ptr->file_bytes = ftell(mbfp);
}
}
}

if (verbose >= 2) {
Expand Down
50 changes: 50 additions & 0 deletions src/mbio/mbsys_simrad3.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,56 @@
#define EM3_INVALID_U_INT 0xFFFFFFFF
#define EM3_INVALID_INT 0x7FFFFFFF

/* M3 datagram types */
#pragma pack(push,1)
struct mbsys_simrad3_header {
/* Definition of general datagram header */
unsigned int numBytesDgm; /* Datagram length in bytes.
* The length field at the start (4 bytes) and end of the datagram (4 bytes)
* are included in the length count. */
mb_u_char dgmSTX; /* start ID e.g. 0x02 */
mb_u_char dgmType; /* datagram type definition, e.g.
Installation (I or i) or r (Remote information): Start = 049h Stop = 069h Remote info = 070h Runtime (R): 052h
Raw range and beam angle 78 (N): 04eh
XYZ88 (X): 058h, or 88d Clock (C): 043h
Attitude (A): 041h
Position (P): 050h
Surface sound speed (G): 047h
*/
unsigned short emModeNum; /* EM model number For M3, use 30. For M3 dual head, use 30D */
unsigned int date; /* Date (in binary format) = year*10000+Month*100+day (example: April 26, 2016 = 20160426) */
unsigned int timeMs; /* Time since midnight in milliseconds */
unsigned short counter; /* Sequential counter associated with each datagram. In M3, it
is the ping sequential counter associated with data. Only
exception is the counter in the installation datagram, where
the counter starts from 0 and increases by 1 whenever a new
installation datagram is received. */
unsigned short sysSerialNum; /* System serial number. Set it to the lower two bytes of the first M3 head sonar info.*/
unsigned short secHeadSerialNum; /* Secondary system serial number and only used by Installation parameter. Set it to the lower two bytes of the second M3 sonar info. Currently it is always 0. */
};

struct mbsys_simrad3_footer {
mb_u_char dgmETX; /*End identifier, always 03h*/
unsigned short checksum; /*Sum of bytes between STX and ETX*/
};
#pragma pack(pop)

// Enumerate EM datagram types
typedef enum {
/* unknown datagram */
ALL_UNKNOWN = 0,
ALL_INSTALLATION_U = 'I',
ALL_INSTALLATION_L = 'i',
ALL_REMOTE = 'r',
ALL_RUNTIME = 'R',
ALL_RAW_RANGE_BEAM_ANGLE = 'N',
ALL_XYZ88 = 'X',
ALL_CLOCK = 'C',
ALL_ATTITUDE = 'A',
ALL_POSITION = 'P',
ALL_SURFACE_SOUND_SPEED = 'G'
} mbsys_simrad3_emdgm_type;

/* internal data structure for survey data */
struct mbsys_simrad3_ping_struct {
int read_status; /* read status for this structure:
Expand Down
18 changes: 17 additions & 1 deletion src/mbtrn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
#. mb1-cli
#
message("In src/mbtrn")

if(CMAKE_SYSTEM_NAME STREQUAL Linux)
find_package(TIRPC REQUIRED)
else()
add_library(TIRPC::TIRPC INTERFACE IMPORTED)
endif()

add_compile_definitions(
HAVE_CONFIG_H
_GNU_SOURCE
Expand Down Expand Up @@ -170,8 +177,17 @@ target_link_libraries(mb1-cli PRIVATE mbtrnframe mb1r mb1 m pthread)
#
#------------------------------------------------------------------------------
#
add_executable(emallpub utils/emallpub.c)
target_include_directories(emallpub PRIVATE ${CMAKE_SOURCE_DIR}/src/mbtrnframe
${CMAKE_SOURCE_DIR}/src/mbio
${CMAKE_SOURCE_DIR}/src/mbtrnutils)
target_link_libraries(emallpub PRIVATE TIRPC::TIRPC mbtrnframe m pthread)
#
#------------------------------------------------------------------------------
#
install(TARGETS r7kr mb1r DESTINATION ${CMAKE_INSTALL_LIBDIR})
#
install(TARGETS udps udpc mbtnav_cli stream7k emu7k r7kr_test trnc tbinx mb1conv mb12csv mb1r_test mb1-cli DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS udps udpc mbtnav_cli stream7k emu7k r7kr_test trnc tbinx mb1conv mb12csv mb1r_test mb1-cli emallpub DESTINATION ${CMAKE_INSTALL_BINDIR})
#
#------------------------------------------------------------------------------
#
Loading

0 comments on commit 317037f

Please sign in to comment.