diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-09-09 11:58:16 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-09-09 11:58:16 +0300 |
| commit | adb75c06d7d75a6ebfaadab3c17c5b8296fd485d (patch) | |
| tree | 67bcade177ad9f05349af468594ec21df86c4cd6 /Software/Embedded_SW/Embedded/Common/Utilities | |
| parent | 738bebec92cfcec046821fe994f3a168df870978 (diff) | |
| download | Tango-adb75c06d7d75a6ebfaadab3c17c5b8296fd485d.tar.gz Tango-adb75c06d7d75a6ebfaadab3c17c5b8296fd485d.zip | |
USE BOTH HEATERS IN DRYER! machine calibration data. rfid tag content PPC<==>RFID transfer.
Diffstat (limited to 'Software/Embedded_SW/Embedded/Common/Utilities')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c | 207 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Common/Utilities/RfidTagContent.h | 51 |
2 files changed, 258 insertions, 0 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c b/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c new file mode 100644 index 000000000..17dc62bfd --- /dev/null +++ b/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c @@ -0,0 +1,207 @@ +/* + * RFIDTagHandling.c + * + * Created on: Sep 8, 2019 + * Author: shlomo + */ +#include "include.h" + +#include "Modules/Waste/Waste.h" +#include "Modules/IFS/ifs.h" +#include "Modules/AlarmHandling/AlarmHandling.h" +#include "CartridgeValidationRequest.pb-c.h" +#include "CartridgeValidationResponse.pb-c.h" +#include <PMR/Diagnostics/EventType.pb-c.h> +#include <Utilities/RfidTagContent.h> +#include "drivers/Valves/Valve.h" +#include "Modules/Waste/Waste.h" +#include "CartridgeSlot.pb-c.h" +#include "CartridgeTagContent.pb-c.h" +#include "Cartridge.pb-c.h" + +/* + typedef struct +{ + uint32_t UniqueId; + char SerialNumber[16]; + char FactoryId[3]; + int32_t FillingSystemId; + char ColorName[12]; + int32_t ColorCategory; + int32_t ColorTypeRevision; + int32_t CartridgeSize; + int32_t FilledInkVolume; + char InkBatchNum[10]; + char InkMFGDate[6]; + char InkEOLDate[6]; + char CartridgeFillingDate[6]; + char WasteFilledDate[6]; + int32_t PlugInCounter; + bool Inkfill; + bool InkUsed; + bool InkEmpty; + bool WasteEmpty; + bool WasteFilling; + bool WasteFull; + bool Blocked; + bool Fail; + int32_t WasteCounter; + char MachineIdInkUsed[16]; + char MachineIdWasteUsed[16]; +}RfidTagContent; + struct _CartridgeTagContent +{ + ProtobufCMessage base; + protobuf_c_boolean has_uniqueid; + uint32_t uniqueid; + char *serialnumber; + char *factoryid; + protobuf_c_boolean has_fillingsystemid; + int32_t fillingsystemid; + char *colorname; + protobuf_c_boolean has_colorcategory; + int32_t colorcategory; + protobuf_c_boolean has_colortyperevision; + int32_t colortyperevision; + protobuf_c_boolean has_cartridgesize; + int32_t cartridgesize; + protobuf_c_boolean has_filledinkvolume; + int32_t filledinkvolume; + char *inkbatchnum; + char *inkmfgdate; + char *inkeoldate; + char *cartridgefillingdate; + char *wastefilleddate; + protobuf_c_boolean has_plugincounter; + int32_t plugincounter; + protobuf_c_boolean has_inkfill; + protobuf_c_boolean inkfill; + protobuf_c_boolean has_inkused; + protobuf_c_boolean inkused; + protobuf_c_boolean has_inkempty; + protobuf_c_boolean inkempty; + protobuf_c_boolean has_wasteempty; + protobuf_c_boolean wasteempty; + protobuf_c_boolean has_wastefilling; + protobuf_c_boolean wastefilling; + protobuf_c_boolean has_wastefull; + protobuf_c_boolean wastefull; + protobuf_c_boolean has_blocked; + protobuf_c_boolean blocked; + protobuf_c_boolean has_fail; + protobuf_c_boolean fail; + protobuf_c_boolean has_wastecounter; + int32_t wastecounter; + char *machineidinkused; + char *machineidwasteused; +}; + */ +CartridgeTagContent * RFID_Tag2PPC(RfidTagContent *Tag) +{ + CartridgeTagContent *PpcTag = my_malloc(sizeof(CartridgeTagContent)); + + if (PpcTag == NULL) + return NULL; + + + cartridge_Tag_content__init(PpcTag); + PpcTag->has_uniqueid = true; + PpcTag->uniqueid = Tag->uniqueid; + PpcTag->serialnumber = Tag->serialnumber; + PpcTag->factoryid = Tag->factoryid; + + PpcTag->has_fillingsystemid = true; + PpcTag->fillingsystemid = Tag->fillingsystemid; + PpcTag->colorname = Tag->colorname; + PpcTag->has_colorcategory = true; + PpcTag->colorcategory = Tag->colorcategory; + PpcTag->has_colortyperevision = true; + PpcTag->colortyperevision = Tag->colortyperevision; + PpcTag->has_cartridgesize = true; + PpcTag->cartridgesize = Tag->cartridgesize; + PpcTag->has_filledinkvolume = true; + PpcTag->filledinkvolume = Tag->filledinkvolume; + PpcTag->inkbatchnum = Tag->inkbatchnum; + PpcTag->inkmfgdate = Tag->inkmfgdate; + PpcTag->inkeoldate = Tag->inkeoldate; + PpcTag->cartridgefillingdate = Tag->cartridgefillingdate; + PpcTag->wastefilleddate = Tag->wastefilleddate; + PpcTag->has_plugincounter = true; + PpcTag->plugincounter = Tag->plugincounter; + PpcTag->has_inkfill = true; + PpcTag->inkfill = Tag->inkfill; + PpcTag->has_inkused = true; + PpcTag->inkused = Tag->inkused; + PpcTag->has_inkempty = true; + PpcTag->inkempty = Tag->inkempty; + PpcTag->has_wasteempty = true; + PpcTag->wasteempty = Tag->wasteempty; + PpcTag->has_wastefilling; + PpcTag->wastefilling = Tag->wastefilling; + PpcTag->has_wastefull = true; + PpcTag->wastefull = Tag->wastefull; + PpcTag->has_blocked = true; + PpcTag->blocked = Tag->blocked; + PpcTag->has_fail = true; + PpcTag->fail = Tag->fail; + PpcTag->has_wastecounter = true; + PpcTag->wastecounter = Tag->wastecounter; + PpcTag->machineidinkused = Tag->machineidinkused; + PpcTag->machineidwasteused = Tag->machineidwasteused; + + return PpcTag; +} +RfidTagContent * RFID_PPC2Tag( CartridgeTagContent *PpcTag) +{ + RfidTagContent *Tag = my_malloc(sizeof(RfidTagContent)); + if (Tag == NULL) + return NULL; + memset (Tag,0,sizeof(Tag)); + + if (PpcTag->has_uniqueid == true) + Tag->uniqueid = PpcTag->uniqueid; + memcpy(Tag->serialnumber , PpcTag->serialnumber,sizeof(Tag->serialnumber)); + memcpy(Tag->factoryid , PpcTag->factoryid,sizeof(Tag->factoryid)); + + if (PpcTag->has_fillingsystemid == true) + Tag->fillingsystemid = PpcTag->fillingsystemid; + memcpy(Tag->colorname , PpcTag->colorname,sizeof(Tag->colorname)); + if (PpcTag->has_colorcategory == true) + Tag->colorcategory = PpcTag->colorcategory; + if (PpcTag->has_colortyperevision == true) + Tag->colortyperevision = PpcTag->colortyperevision; + if (PpcTag->has_cartridgesize == true) + Tag->cartridgesize = PpcTag->cartridgesize; + if (PpcTag->has_filledinkvolume == true) + Tag->filledinkvolume = PpcTag->filledinkvolume; + memcpy(Tag->inkbatchnum , PpcTag->inkbatchnum,sizeof(Tag->inkbatchnum)); + memcpy(Tag->inkmfgdate , PpcTag->inkmfgdate,sizeof(Tag->inkmfgdate)); + memcpy(Tag->inkeoldate , PpcTag->inkeoldate,sizeof(Tag->inkeoldate)); + memcpy(Tag->cartridgefillingdate , PpcTag->cartridgefillingdate,sizeof(Tag->cartridgefillingdate)); + memcpy(Tag->wastefilleddate , PpcTag->wastefilleddate,sizeof(Tag->wastefilleddate)); + if (PpcTag->has_plugincounter == true) + Tag->plugincounter = PpcTag->plugincounter; + if (PpcTag->has_inkfill == true) + Tag->inkfill = PpcTag->inkfill; + if (PpcTag->has_inkused == true) + Tag->inkused = PpcTag->inkused; + if (PpcTag->has_inkempty == true) + Tag->inkempty = PpcTag->inkempty; + if (PpcTag->has_wasteempty == true) + Tag->wasteempty = PpcTag->wasteempty; + if (PpcTag->has_wastefilling == true) + Tag->wastefilling = PpcTag->wastefilling; + if (PpcTag->has_wastefull == true) + Tag->wastefull = PpcTag->wastefull; + if (PpcTag->has_blocked == true) + Tag->blocked = PpcTag->blocked; + if (PpcTag->has_fail == true) + Tag->fail = PpcTag->fail; + if (PpcTag->has_wastecounter == true) + Tag->wastecounter = PpcTag->wastecounter; + memcpy(Tag->machineidinkused , PpcTag->machineidinkused,sizeof(Tag->machineidinkused)); + memcpy(Tag->machineidwasteused , PpcTag->machineidwasteused,sizeof(Tag->machineidwasteused)); + + return Tag; + +} diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/RfidTagContent.h b/Software/Embedded_SW/Embedded/Common/Utilities/RfidTagContent.h new file mode 100644 index 000000000..e94392e49 --- /dev/null +++ b/Software/Embedded_SW/Embedded/Common/Utilities/RfidTagContent.h @@ -0,0 +1,51 @@ +/* + * RfidTagContent.h + * + * Created on: Jul 8, 2019 + * Author: shlomo + */ + +#ifndef MODULES_IFS_RFIDTAGCONTENT_H_ +#define MODULES_IFS_RFIDTAGCONTENT_H_ + +#include "PMR/Diagnostics/CartridgeSlot.pb-c.h" +#include "PMR/Diagnostics/CartridgeTagContent.pb-c.h" + +#include <DataDef.h> +#include "include.h" + + +#define MAX_CARTRIDGES (CARTRIDGE_SLOT__WasteLower+1) +typedef struct +{ + uint32_t uniqueid; + char serialnumber[16]; + char factoryid[3]; + int32_t fillingsystemid; + char colorname[12]; + int32_t colorcategory; + int32_t colortyperevision; + int32_t cartridgesize; + int32_t filledinkvolume; + char inkbatchnum[10]; + char inkmfgdate[6]; + char inkeoldate[6]; + char cartridgefillingdate[6]; + char wastefilleddate[6]; + int32_t plugincounter; + bool inkfill; + bool inkused; + bool inkempty; + bool wasteempty; + bool wastefilling; + bool wastefull; + bool blocked; + bool fail; + int32_t wastecounter; + char machineidinkused[16]; + char machineidwasteused[16]; +}RfidTagContent; + + + +#endif /* MODULES_IFS_RFIDTAGCONTENT_H_ */ |
