RocketLogger  1.1.5
web.h File Reference
#include <stdint.h>
#include "log.h"
#include "types.h"
#include "util.h"
+ Include dependency graph for web.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ringbuffer
 
struct  web_shm
 

Macros

#define WEB_RING_BUFFER_COUNT   3
 Number of ring buffers in shared memory. More...
 
#define BUF1_INDEX   0
 Index of 1s/div buffer. More...
 
#define BUF10_INDEX   1
 Index of 10s/div buffer. More...
 
#define BUF100_INDEX   2
 Index of 100s/div buffer. More...
 
#define BUFFER1_SIZE   100
 Size of 1s/div buffer. More...
 
#define BUFFER10_SIZE   10
 Size of 10s/div buffer. More...
 
#define BUFFER100_SIZE   1
 Size of 100s/div buffer. More...
 
#define NUM_WEB_CHANNELS   12
 Maximum number of channels in web interface (6 analog + 6 digital) More...
 
#define NUM_WEB_POINTS   1000
 Number of data points in web plot. More...
 
#define NUM_WEB_DIVS   10
 Number of time divisions in web plot. More...
 
#define H_L_SCALE   100
 Current high-low scale difference. More...
 

Enumerations

enum  time_scale { S1 = 0, S10 = 1, S100 = 2 }
 

Functions

struct web_shmweb_create_shm (void)
 
struct web_shmweb_open_shm (void)
 
void web_buffer_reset (struct ringbuffer *buffer, int element_size, int length)
 
void web_buffer_add (struct ringbuffer *buffer, int64_t *data)
 
int64_t * web_buffer_get (struct ringbuffer *buffer, int num)
 
void web_handle_data (struct web_shm *web_data_ptr, int sem_id, void *buffer_addr, uint32_t sample_data_size, uint32_t samples_count, struct time_stamp *timestamp_realtime, struct rl_conf *conf)
 

Macro Definition Documentation

#define BUF100_INDEX   2

Index of 100s/div buffer.

Definition at line 48 of file web.h.

Referenced by web_handle_data().

#define BUF10_INDEX   1

Index of 10s/div buffer.

Definition at line 46 of file web.h.

Referenced by web_handle_data().

#define BUF1_INDEX   0

Index of 1s/div buffer.

Definition at line 44 of file web.h.

Referenced by web_handle_data().

#define BUFFER100_SIZE   1

Size of 100s/div buffer.

Definition at line 64 of file web.h.

Referenced by pru_sample(), and web_handle_data().

#define BUFFER10_SIZE   10

Size of 10s/div buffer.

Definition at line 62 of file web.h.

Referenced by pru_sample(), and web_handle_data().

#define BUFFER1_SIZE   100

Size of 1s/div buffer.

Definition at line 60 of file web.h.

Referenced by pru_sample(), and web_handle_data().

#define H_L_SCALE   100

Current high-low scale difference.

Definition at line 74 of file web.h.

Referenced by web_merge_currents().

#define NUM_WEB_CHANNELS   12

Maximum number of channels in web interface (6 analog + 6 digital)

Definition at line 67 of file web.h.

#define NUM_WEB_DIVS   10

Number of time divisions in web plot.

Definition at line 71 of file web.h.

#define NUM_WEB_POINTS   1000

Number of data points in web plot.

Definition at line 69 of file web.h.

Referenced by pru_sample().

#define WEB_RING_BUFFER_COUNT   3

Number of ring buffers in shared memory.

Copyright (c) 2016-2019, Swiss Federal Institute of Technology (ETH Zurich) All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition at line 42 of file web.h.

Referenced by pru_sample(), and web_handle_data().

Enumeration Type Documentation

enum time_scale

RocketLogger time scale definition

Enumerator
S1 

100 sample/s

S10 

10 samples/s

S100 

1 samples/s

Definition at line 53 of file web.h.

Function Documentation

void web_buffer_add ( struct ringbuffer buffer,
int64_t *  data 
)

Add element to ring buffer

Parameters
bufferPointer to ring buffer
dataPointer to data array to add

Definition at line 113 of file web.c.

References ringbuffer::data, ringbuffer::element_size, ringbuffer::filled, ringbuffer::head, and ringbuffer::length.

Referenced by web_handle_data().

int64_t* web_buffer_get ( struct ringbuffer buffer,
int  num 
)

Get pointer to a specific element of a ringbuffer

Parameters
bufferPointer to ring buffer
numElement number (0 corresponds to the newest element)
Returns
pointer to desired element

Definition at line 129 of file web.c.

References ringbuffer::data, ringbuffer::element_size, ringbuffer::head, and ringbuffer::length.

Referenced by print_data().

void web_buffer_reset ( struct ringbuffer buffer,
int  element_size,
int  length 
)

Reset web data ring buffer

Parameters
bufferPointer to ring buffer to reset
element_sizeDesired element size in bytes
lengthBuffer length in elements

Definition at line 101 of file web.c.

References ringbuffer::element_size, ringbuffer::filled, ringbuffer::head, and ringbuffer::length.

Referenced by pru_sample().

struct web_shm* web_create_shm ( void  )

Copyright (c) 2016-2019, Swiss Federal Institute of Technology (ETH Zurich) All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Create shared memory for data exchange with web server

Returns
pointer to shared memory, NULL in case of failure

Definition at line 47 of file web.c.

References ERROR, rl_log(), SHMEM_DATA_KEY, SHMEM_PERMISSIONS, and web_data.

Referenced by pru_sample().

+ Here is the call graph for this function:

void web_handle_data ( struct web_shm web_data_ptr,
int  sem_id,
void *  buffer_addr,
uint32_t  sample_data_size,
uint32_t  samples_count,
struct time_stamp timestamp_realtime,
struct rl_conf conf 
)

Process the data buffer for the web interface

Parameters
web_data_ptrPointer to shared web data
sem_idID of semaphores for shared web data
buffer_addrPointer to buffer to handle
sample_data_sizeSize of samples to read
samples_countNumber of samples to read
timestamp_realtimetime_stamp with realtime clock value
confCurrent rl_conf configuration.

Definition at line 201 of file web.c.

References BINARY_MASK, BUF100_INDEX, BUF10_INDEX, BUF1_INDEX, web_shm::buffer, BUFFER100_SIZE, BUFFER10_SIZE, BUFFER1_SIZE, calibration, CHANNEL_ENABLED, rl_conf::channels, count_channels(), DATA_SEM, rl_conf::digital_inputs, DIGITAL_INPUTS_ENABLED, rl_conf::enable_web_server, I1L_INDEX, I2L_INDEX, time_stamp::nsec, num_channels, web_shm::num_channels, NUM_CHANNELS, NUM_DIGITAL_INPUTS, NUM_I_CHANNELS, rl_calibration::offsets, PRU_DIG_SIZE, rl_log(), RL_RUNNING, rl_calibration::scales, time_stamp::sec, SEM_WRITE_TIME_OUT, set_sem(), rl_status::state, status, web_shm::time, TIME_OUT, VALID_MASK, wait_sem(), WARNING, web_buffer_add(), web_data, web_merge_currents(), and WEB_RING_BUFFER_COUNT.

Referenced by pru_sample().

+ Here is the call graph for this function:

struct web_shm* web_open_shm ( void  )

Open existing shared memory for data exchange with web server

Returns
pointer to shared memory, NULL in case of failure

Definition at line 73 of file web.c.

References ERROR, rl_log(), SHMEM_DATA_KEY, SHMEM_PERMISSIONS, and web_data.

Referenced by main().

+ Here is the call graph for this function: