-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build with Windows VisualStudio 2010. #64
base: master
Are you sure you want to change the base?
Conversation
I forgot to add.
I changed to setting that does not depend on Configuration.h. This is to make it easier to reuse modules. Specifically, we made it possible to pass information in PHKNetwork IP class constructor. Example. PHKNetworkIP networkIP(deviceName,devicePassword,deviceIdentity,controllerRecordsAddress); do { networkIP.handleConnection(); } while (true); 2. I made PHKControllerRecord.cpp from a function to a class. This is to make it possible to pass the path saving vector <PHKKeyRecord> from outside by changing (1). The PHKControllerRecord class delegates administration to the AccessorySet. This is because AccessorySet is singleton so it is easy to use. Originally, I want it under PHKNetworkIP, but since it is hard to modify, I delegated to AccessorySet for the time being. 3. I changed have taken measures against buffer overrun of scanf. Example. We changed it as char buf[10]; sccanf(a, "%s", buf); ---> char buf[10+1]; sccanf (a, "%10s", buf); 4. Changed it to a code that is harder to leak memory. Example. We changed it as char* a = new[100]; ---> vector<char> a_vec(100); char* a = &a_vec[0]; If secured with vector<char>, it is safe because you do not have to delete it. 5. I introduced AccessorySetAutoLock autolock; to avoid forgetting mutex lock release. When you leave the scope, it automatically releases the mutex. { lock .... unlock } ----> { AccessorySetAutoLock autolock .... } //auto unlock 6. I changed the method of initialization. I use this as C ++ will initialize. char a[100]; bzero(b,100); -----> char a[100] = {0}; (It is very easy because C ++ will initialize without permission.) 7. Fixed a problem that boolCharacteristics "1" can not be judged as true. 8. Added PHKNetworkIP::closeAcceptConnection command to end accept loop. Now you can stop with CTRL + C, and reusability as a module increases. For details,plasess see the end of main.cpp. PHKNetworkIP networkIP(deviceName,devicePassword,deviceIdentity,controllerRecordsAddress); do { networkIP.handleConnection(); } while (true); //if you running PHKNetworkIP new accept thread, //call PHKNetworkIP::closeAcceptConnection to stop. 9. To fix memory leak, we fixed to release memory when releasing Service and Characteristics. 10. Uint8 Characteristic support added. (However, perhaps, this may not be necessary ...?? ) 11. We have supported the number of digits up to 8 digits. (Question: Why are you making three digits, why do you have [3] a reason?) char buf[3]; snprintf(buf,3,"%d",intValue); ---> char buf[8]; snprintf(buf, 8, "%d", intValue); (I wrote this sentence using google translation. Sorry if we had funny English.)
…was the same as snprintf's behavior and safe.
Fixed Windows WinsockStartup
- Adding pthread_detach - Fix srp_free leak
You disabled the broadcastMessage(). But you can't get status notification without it. |
Thank you for reply. |
The state can be fetch fine (as the device carry out the changes would receive the 204, and any devices display the status view would fetch the value again before showing), but the HomeKit will not be notified any changes in the background. |
sorry,I did not try it. but...,I lent my ipad mini for the display of our product. I wish I had received an answer a little earlier, around the New Year holidays.... If possible, I'd be happy if you merge it except for the part that you want to erase broadcastMessage (). I will consult with the person who lends my ipad mini to get it back as soon as possible. |
I think you can test it with iPhone Stimulator? |
I revived broadcastMessage() I found an old ipad mini (ios 9), so I useed Insteon+ and tested the operation. I added pthread_detach to announce(). |
I changed it so that it can build with Windows VisualStudio 2010.
*detail
In VisualStudio 2010, since initialization can not be done simultaneously with the declaration of member variables, we changed the initialization method.
In windows, since socket can not be manipulated by read / write, it changed to recv / send.
In windows, since socket is closed with "closesocket" instead of "close", we added ifdef.
I made a simple pthread compatibility routine.
We prepared the same as unistd.h.(This is based on what this person made. http://d.hatena.ne.jp/deraw/20070517/1179334643 )
When building with windows, I use Bonjour SDK for Windows instead of avahi. However, since this is done in VisualStudio's project settings, there is nothing to modify the source code.
Changed the position of #include "ed25519-randombytes.h" in ed25519.c because of winsock include order.
With VisualStudio 2010, since inline specification did not go well, I dropped inline from chacha20_simple.c only with windows ifdef.
Removed _P () from srp / srp.h. With VisualStudio, we could not compile without removing it.
I wrote an explanation on my blog.( Japanese )
http://d.hatena.ne.jp/rti7743/20161124