/* Loxmock - Mocked Loxone functions for functional development/testing on console-level Andrej Konkow, 2026/05, v03 Parts not being used can be ignored In case you have testing code yourself you may add some specifics to your code. LOXMOCK is only defined by loxmock #ifdef LOXMOCK my great console testing code #endif ********************************************************************** * The following section is for declaration of testdata and mock behaviour */ #define LOXMOCK_PRINTCALLS 1 /* Shall loxmock print the debug output? 0/1 */ #define LOXMOCK_EXECUTE_SLEEP 1 /* Shall loxmock execute the sleep-statements or run through? 0/1 */ #define LOXMOCK_LOCAL_TZDIFF_TO_UTC (+2) /* in case of using timefunctions you may adjust this one */ #define LOXMOCK_LOCAL_IS_SUMMERTIME 1 /* in case of using timefunctions you may adjust this one: 0/1 */ #define LOXMOCK_VIRTUAL_BLOCKS 5 /* define the virtual inputs/outputs (getio()/setio()) or leave the default */ #include "loxmock_func.c" /* textinput channels of program block Be aware that quotation marks inside of a string have to be quoted: \" */ /* text input 1 */ lm_setinputtext(0, ""); /* text input 2 */ lm_setinputtext(1, ""); /* text input 3 */ lm_setinputtext(2, ""); /* float input 1 */ lm_setinput(0, 0); /* float input 2 */ lm_setinput(1, 0); /* float input 3 */ lm_setinput(2, 0); /* float input 4 */ lm_setinput(3, 0); /* float input 5 */ lm_setinput(4, 0); /* float input 6 */ lm_setinput(5, 0); /* float input 7 */ lm_setinput(6, 0); /* float input 8 */ lm_setinput(7, 0); /* float input 9 */ lm_setinput(8, 0); /* float input 10 */ lm_setinput(9, 0); /* float input 11 */ lm_setinput(10, 0); /* float input 12 */ lm_setinput(11, 0); /* float input 13 */ lm_setinput(12, 0); /* Result string being returned when calling httpget() Be aware that quotation marks inside of a string have to be quoted: \" */ lm_set_httpget(""); /* When working with streams define the expected resultstream(completely). Even when your code is reading chunks loxmock will take care about that. The hex-values will be properly converted to their corresponding byte values Examples: #define LOXMOCK_STREAM lm_hexbytes lm_set_result_stream("1A 4B 0C 5D"); or without whitespaces "1A4B0C5D"; #define LOXMOCK_STREAM lm_ascii lm_set_result_stream("This is handled as char-stream"); Specify whether the specified stream is a - ascii-string: lm_ascii - list of hex-bytes: lm_hexbytes */ #define LOXMOCK_STREAM lm_hexbytes lm_set_result_stream(""); /* Result string being returned when calling localwebservice() Be aware that quotation marks inside of a string have to be quoted: \" Also just take the data, ignore http-response headers */ lm_set_localwebservice(""); /* When working with virtual inputs/outputs (getio()/setio()) you can use the following map. Define the virtual input names and their corresponding initial values. You can address them in your scripting code by using getio()/setio() */ loxmock_vblocks[0].key = "VI0"; loxmock_vblocks[0].value = 0; loxmock_vblocks[1].key = "VI1"; loxmock_vblocks[1].value = 0; loxmock_vblocks[2].key = "VI38"; loxmock_vblocks[2].value = 0; loxmock_vblocks[3].key = "anyname"; loxmock_vblocks[3].value = 0; loxmock_vblocks[4].key = "foo4"; loxmock_vblocks[4].value = 0; /* When calling getinputevent() this bitmask will be returned once and then will be set back to 0 Just for clarification: The string will be converted into a real bitmap. ;-) channels "I13 I12 I11 I10 I9 I8 I7 I6 I5 I4 I3 I2 I1 T3 T2 T1" 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 loxmox_inputevent_bitmask = "0000000000010101"; (2*8Bit) */ lm_setinputevent("0000000000000000"); /* End of testdata section ******************************************************************************/ loxmock_print = LOXMOCK_PRINTCALLS; //#include "loxmock_test.c"