Struggling with Acknowledgement

Hi Lifx coders ! I’m quite done with my lifx library but there is a point I’m still missing : I want to have an acknowledgement response for every unicast SetColor and SetPower messages I send.
For each Color and SetPower message I set the ack_required field to 1

I’m facing two problems :

  • I don’t receive acknowledgment messages for SetColor and SetPower
  • I do receive unwanted acknowledgment messages for GetGroup (but surprisingly not for GetLabel)

Obviously there is a bug in my application but I don’t find where. Here some details that could give you an idea of what is possibly wrong.

  • source is random > 0 computed at application start
  • for all messages res_required is 0
  • I only use broadcast for discovery, with tagged = 1, ack = 0
  • for all other messages I do unicast with tagged = 0, ack = 0
  • for SetColor and SetPower I do unicast with tagged = 0, ack = 1
  • sequence is incremented for each message sent

By unicast I mean sending message to the bulb through its IP address (with of course target field set to the bulb’s target value). Throughput is limited to 20 messages per second for each bulb (50 ms wait since last Send)

I step debugged the Color message packet, everything seems ok, all fields are correct. Bulbs are all well reacting for SetColor and SetPower messages, even if some messages seems to be lost from time to time (but few), hence the need to ACK.

Below is a sequential verbose trace of my application, with message kinds, types, bulbs targets and IP, and sequences number. Can you see anything wrong here ?

Notes :

  • bulb dump is every 7 seconds, so contrary to the log bulbs are well discovered when StateService messages are received.

  • I do a discover() at app startup then every 5 seconds

    [notice ] Source ID is 6314
    [notice ] BROADCAST 0000000000000000 TYPE 2
    [verbose] DISCOVER : GET_SERVICE broadcast sent
    [verbose] STATE_SERVICE rcv for target D073D51401290000 56700
    [notice ] UNICAST 192.168.1.128 D073D51401290000 TYPE 23 SEQ 1
    [verbose] SEND GetLabel for target D073D51401290000
    [notice ] UNICAST 192.168.1.128 D073D51401290000 TYPE 51 SEQ 2
    [verbose] SEND GetGroup for target D073D51401290000
    [verbose] STATE_SERVICE rcv for target D073D513ED170000 56700
    [notice ] UNICAST 192.168.1.158 D073D513ED170000 TYPE 23 SEQ 3
    [verbose] SEND GetLabel for target D073D513ED170000
    [notice ] UNICAST 192.168.1.158 D073D513ED170000 TYPE 51 SEQ 4
    [verbose] SEND GetGroup for target D073D513ED170000
    [verbose] STATE_SERVICE rcv for target D073D513F8C00000 56700
    [notice ] UNICAST 192.168.1.175 D073D513F8C00000 TYPE 23 SEQ 5
    [verbose] SEND GetLabel for target D073D513F8C00000
    [notice ] UNICAST 192.168.1.175 D073D513F8C00000 TYPE 51 SEQ 6
    [verbose] SEND GetGroup for target D073D513F8C00000
    [verbose] STATE_SERVICE rcv for target D073D513ED170000 56700
    [notice ] UNICAST 192.168.1.158 D073D513ED170000 TYPE 23 SEQ 7
    [verbose] SEND GetLabel for target D073D513ED170000
    [notice ] UNICAST 192.168.1.158 D073D513ED170000 TYPE 51 SEQ 8
    [verbose] SEND GetGroup for target D073D513ED170000
    [verbose] STATE_SERVICE rcv for target D073D51401290000 56700
    [notice ] UNICAST 192.168.1.128 D073D51401290000 TYPE 23 SEQ 9
    [verbose] SEND GetLabel for target D073D51401290000
    [notice ] UNICAST 192.168.1.128 D073D51401290000 TYPE 51 SEQ 10
    [verbose] SEND GetGroup for target D073D51401290000
    [verbose] STATE_SERVICE rcv for target D073D513F8C00000 56700
    [notice ] UNICAST 192.168.1.175 D073D513F8C00000 TYPE 23 SEQ 11
    [verbose] SEND GetLabel for target D073D513F8C00000
    [notice ] UNICAST 192.168.1.175 D073D513F8C00000 TYPE 51 SEQ 12
    [verbose] SEND GetGroup for target D073D513F8C00000
    [verbose] STATE_LABEL rcv for target D073D51401290000
    [verbose] STATE_GROUP rcv for target D073D51401290000
    [notice ] ACK ! SEQ = 2 D073D51401290000
    [verbose] STATE_LABEL rcv for target D073D513ED170000
    [verbose] STATE_GROUP rcv for target D073D513ED170000
    [notice ] ACK ! SEQ = 4 D073D513ED170000
    [verbose] STATE_LABEL rcv for target D073D513F8C00000
    [verbose] STATE_GROUP rcv for target D073D513F8C00000
    [notice ] ACK ! SEQ = 6 D073D513F8C00000
    [verbose] STATE_LABEL rcv for target D073D513ED170000
    [verbose] STATE_LABEL rcv for target D073D51401290000
    [verbose] STATE_GROUP rcv for target D073D513ED170000
    [notice ] ACK ! SEQ = 8 D073D513ED170000
    [verbose] STATE_LABEL rcv for target D073D513F8C00000
    [verbose] STATE_GROUP rcv for target D073D51401290000
    [notice ] ACK ! SEQ = 10 D073D51401290000
    [verbose] STATE_GROUP rcv for target D073D513F8C00000
    [notice ] ACK ! SEQ = 12 D073D513F8C00000
    [notice ] BROADCAST 0000000000000000 TYPE 2
    [verbose] DISCOVER : GET_SERVICE broadcast sent
    [verbose] STATE_SERVICE rcv for target D073D513ED170000 56700
    [verbose] STATE_SERVICE rcv for target D073D513F8C00000 56700
    [verbose] STATE_SERVICE rcv for target D073D51401290000 56700
    [verbose] STATE_SERVICE rcv for target D073D513ED170000 56700
    [verbose] STATE_SERVICE rcv for target D073D513F8C00000 56700
    [verbose] STATE_SERVICE rcv for target D073D51401290000 56700
    [notice ] 3 bulbs found - BULBS : [B2#D073D513F8C00000#192.168.1.175#] [B3#D073D513ED170000#192.168.1.158#] [B1#D073D51401290000#192.168.1.128#]
    [notice ] BROADCAST 0000000000000000 TYPE 2
    [verbose] DISCOVER : GET_SERVICE broadcast sent
    [verbose] STATE_SERVICE rcv for target D073D513F8C00000 56700
    [verbose] STATE_SERVICE rcv for target D073D51401290000 56700
    [verbose] STATE_SERVICE rcv for target D073D513ED170000 56700
    [verbose] STATE_SERVICE rcv for target D073D513F8C00000 56700
    [verbose] STATE_SERVICE rcv for target D073D51401290000 56700
    [verbose] STATE_SERVICE rcv for target D073D513ED170000 56700