GracoCore API
##############

Add-On Instructions (AOIs)
**************************

.. _DecodeDateTime:

DecodeDateTime
==============
Convert from Graco-formatted date and time data into a UDT. 

**dateSource** (INOUT DINT)
  Date source
**timeSource** (INOUT DINT)
  Time source
**dateTimeDest** (INOUT TypeDateTime_)
  Datetime UDT destination

.. _DecodeEventCode:

DecodeEventCode
===============
Parses an event code from a series of characters stored in a DINT into a Rockwell String (4 characters max).

**source** (INOUT DINT)
  Byte source
**dest** (INOUT STRING4_)
  String destination

.. _DecodeUserID:

DecodeUserID
============
Parses a user ID from a series of characters stored in DINTs into a Rockwell String (9 characters max).

**source1** (INOUT DINT)
  Source 1 (characters 1-4)
**source2** (INOUT DINT)
  Source 2 (characters 5-8)
**source3** (INOUT DINT)
  Source 3 (character 9)
**dest** (INOUT STRING9_)
  String destination

.. _EncodeUserID:

EncodeUserID
============
Parses a user ID String (max 9 characters) into a series of ASCII values stored in DINTs. These can then be written to a Graco CGM.

**source** (INOUT STRING9_)
  String source
**dest1** (INOUT DINT)
  Destination 1 (characters 1-4)
**dest2** (INOUT DINT)
  Destination 2 (characters 5-8)
**dest3** (INOUT DINT)
  Destination 3 (character 9)

Step
====
An implementation of the step pattern, useful for sequences in ladder logic.

**doneTrigger** (INPUT BOOL)
  Trigger to set step to done
**preCond** (INPUT BOOL)
  Precondition for step
**isDone** (OUTPUT BOOL)
  Step is done
**isRunning** (OUTPUT BOOL)
  Step is running

User-Defined Types (UDTs)
*************************

.. _TypeDateTime:

TypeDateTime
============
Represents a point in time.

**year** (DINT)
  the year value (e.g. 2021).
**month** (DINT)
  the month number (1=January, 2=February, ...).
**dayOfMonth** (DINT)
  the day number within the month.
**dayOfWeek** (DINT)
  the day number within the week (1=Monday, 2=Tuesday, ..., 7=Sunday).
**hour** (DINT)
  the 24-hour value (0-23, where 0=midnight).
**min** (DINT)
  the minute value (0-59).
**sec** (DINT)
  the second value (0-59).

String Types
************

.. _STRING4:

STRING4
=======

**Maximum characters**: 4

.. _STRING9:

STRING9
=======

**Maximum characters**: 9

