- if (opt_pds) {
- if (srd_session_send(received_samples, (uint8_t*)filter_out,
- filter_out_len) != SRD_OK)
- sr_session_halt();
- } else {
- output_len = 0;
- if (o->format->data && packet->type == o->format->df_type)
- o->format->data(o, filter_out, filter_out_len, &output_buf, &output_len);
- if (output_len) {
- fwrite(output_buf, 1, output_len, outfile);
- g_free(output_buf);
+ case SR_DF_META_ANALOG:
+ g_message("cli: Received SR_DF_META_ANALOG");
+ meta_analog = packet->payload;
+ num_analog_probes = meta_analog->num_probes;
+ num_enabled_probes = 0;
+ for (i = 0; i < num_analog_probes; i++) {
+ probe = g_slist_nth_data(dev->probes, i);
+ if (probe->enabled)
+ analog_probelist[num_enabled_probes++] = probe->index;
+ }
+
+ outfile = stdout;
+ if (opt_output_file) {
+ if (default_output_format) {
+ /* output file is in session format, which means we'll
+ * dump everything in the datastore as it comes in,
+ * and save from there after the session. */
+ outfile = NULL;
+ ret = sr_datastore_new(unitsize, &(dev->datastore));
+ if (ret != SR_OK) {
+ printf("Failed to create datastore.\n");
+ exit(1);
+ }
+ } else {
+ /* saving to a file in whatever format was set
+ * with --format, so all we need is a filehandle */
+ outfile = g_fopen(opt_output_file, "wb");
+ }
+ }
+// if (opt_pds)
+// srd_session_start(num_enabled_probes, unitsize,
+// meta_logic->samplerate);
+ break;
+
+ case SR_DF_ANALOG:
+ analog = packet->payload;
+ g_message("cli: received SR_DF_ANALOG, %d samples", analog->num_samples);
+ if (analog->num_samples == 0)
+ break;
+
+ if (limit_samples && received_samples >= limit_samples)
+ break;
+
+ for (i = 0; i < analog->num_samples; i++) {
+ asample1 = analog->data[i * num_analog_probes];
+ asample2 = analog->data[i * num_analog_probes + 1];
+ printf("CH1 %f CH2 %f\n", asample1, asample2);
+// write(STDOUT_FILENO, &asample1, sizeof(float));