PES 4 - Smart Medication Dispenser / PES4_ProgrammeforDesignReview2

Dependencies:   SDFileSystem mbed

Fork of PES4_Programme by PES 4 - Smart Medication Dispenser

header/sdcard.h

Committer:
itslinear
Date:
2018-04-05
Revision:
66:0d43bd7ed179
Parent:
65:49eb0934f772
Child:
73:7fd3701def5b

File content as of revision 66:0d43bd7ed179:

#pragma once
#include "SDFileSystem.h"
#include "mbed.h"
#include "variables.h"

#define STR_LEN   32
#define TOKEN ";"

void writeTest();
void readTest();
void testSd();

s_user readMedication(int user);
int writeMedication(int user,s_user userfile); 


/*  Write medication protocol to sd card
*   @param: user -> 0 or 1
*   @param: s_time medicationTime -> planned time
*   @param: s_time outputTime -> current time
*   @param: s_medContainer -> number of each pill
*   @param: success -> output=1 / no-output=0
*/
int write_medProtocol(s_time medicationTime, s_time outputTime, s_medContainer medication, int success, char user);

/*  Delete medication protocol from sd card
*/
int delete_medProtocol();

/*  Write inventory protocol to sd card / Note first read_medInventory then ajust the numbers (stock - output) and then write them back to the protocol
*   @param: s_medContainer -> number of each pill in stock
*   @param: s_time -> current time
*   @param: char med1-med6 -> name of each pill
*/
int write_medInventory(s_medContainer medInventory, s_time currentTime, char med1[], char med2[], char med3[], char med4[], char med5[], char med6[]);

/*  Write occuring error to sd card protocol
*   @param: error -> string
*   @param: s_time -> current time
*/
int write_medError(char error[], s_time time);

/*  Delete error protocol from sd card
*/
int delete_medError();

/*  Read medication protocol from sd card
*   @param: user -> 0 or 1
*/
char read_medProtocol(char user);

/*  Read inventory protocol from sd card
*/
char read_medInventory();

/*  Read error protocol from sd card
*/
char read_medError();