etwmc / Personal-HomeKit-HAP

This project will provide source code to build a HomeKit support accessories.
MIT License
236 stars 85 forks source link

build with Windows VisualStudio 2010. #64

Open rti7743 opened 7 years ago

rti7743 commented 7 years ago

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

etwmc commented 7 years ago

You disabled the broadcastMessage(). But you can't get status notification without it.

rti7743 commented 7 years ago

Thank you for reply. Even without broadcastMessage (), I think that the state is correctly taken. Ios 10 Home application works correctly. Which environment is problematic if there is no broadcastMessage ()?

etwmc commented 7 years ago

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. So, it won't work on sensory triggered push notification and automation. (So, something like turn on the light if the sensor is triggered etc)

rti7743 commented 7 years ago

it won't work on sensory triggered push notification and automation

sorry,I did not try it.

but...,I lent my ipad mini for the display of our product. Therefore, it can not be verified and corrected immediately.

I wish I had received an answer a little earlier, around the New Year holidays.... I lent it out in the middle of January.

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. but, it will take some time....

etwmc commented 7 years ago

I think you can test it with iPhone Stimulator? I haven't get any Github messages since last September, so I might drop the ball when I manually check the Github notification list when I'm half awake -_-

rti7743 commented 7 years ago

I revived broadcastMessage() https://github.com/etwmc/Personal-HomeKit-HAP/pull/64/commits/e8a294571f1f15c84d8789da008f4516203ec2f8

I found an old ipad mini (ios 9), so I useed Insteon+ and tested the operation.

I added pthread_detach to announce(). (Otherwise it will leak memory.)