diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-10-06 21:22:51 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-10-06 21:22:51 +0300 |
| commit | 7f6a0eb88514f7f60a66bad3ecc1cb4cae0ed2ea (patch) | |
| tree | 4f5bbb52830922cd2be496024951b132663b5de3 /Software/Embedded_SW/Embedded/Common/Utilities | |
| parent | 5b6d9137b0a4efc2e035656caf3d0a3cba9f4d8b (diff) | |
| download | Tango-7f6a0eb88514f7f60a66bad3ecc1cb4cae0ed2ea.tar.gz Tango-7f6a0eb88514f7f60a66bad3ecc1cb4cae0ed2ea.zip | |
valves mitigatio trial, heaters max temperature handling. IDS pressure building control.loading fixed. bug in winder prepare fixed, RFID tag update in Protobuf
Diffstat (limited to 'Software/Embedded_SW/Embedded/Common/Utilities')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c | 238 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.h | 114 |
2 files changed, 129 insertions, 223 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c b/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c index b210d79fc..f6bc50a7e 100644 --- a/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c +++ b/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.c @@ -85,51 +85,62 @@ typedef struct uint32_t Checksum_CRC16:16; }NFCTag_t; - struct _CartridgeTagContent +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 *taguniqueid; + char *cartsn; + protobuf_c_boolean has_inkfactoryid; + uint32_t inkfactoryid; + protobuf_c_boolean has_fillsysid; + uint32_t fillsysid; + char *workorder; char *colorname; - protobuf_c_boolean has_colorcategory; - int32_t colorcategory; - protobuf_c_boolean has_colortyperevision; - int32_t colortyperevision; + protobuf_c_boolean has_inkcategory; + uint32_t inkcategory; + protobuf_c_boolean has_type_rev; + uint32_t type_rev; protobuf_c_boolean has_cartridgesize; - int32_t cartridgesize; - protobuf_c_boolean has_filledinkvolume; - int32_t filledinkvolume; - char *inkbatchnum; + uint32_t cartridgesize; + protobuf_c_boolean has_filedinkvol; + uint32_t filedinkvol; + char *inkbatchno; char *inkmfgdate; char *inkeoldate; - char *cartridgefillingdate; - char *wastefilleddate; + char *cartfilldate; + char *wastefilldate; + protobuf_c_boolean has_misc; + uint32_t misc; 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; + uint32_t plugincounter; + protobuf_c_boolean has_inkfillstatus; + protobuf_c_boolean inkfillstatus; + protobuf_c_boolean has_inkusedstatus; + protobuf_c_boolean inkusedstatus; + protobuf_c_boolean has_inkemptystatus; + protobuf_c_boolean inkemptystatus; + protobuf_c_boolean has_wasteemptystatus; + protobuf_c_boolean wasteemptystatus; + protobuf_c_boolean has_wastefillingstatus; + protobuf_c_boolean wastefillingstatus; + protobuf_c_boolean has_wastefullstatus; + protobuf_c_boolean wastefullstatus; 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; + uint32_t wastecounter; + char *machineidinl; + char *machineidwst; + char *spare; + protobuf_c_boolean has_counter; + uint32_t counter; + protobuf_c_boolean has_tagvalid; + protobuf_c_boolean tagvalid; + char *hashvalue; + protobuf_c_boolean has_checksum_crc16; + uint32_t checksum_crc16; }; */ CartridgeTagContent * NFCTag_Tag2PPC(NFCTag_t *Tag) @@ -141,50 +152,56 @@ CartridgeTagContent * NFCTag_Tag2PPC(NFCTag_t *Tag) cartridge_tag_content__init(PpcTag); - PpcTag->uniqueid = Tag->TagUniqueID; - PpcTag->serialnumber = Tag->CartSN; - PpcTag->has_factoryid = true; - PpcTag->factoryid = Tag->InkFactoryID; + strncpy(PpcTag->taguniqueid , Tag->TagUniqueID,sizeof(Tag->TagUniqueID)); + strncpy(PpcTag->cartsn , Tag->CartSN,sizeof(Tag->CartSN)); + strncpy(PpcTag->workorder , Tag->WorkOrder,sizeof(Tag->WorkOrder)); + strncpy(PpcTag->colorname , Tag->ColorName,sizeof(Tag->ColorName)); + strncpy(PpcTag->inkbatchno , Tag->InkBatchNo,sizeof(Tag->InkBatchNo)); + strncpy(PpcTag->inkmfgdate , Tag->InkMFGDate,sizeof(Tag->InkMFGDate)); + strncpy(PpcTag->inkeoldate , Tag->InkEOLDate,sizeof(Tag->InkEOLDate)); + strncpy(PpcTag->cartfilldate , Tag->CartFillDate,sizeof(Tag->CartFillDate)); + strncpy(PpcTag->wastefilldate , Tag->WasteFillDate,sizeof(Tag->WasteFillDate)); + strncpy(PpcTag->machineidinl , Tag->MachineIdINL,sizeof(Tag->MachineIdINL)); + strncpy(PpcTag->machineidwst , Tag->MachineIdWST,sizeof(Tag->MachineIdWST)); + strncpy(PpcTag->spare , Tag->Spare,sizeof(Tag->Spare)); + strncpy(PpcTag->hashvalue , Tag->HashValue,sizeof(Tag->HashValue)); - PpcTag->has_fillingsystemid = true; - PpcTag->fillingsystemid = Tag->FillSysID; - PpcTag->workorder = Tag->WorkOrder; - PpcTag->colorname = Tag->ColorName; - PpcTag->has_colorcategory = true; - PpcTag->colorcategory = Tag->InkCategory; - PpcTag->has_colortyperevision = true; - PpcTag->colortyperevision = Tag->Type_Rev; + + + PpcTag->has_inkfactoryid = true; + PpcTag->inkfactoryid = Tag->InkFactoryID; + PpcTag->has_fillsysid = true; + PpcTag->fillsysid = Tag->FillSysID; + PpcTag->has_inkcategory = true; + PpcTag->inkcategory = Tag->InkCategory; + PpcTag->has_type_rev = true; + PpcTag->type_rev = Tag->Type_Rev; PpcTag->has_cartridgesize = true; PpcTag->cartridgesize = Tag->CartridgeSize; - PpcTag->has_filledinkvolume = true; - PpcTag->filledinkvolume = Tag->FiledInkVol; - PpcTag->inkbatchnum = Tag->InkBatchNo; - PpcTag->inkmfgdate = Tag->InkMFGDate; - PpcTag->inkeoldate = Tag->InkEOLDate; - PpcTag->cartridgefillingdate = Tag->CartFillDate; - PpcTag->wastefilleddate = Tag->WasteFillDate; + PpcTag->has_filedinkvol = true; + PpcTag->filedinkvol = Tag->FiledInkVol; + PpcTag->has_misc = true; + PpcTag->misc = Tag->Misc; PpcTag->has_plugincounter = true; PpcTag->plugincounter = Tag->PluginCounter; - PpcTag->has_inkfill = true; - PpcTag->inkfill = Tag->InkFillStatus; - PpcTag->has_inkused = true; - PpcTag->inkused = Tag->InkUsedStatus; - PpcTag->has_inkempty = true; - PpcTag->inkempty = Tag->InkEmptyStatus; - PpcTag->has_wasteempty = true; - PpcTag->wasteempty = Tag->WasteEmptyStatus; - PpcTag->has_wastefilling = true; - PpcTag->wastefilling = Tag->WasteFillingStatus; - PpcTag->has_wastefull = true; - PpcTag->wastefull = Tag->WasteFullStatus; + PpcTag->has_inkfillstatus = true; + PpcTag->inkfillstatus = Tag->InkFillStatus; + PpcTag->has_inkusedstatus = true; + PpcTag->inkusedstatus = Tag->InkUsedStatus; + PpcTag->has_inkemptystatus = true; + PpcTag->inkemptystatus = Tag->InkEmptyStatus; + PpcTag->has_inkemptystatus = true; + PpcTag->inkemptystatus = Tag->WasteEmptyStatus; + PpcTag->has_wastefillingstatus = true; + PpcTag->wastefillingstatus = Tag->WasteFillingStatus; + PpcTag->has_wastefullstatus = true; + PpcTag->wastefullstatus = Tag->WasteFullStatus; 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->MachineIdINL; - PpcTag->machineidwasteused = Tag->MachineIdWST; return PpcTag; } @@ -195,48 +212,51 @@ CartridgeTagContent * NFCTag_Tag2PPC(NFCTag_t *Tag) return NULL; memset (Tag,0,sizeof(Tag)); - memcpy(Tag->TagUniqueID , PpcTag->uniqueid,sizeof(Tag->TagUniqueID)); - memcpy(Tag->CartSN , PpcTag->serialnumber,sizeof(Tag->CartSN)); - if (PpcTag->has_factoryid == true) - Tag->InkFactoryID = PpcTag->factoryid; - if (PpcTag->has_fillingsystemid == true) - Tag->FillSysID = PpcTag->fillingsystemid; - memcpy(Tag->ColorName , PpcTag->colorname,sizeof(Tag->ColorName)); - if (PpcTag->has_colorcategory == true) - Tag->InkCategory = PpcTag->colorcategory; - if (PpcTag->has_colortyperevision == true) - Tag->Type_Rev = PpcTag->colortyperevision; + strncpy(Tag->TagUniqueID , PpcTag->taguniqueid,sizeof(Tag->TagUniqueID)); + strncpy(Tag->CartSN , PpcTag->cartsn,sizeof(Tag->CartSN)); + if (PpcTag->has_inkfactoryid == true) + Tag->InkFactoryID = PpcTag->inkfactoryid; + if (PpcTag->has_fillsysid == true) + Tag->FillSysID = PpcTag->fillsysid; + strncpy(Tag->ColorName , PpcTag->colorname,sizeof(Tag->ColorName)); + strncpy(Tag->WorkOrder , PpcTag->workorder ,sizeof(Tag->WorkOrder)); + if (PpcTag->has_inkcategory == true) + Tag->InkCategory = PpcTag->inkcategory; + if (PpcTag->has_type_rev == true) + Tag->Type_Rev = PpcTag->type_rev; if (PpcTag->has_cartridgesize == true) Tag->CartridgeSize = PpcTag->cartridgesize; - if (PpcTag->has_filledinkvolume == true) - Tag->FiledInkVol = PpcTag->filledinkvolume; - memcpy(Tag->InkBatchNo , PpcTag->inkbatchnum,sizeof(Tag->InkBatchNo)); - memcpy(Tag->InkMFGDate , PpcTag->inkmfgdate,sizeof(Tag->InkMFGDate)); - memcpy(Tag->InkEOLDate , PpcTag->inkeoldate,sizeof(Tag->InkEOLDate)); - memcpy(Tag->CartFillDate , PpcTag->cartridgefillingdate,sizeof(Tag->CartFillDate)); - memcpy(Tag->WasteFillDate , PpcTag->wastefilleddate,sizeof(Tag->WasteFillDate)); + if (PpcTag->has_filedinkvol == true) + Tag->FiledInkVol = PpcTag->filedinkvol; + strncpy(Tag->InkBatchNo , PpcTag->inkbatchno,sizeof(Tag->InkBatchNo)); + strncpy(Tag->InkMFGDate , PpcTag->inkmfgdate,sizeof(Tag->InkMFGDate)); + strncpy(Tag->InkEOLDate , PpcTag->inkeoldate,sizeof(Tag->InkEOLDate)); + strncpy(Tag->CartFillDate , PpcTag->cartfilldate,sizeof(Tag->CartFillDate)); + strncpy(Tag->WasteFillDate , PpcTag->wastefilldate,sizeof(Tag->WasteFillDate)); if (PpcTag->has_plugincounter == true) Tag->PluginCounter = PpcTag->plugincounter; - if (PpcTag->has_inkfill == true) - Tag->InkFillStatus = PpcTag->inkfill; - if (PpcTag->has_inkused == true) - Tag->InkUsedStatus = PpcTag->inkused; - if (PpcTag->has_inkempty == true) - Tag->InkEmptyStatus = PpcTag->inkempty; - if (PpcTag->has_wasteempty == true) - Tag->WasteEmptyStatus = PpcTag->wasteempty; - if (PpcTag->has_wastefilling == true) - Tag->WasteFillingStatus = PpcTag->wastefilling; - if (PpcTag->has_wastefull == true) - Tag->WasteFullStatus = PpcTag->wastefull; + if (PpcTag->has_inkfillstatus == true) + Tag->InkFillStatus = PpcTag->inkfillstatus; + if (PpcTag->has_inkusedstatus == true) + Tag->InkUsedStatus = PpcTag->inkusedstatus; + if (PpcTag->has_inkemptystatus == true) + Tag->InkEmptyStatus = PpcTag->inkemptystatus; + if (PpcTag->has_wasteemptystatus == true) + Tag->WasteEmptyStatus = PpcTag->wasteemptystatus; + if (PpcTag->has_wastefillingstatus == true) + Tag->WasteFillingStatus = PpcTag->wastefillingstatus; + if (PpcTag->has_wastefullstatus == true) + Tag->WasteFullStatus = PpcTag->wastefullstatus; 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->MachineIdINL , PpcTag->machineidinkused,sizeof(Tag->MachineIdINL)); - memcpy(Tag->MachineIdWST , PpcTag->machineidwasteused,sizeof(Tag->MachineIdWST)); + strncpy(Tag->MachineIdINL , PpcTag->machineidinl,sizeof(Tag->MachineIdINL)); + strncpy(Tag->MachineIdWST , PpcTag->machineidwst,sizeof(Tag->MachineIdWST)); + strncpy(Tag->Spare,PpcTag->spare ,sizeof(Tag->Spare)); + strncpy(Tag->HashValue,PpcTag->hashvalue ,sizeof(Tag->HashValue)); return Tag; @@ -302,13 +322,13 @@ RfidTagContent * RFID_PPC2Tag( CartridgeTagContent *PpcTag) return NULL; memset (Tag,0,sizeof(Tag)); - memcpy(Tag->uniqueid , PpcTag->uniqueid,sizeof(Tag->uniqueid)); - memcpy(Tag->serialnumber , PpcTag->serialnumber,sizeof(Tag->serialnumber)); - memcpy(Tag->factoryid , PpcTag->factoryid,sizeof(Tag->factoryid)); + strncpy(Tag->uniqueid , PpcTag->uniqueid,sizeof(Tag->uniqueid)); + strncpy(Tag->serialnumber , PpcTag->serialnumber,sizeof(Tag->serialnumber)); + strncpy(Tag->factoryid , PpcTag->factoryid,sizeof(Tag->factoryid)); if (PpcTag->has_fillingsystemid == true) Tag->fillingsystemid = PpcTag->fillingsystemid; - memcpy(Tag->colorname , PpcTag->colorname,sizeof(Tag->colorname)); + strncpy(Tag->colorname , PpcTag->colorname,sizeof(Tag->colorname)); if (PpcTag->has_colorcategory == true) Tag->colorcategory = PpcTag->colorcategory; if (PpcTag->has_colortyperevision == true) @@ -317,11 +337,11 @@ RfidTagContent * RFID_PPC2Tag( CartridgeTagContent *PpcTag) 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)); + strncpy(Tag->inkbatchnum , PpcTag->inkbatchnum,sizeof(Tag->inkbatchnum)); + strncpy(Tag->inkmfgdate , PpcTag->inkmfgdate,sizeof(Tag->inkmfgdate)); + strncpy(Tag->inkeoldate , PpcTag->inkeoldate,sizeof(Tag->inkeoldate)); + strncpy(Tag->cartridgefillingdate , PpcTag->cartridgefillingdate,sizeof(Tag->cartridgefillingdate)); + strncpy(Tag->wastefilleddate , PpcTag->wastefilleddate,sizeof(Tag->wastefilleddate)); if (PpcTag->has_plugincounter == true) Tag->plugincounter = PpcTag->plugincounter; if (PpcTag->has_inkfill == true) @@ -342,8 +362,8 @@ RfidTagContent * RFID_PPC2Tag( CartridgeTagContent *PpcTag) 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)); + strncpy(Tag->machineidinkused , PpcTag->machineidinkused,sizeof(Tag->machineidinkused)); + strncpy(Tag->machineidwasteused , PpcTag->machineidwasteused,sizeof(Tag->machineidwasteused)); return Tag; diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.h b/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.h index 192f1e075..496b1aae3 100644 --- a/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.h +++ b/Software/Embedded_SW/Embedded/Common/Utilities/RFIDTagHandling.h @@ -9,120 +9,6 @@ #include "PMR/Diagnostics/CartridgeTagContent.pb-c.h" #include <Drivers/I2C_Communication/RFID_NFC/RFIDTagInfo.h> -/* - typedef struct -{ - uint8_t TagUniqueID[8]; //RFID Tag unique ID - 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; -typedef struct -{ - uint8_t TagUniqueID[8]; //RFID Tag unique ID - uint8_t CartSN[16]; //Cartridge serial number - uint32_t InkFactoryID:24; //Ink factory ID - uint32_t FillSysID:16; //Filling system ID number - uint8_t WorkOrder[10]; //Color description / ID - uint8_t ColorName[12]; //Color description / ID - uint32_t InkCategory:16; //Ink category (TBD) - uint32_t Type_Rev; //TBD – can be formulation # - uint32_t CartridgeSize; //Size in cc - uint32_t FiledInkVol; //Size in cc - uint8_t InkBatchNo[10]; //MFG batch No’ - uint8_t InkMFGDate[6]; //Date Ink was manufactured (20L container bar-code) - uint8_t InkEOLDate[6]; //Ink end of life date - uint8_t CartFillDate[6]; //Date cartridge was filled with ink (CFS) - uint8_t WasteFillDate[6]; //Date cartridge was filled with waste (Machine) - uint32_t Misc; - uint32_t PluginCounter:16; //Number of times cartridge was plugged in INK Slot - uint8_t InkFillStatus; //State indicator - successful state change when starting to fill mid. tank - uint8_t InkUsedStatus; - uint8_t InkEmptyStatus; - uint8_t WasteEmptyStatus; - uint8_t WasteFillingStatus; - uint8_t WasteFullStatus; - uint8_t Blocked; - uint8_t Fail; - uint32_t WasteCounter:16; - uint8_t MachineIdINL[16]; - uint8_t MachineIdWST[16]; - uint8_t Spare[13]; - uint32_t Counter; - uint8_t TagValid; - uint8_t HashValue[32]; - uint32_t Checksum_CRC16:16; -}NFCTag_t; - - 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 * NFCTag_Tag2PPC(NFCTag_t *Tag); NFCTag_t * NFCTag_PPC2Tag( CartridgeTagContent *PpcTag); |
