Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
title3. Add the core CWL source files to your platform project.

From the ./lib directory:

cwassert.h, cwcrc16.c, cwcrc16.h, cwdll.c, cwdll.h, cwnwk.c, cwnwk.h, mjson.c, mjson.h, cwver.h

From the ./_OpenKitchenEquipment_OKE directory:

cwcmd.c, cwcmd.h, cwmsg.c, cwmsg.h

Implementors should not modify any of these files.

Expand
title4. Add and modify the port specific source files to your platform project.

From either the ./_OpenKitchenEquipment_OKE/ports/windows or ./_OpenKitchenEquipment_OKE/ports/linux directory copy the following files:

cwport.c, cwport.h, cwmsgsel.h, and optionally strlcpy.c if your platform does not natively support strlcpy().

main.c is example startup code.

Embedded platforms will start their port using either the Windows or Linux port as a baseline.

Carefully read the integration instructions contained in cwport.c and cwport.h and modify either the Windows or Linux specific implementation Begin embedded controller integration by commenting out much of the functions in these two files until the code compiles. Then modify to work on your controller.

Info

When not using a Windows or Linux toolchain, it is expected that some or all the Windows or Linux specific header files in cwport.c and cwport.h must either be commented out or replaced by platform specific ones to get the CWL to compile.

For the initial port, it is recommended to set CW_PORT_INVALID_OKM_HARD_ERROR to 1 and CW_PORT_IS_FILE_SUPPORT_ENABLED to 0 in cwport.h. This will minimize the number of functions that must be implemented to get the first port working.

Tip

A successful port will only require changes to cwport.c and cwport.h.

It is strongly recommended that MJUnitTest() is run to verify that the JSON library is working correctly on the target platform.

If you have previously ported the CWL successfully and are updating to the newer version of the CWL then merge your existing cwport.c and cwport.h files with the newer versions of those files. For cwport.c if the function signatures match it is generally safe to bring over your existing code without modification, however care should be taken to follow any new porting guidelines for those functions. For cwport.h make sure to bring over your port configuration settings and configure any new settings as appropriate for your system.

Expand
title 5. Initialize and run the CWL task.

Call CWPortInitTask(), and then from the main loop or dedicated task/thread periodically call CWPortRunTask().

Refer to ./_OpenKitchenEquipment_OKE/ports/windows/main.c for an example of how to initialize and call the ConnectWare Library from your main() function.

See CWL Task for a detailed explanation of how to properly invoke CWPortInitTask() and CWPortRunTask().

...