Ejemplo n.º 1
0
 public TocFetcher(Crazyflie crazyflie, object element_class, byte port, Toc toc_holder, Action finished_callback, int toc_cache)
 {
     this.cf                = crazyflie;
     this.port              = port;
     this._crc              = 0;
     this.requested_index   = null;
     this.nbr_of_items      = null;
     this.state             = TOC_STATE.IDLE;
     this.toc               = toc_holder;
     this._toc_cache        = toc_cache;
     this.finished_callback = finished_callback;
     this.element_class     = element_class;
     this._useV2            = false;
 }
Ejemplo n.º 2
0
        public void start()
        {
            this._useV2 = this.cf.platform.get_protocol_version() >= 4;

            this.cf.add_port_callback(port, this._new_packet_cb);

            this.state = TOC_STATE.GET_TOC_INFO;

            CRTPPacket pk = new CRTPPacket();

            pk.set_header(port, 0); //TOC_CHANNEL
            if (this._useV2)
            {
                pk.data = new byte[] { (byte)CMD_TOC.CMD_TOC_INFO_V2 };
                this.cf.send_packet(pk, new byte[] { (byte)CMD_TOC.CMD_TOC_INFO_V2 });
            }
            else
            {
                pk.data = new byte[] { (byte)CMD_TOC.CMD_TOC_INFO_V2 };
                this.cf.send_packet(pk, new byte[] { (byte)CMD_TOC.CMD_TOC_INFO });
            }
        }