Skip to content

Commit c76032d

Browse files
committed
test: allow to test Chunk selectors
1 parent a33dcaf commit c76032d

2 files changed

Lines changed: 44 additions & 15 deletions

File tree

src/arv-test.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ SoftwareTriggerDelay=1.0
211211
# GigEVision write_memory error (busy)
212212
SoftwareTriggerWait=0.2
213213
ChunksDelay=1.0
214-
ChunkList=Timestamp
214+
ChunkList=Scan3dCoordinateReferenceValue
215+
ChunkSelector=ChunkScan3dCoordinateReferenceSelector TranslationZ TranslationX RotationZ RotationX
215216

216217
[Smartek:GC651M]
217218

src/arvtest.c

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ _single_acquisition (ArvTest *test, const char *test_name, ArvTestCamera *test_c
496496
GError *error = NULL;
497497
ArvBuffer *buffer = NULL;
498498
char **chunk_list = NULL;
499+
char **chunk_selector_list = NULL;
499500
ArvChunkParser *parser = NULL;
500501
char *component = NULL;
501502
guint n_parts = 1;
@@ -547,6 +548,7 @@ _single_acquisition (ArvTest *test, const char *test_name, ArvTestCamera *test_c
547548

548549
if (chunk_test) {
549550
char *chunks;
551+
char *chunk_selector;
550552
gboolean chunks_support = arv_test_camera_get_key_file_boolean (test_camera, test,
551553
"ChunksSupport", TRUE);
552554
n_parts = arv_test_camera_get_key_file_int64 (test_camera, test,
@@ -564,11 +566,16 @@ _single_acquisition (ArvTest *test, const char *test_name, ArvTestCamera *test_c
564566
chunks = arv_test_camera_get_key_file_string (test_camera, test, "ChunkList", "OffsetX OffsetY");
565567
chunk_list = g_strsplit_set (chunks, " ", -1);
566568

569+
chunk_selector = arv_test_camera_get_key_file_string(test_camera, test,
570+
"ChunkSelector", "Ignore Ignore");
571+
chunk_selector_list = g_strsplit_set(chunk_selector, " ", -1);
572+
567573
parser = arv_camera_create_chunk_parser (test_camera->camera);
568574

569575
arv_camera_set_chunks (test_camera->camera, chunks, &error);
570576

571577
g_free (chunks);
578+
g_free (chunk_selector);
572579
}
573580

574581
if (error == NULL)
@@ -586,23 +593,44 @@ _single_acquisition (ArvTest *test, const char *test_name, ArvTestCamera *test_c
586593
arv_buffer_get_n_parts(buffer), n_parts);
587594
}
588595

589-
if (error == NULL && chunk_test) {
590-
int n_chunks = g_strv_length (chunk_list);
591-
int i;
592-
593-
if (arv_buffer_has_chunks(buffer)) {
594-
for (i = 0; i < n_chunks && error == NULL; i++) {
595-
char *chunk_name = g_strdup_printf ("Chunk%s", chunk_list[i]);
596-
arv_chunk_parser_get_integer_value (parser, buffer, chunk_name, &error);
597-
g_clear_pointer (&chunk_name, g_free);
596+
if (chunk_test) {
597+
if (error == NULL) {
598+
int n_chunks = g_strv_length (chunk_list);
599+
int n_elements = g_strv_length (chunk_selector_list) - 1;
600+
int i, j;
601+
602+
if (arv_buffer_has_chunks(buffer)) {
603+
for (i = 0; i < n_chunks && error == NULL; i++) {
604+
char *chunk_name = g_strdup_printf ("Chunk%s", chunk_list[i]);
605+
for (j = 0; j < n_elements && error == NULL; j++) {
606+
if (g_strcmp0 (chunk_selector_list[0], "Ignore") != 0) {
607+
arv_chunk_parser_set_string_feature_value
608+
(parser,
609+
chunk_selector_list[0],
610+
chunk_selector_list[j+1],
611+
&error);
612+
}
613+
if (error == NULL) {
614+
arv_chunk_parser_get_integer_value (parser, buffer,
615+
chunk_name, &error);
616+
if (error != NULL) {
617+
g_clear_error (&error);
618+
arv_chunk_parser_get_float_value (parser, buffer,
619+
chunk_name, &error);
620+
}
621+
}
622+
}
623+
g_clear_pointer (&chunk_name, g_free);
624+
}
625+
} else {
626+
g_set_error (&error, ARV_DEVICE_ERROR, ARV_DEVICE_ERROR_TRANSFER_ERROR,
627+
"No chunk found in buffer");
598628
}
599-
} else {
600-
g_set_error (&error, ARV_DEVICE_ERROR, ARV_DEVICE_ERROR_TRANSFER_ERROR,
601-
"No chunk found in buffer");
602-
}
603629

604-
g_clear_object (&parser);
630+
g_clear_object (&parser);
631+
}
605632
g_strfreev (chunk_list);
633+
g_strfreev (chunk_selector_list);
606634
}
607635

608636
if (chunk_test)

0 commit comments

Comments
 (0)