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-08
Revision:
81:a869abf56e85
Parent:
80:6e3eb8246ced
Child:
89:f63e4736d875
Child:
90:d0805b58b0ae

File content as of revision 81:a869abf56e85:

#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 erase_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[]);
int write_medInventory(s_medInventory medInventory);

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

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

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

/*  Read inventory protocol from sd card to struct s_medInventory
*/
s_medInventory read_medInventory();

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