pete_c
Guru
Started a new post here relating to BobS0327's code to speak to the OmniPro 2 via the RPi2
Going baby steps here and have made a couple of changes to the original C that Bob has provided.
Note I have linked the starting files here.
There are four files zipped and attached.
1 - hai.h
2 - hai.c
3 - aes.h
4 - aes.c
Goofing around and not touching the original stuff tried:
gcc hai.c -o hai
hai.c: In function 'main':
hai.c:40:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
editing the hai.c so that it reads:
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include "hai.h"
#include "aes.h"
#include <errno.h>
works such that:
gcc hai.c -o hai
/tmp/ccfKwd09.o: In function `hai_net_send_msg':
hai.c.text+0x960): undefined reference to `MakeKey'
hai.c.text+0x9a0): undefined reference to `Encrypt'
/tmp/ccfKwd09.o: In function `hai_net_recv_msg':
hai.c.text+0xb6c): undefined reference to `MakeKey'
hai.c.text+0xbac): undefined reference to `Decrypt'
collect2: ld returned 1 exit status
changing the keys in the hai.h file then doing ....
gcc hai.c aes.c -o hai
complies the file fine.
The following code is in the hai.c file.
if ((err = omni_command(&id, CMD_ON, 60, 14)) != 0)
printf("Failed to turn lights on\n");
else printf("Turned lights on successfully\n");
Running the default code should display the type of controller I am using and turn unit 14 on for 60 seconds.
Stuck here as I do not see anything when running the code.
View attachment hai-aes.zip
Going baby steps here and have made a couple of changes to the original C that Bob has provided.
Note I have linked the starting files here.
There are four files zipped and attached.
1 - hai.h
2 - hai.c
3 - aes.h
4 - aes.c
Goofing around and not touching the original stuff tried:
gcc hai.c -o hai
hai.c: In function 'main':
hai.c:40:3: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
editing the hai.c so that it reads:
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
#include "hai.h"
#include "aes.h"
#include <errno.h>
works such that:
gcc hai.c -o hai
/tmp/ccfKwd09.o: In function `hai_net_send_msg':
hai.c.text+0x960): undefined reference to `MakeKey'
hai.c.text+0x9a0): undefined reference to `Encrypt'
/tmp/ccfKwd09.o: In function `hai_net_recv_msg':
hai.c.text+0xb6c): undefined reference to `MakeKey'
hai.c.text+0xbac): undefined reference to `Decrypt'
collect2: ld returned 1 exit status
changing the keys in the hai.h file then doing ....
gcc hai.c aes.c -o hai
complies the file fine.
The following code is in the hai.c file.
if ((err = omni_command(&id, CMD_ON, 60, 14)) != 0)
printf("Failed to turn lights on\n");
else printf("Turned lights on successfully\n");
Running the default code should display the type of controller I am using and turn unit 14 on for 60 seconds.
Stuck here as I do not see anything when running the code.
View attachment hai-aes.zip