#include "log.h"
#include "serial.h"
#include "probecoms.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/time.h>
#include <time.h>
Functions | |
int | check_id (int id) |
Check that a probe id is within accepted ranges. | |
void | date_string (unsigned char *str) |
helpful function to make a date prefix for files | |
int | dec2bcd (int dec) |
convert from decimal to BCD for dates etc. | |
void | printPacket (glacsweb_packet *tempPacket) |
This function prints contents of a glacsweb packet to the standard output. | |
void | set_packet (unsigned char size, unsigned char id, unsigned char cmd, unsigned char data[16], glacsweb_packet *tempPacket) |
This function sets the contents of a glacsweb_packet. | |
void | send_packet (glacsweb_packet *p, SerialPort *sp) |
This function sends a packet over the serial port. | |
int | send_packet_wait_reply (glacsweb_packet *TxPacket, glacsweb_packet *RxPacket, SerialPort *sp, unsigned char retries) |
This function sends a packet and waits for a reply packet. | |
int | receive_packet (glacsweb_packet *RxPacket, SerialPort *sp) |
This function is responsible for receiving packet. | |
void | probe_rtc_set_alarm (unsigned char id, int min, int hour, int date, SerialPort *sp) |
send a command to set the alarm on a probe. | |
void | probe_rtc_get_alarm (unsigned char id, int *min, int *hour, int *date, SerialPort *sp) |
send a command to get the alarm of a probe. | |
void | probe_sys_sleep (unsigned char id, SerialPort *sp) |
This is a wrapper function to put probe to sleep. | |
void | probe_sys_loadparams (unsigned char id, SerialPort *sp) |
this is used to get it to reload settings into ram from eeprom locations. | |
int | probe_eeprom_read16 (unsigned char id, int address, glacsweb_packet *rxpkt, SerialPort *sp) |
This function reads 16 bytes from the probe's external eeprom (where sensor data is!). | |
int | probe_sys_eeprom_read (int id, unsigned char address, SerialPort *sp) |
This function reads an eeprom location in a probe. | |
int | probe_sys_eeprom_write (int id, unsigned char address, unsigned char value, SerialPort *sp) |
This function writes to an eeprom location in a probe. | |
int | probe_get_params (unsigned char id, int *ee_rd, int *ee_wr, SerialPort *sp) |
probe_get_params - gets the main parameters mainly used to read sensor data We should log the other data with an id and timestamp to logfile!! returns 0 on success, otherwise -1 | |
void | broadcast_sys_eeprom_write (unsigned char address, unsigned char value, unsigned int delay, unsigned char retries, SerialPort *sp) |
This function sends a broadcast command to all the probes to write to a particular location in the sys_eeprom. | |
void | broadcast_sys_load_params (unsigned int delay, unsigned char retries, SerialPort *sp) |
This function sends a broadcast command to all the probes to load system variable with eeprom values in the RAM location. | |
void | broadcast_rtc_set_time (unsigned int delay, unsigned char retries, SerialPort *sp) |
This function sends a broadcast command to all the probes to set RTC time to match time on BITSY. | |
void | broadcast_rtc_set_date (unsigned int delay, unsigned char retries, SerialPort *sp) |
This function sends a broadcast command to all the probes to set RTC date to match date on BITSY. | |
void | broadcast_rtc_set_alarm (int min, int hour, int date, unsigned int delay, unsigned char retries, SerialPort *sp) |
This function sends a broadcast command to all the probes to set RTC alarm. | |
int | probe_get_batvolts (unsigned char id, float *value, SerialPort *sp) |
|
This function sends a broadcast command to all the probes to set RTC alarm.
|
|
This function sends a broadcast command to all the probes to set RTC date to match date on BITSY. The format of date is sent as day of week, day of month, month and year.
|
|
This function sends a broadcast command to all the probes to set RTC time to match time on BITSY.
|
|
This function sends a broadcast command to all the probes to write to a particular location in the sys_eeprom.
|
|
This function sends a broadcast command to all the probes to load system variable with eeprom values in the RAM location.
|
|
Check that a probe id is within accepted ranges.
|
|
helpful function to make a date prefix for files
|
|
convert from decimal to BCD for dates etc. eg 040801
|
|
This function prints contents of a glacsweb packet to the standard output.
|
|
This function reads 16 bytes from the probe's external eeprom (where sensor data is!).
|
|
send a command to get the alarm of a probe.
|
|
send a command to set the alarm on a probe.
|
|
This function reads an eeprom location in a probe.
|
|
This function writes to an eeprom location in a probe.
|
|
this is used to get it to reload settings into ram from eeprom locations. eg for setting 28 29 2a 2b to a millisecond sleep timeout |
|
This is a wrapper function to put probe to sleep.
|
|
This function is responsible for receiving packet.
|
|
This function sends a packet over the serial port. It only sends a packet and does not wait for a reply once the packet is sent. This function should be used for broadcast or INFO packets that do not expect a reply data from the probes.
|
|
This function sends a packet and waits for a reply packet. It makes use of the functions send_packet(glacsweb_packet *p, SerialPort *sp) to send and receive_packet(glacs_packet *RxPacket, SerialPort *sp) to receive a reply. This function has a retry feature to it that enables re-transmission (sending and receiving) of the packet a specified number of times in case of failure.
|
|
This function sets the contents of a glacsweb_packet.
|