// Create the transmitter (for when calling the default constructor) void SCreceiver::Create(uint8_t pin, uint8_t id){ //check if initialized - set only once if(_initialized) return; //check id if(id == 0) return; if((id & 0xF) == 0) return; //add to the Receivers list if(!AddReceiver(this)) return; _initialized = 1; _pin = pin; //set pin pinMode(_pin, INPUT); //set as input _id = (id & 0xF); //asssign only 4 bits _channel = SC_DEFAULT_CHANNEL; //set channel _state = SC_STATE_IDLE; _signal[0] = 0; _signal[1] = 0; _start_duration_high = SC_DEFAULT_START_DURATION_HIGH; _start_duration_low = SC_DEFAULT_START_DURATION_LOW; _duration_high = SC_DEFAULT_DURATION_HIGH; _duration_low = SC_DEFAULT_DURATION_LOW; _buffer_length = 0; }
plSetListenerMsg::plSetListenerMsg( uint8_t type, const plKey &srcKey, bool binding ) : plMessage( nil, nil, nil ) { plUoid uoid( kListenerMod_KEY ); plKey pLKey = hsgResMgr::ResMgr()->FindKey( uoid ); AddReceiver( pLKey ); Set( srcKey, type, binding ); }
plRenderRequestMsg::plRenderRequestMsg(plKey sender, plRenderRequestBase* req) : plMessage(sender, nil, nil), fReq(req) { plUoid oid( kClient_KEY ); // from plFixedKey.h plKey key = hsgResMgr::ResMgr()->FindKey(oid); AddReceiver(key); hsRefCnt_SafeRef(fReq); }
static FlowMan_Flow Open_m ( FlowMan_cl *self, string_t ifname /* IN */, const Netif_TXQoS *txqos /* IN */, Netif_TXSort sort /* IN */, /* RETURNS */ IOOffer_clp *rxoffer, IOOffer_clp *txoffer ) { flowman_st *st = self->st; flow_t *f; intf_st *ifst; ifst = ifname2ifst(st->host, ifname); if (!ifst) return 0; f = Heap$Malloc(Pvs(heap), sizeof(*f)); if (!f) { printf("FlowMan$Open: out of memory\n"); return 0; } /* no data connections as yet */ f->conns = NULL; /* remember which interface this flow is through */ f->intf = ifst; /* no transmit filter as yet */ f->txpf = NULL; /* Get IO channels from device driver */ TRY { f->txoff = Netif$AddTransmitter(ifst->card->netif, txqos, sort, &f->txhdl); f->rxoff = Netif$AddReceiver(ifst->card->netif, &f->rxhdl); } CATCH_ALL { free(f); RERAISE; } ENDTRY; /* link onto the flow list for this client */ f->next = st->flows; st->flows = f; /* return the whole shebang */ *rxoffer = f->rxoff; *txoffer = f->txoff; return (FlowMan_Flow)f; }