Files
openairinterface5g/common/utils/websrv/websrv_noforms.c
T
Robert Schmidt 8107939f08 Change OAI license to CSSL v1.0 (and others)
- all RAN code, CI code, configuration files, dockerfiles, in CSSL v1.0
- all deployment code (openshift, charts, ancillary files like shell
  scripts), in MIT
- documentation in CC-BY-4.0
- exceptions might apply and are listed in NOTICE
- there is a new LICENSES folder with all licenses
- CONTRIBUTIONS.md has been updated accordingly

For automated changes based on OAI PL v1.1:

    perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.{c,h,cpp}
    perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.ts
    perl -i~ -0pe 's/<!--.*Licensed to the OpenAirInterface.*openairinterface.org\n.*-->/<!-- SPDX-License-Identifier: LicenseRef-CSSL-1.0 -->/s' **/*.xml

The rest (cmake, files with missing license, cmake) manually.
2026-03-27 16:36:37 +01:00

94 lines
2.7 KiB
C

/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
/*!
* \brief: primitives replacing xforms when compiling nr_phy_scope.c for the webserver shared lib
*/
#include <stdlib.h>
#include <jansson.h>
#include <ulfius.h>
#include "common/utils/LOG/log.h"
#include "common/utils/websrv/websrv.h"
#include "common/utils/websrv/websrv_noforms.h"
#include <common/utils/assertions.h>
#define MAX_LAYER 8
/* replacement for xforms function used in xforms softscope */
typedef struct {
websrv_scopedata_msg_t *buf;
} websrv_scopedata_layermsgs_t;
typedef struct {
char *title; /* overall title */
websrv_scopedata_layermsgs_t buff[MAX_LAYER]; /* buff per layer */
int n[MAX_LAYER]; /* total points */
} FLI_XYPLOT_SPEC;
FL_OBJECT *websrv_fl_add_xyplot(int t, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label)
{
FL_OBJECT *obj;
obj = (FL_OBJECT *)calloc(1, sizeof(FL_OBJECT));
AssertFatal((obj != NULL), "Cannot allocate scope object for %s\n", (label!=NULL)?label:"??");
if (obj) {
obj->spec = (FLI_XYPLOT_SPEC *)calloc(1, sizeof(FLI_XYPLOT_SPEC));
AssertFatal((obj->spec != NULL), "Cannot allocate scope object buffers for %s\n",(label!=NULL)?label:"??");
FLI_XYPLOT_SPEC *spec = (FLI_XYPLOT_SPEC *)obj->spec;
for (int j = 0; j < MAX_LAYER; j++) {
spec->buff[j].buf = (websrv_scopedata_msg_t *)calloc(1, sizeof(websrv_scopedata_msg_t));
}
obj->objclass = FL_XYPLOT;
obj->type = t;
obj->x = x;
obj->y = y;
obj->w = w;
obj->h = h;
if (label)
obj->label = strdup(label);
LOG_I(UTIL, "[websrv], scope object for \"%s\" allocated obj at %p spec at %p\n", label, obj, obj->spec);
}
return obj;
};
void websrv_free_xyplot(FL_OBJECT *obj)
{
FLI_XYPLOT_SPEC *spec = (FLI_XYPLOT_SPEC *)obj->spec;
for (int j = 0; j < MAX_LAYER; j++) {
free(spec->buff[j].buf);
}
free(obj->label);
free(spec);
free(obj);
};
FL_OBJECT *websrv_fl_add_canvas(int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label)
{
return websrv_fl_add_xyplot(type, x, y, w, h, label);
}
void websrv_fl_get_xyplot_data(FL_OBJECT *ob, float *x, float *y, int *n)
{
FLI_XYPLOT_SPEC *spec = (FLI_XYPLOT_SPEC *)(ob->spec);
*n = spec->n[0];
};
void websrv_fl_get_xyplot_data_pointer(FL_OBJECT *ob, int id, float **x, float **y, int *n)
{
FLI_XYPLOT_SPEC *spec = (FLI_XYPLOT_SPEC *)(ob->spec);
*n = spec->n[id];
};
/*----------------------------------------------------------------------*/
/* new functions for interfacing with webserver */
int websrv_nf_getdata(FL_OBJECT *graph, int layer, websrv_scopedata_msg_t **msg)
{
FLI_XYPLOT_SPEC *spec = (FLI_XYPLOT_SPEC *)(graph->spec);
*msg = spec->buff[layer].buf;
return spec->n[layer];
}