// Create a new adapter by name and direction; default to BasicAdapterName if doesn't exist
425263
func (m *Manifest) NewAdapterOrDefault(name string, dir Direction) Adapter {
	if len(name) == 0 {
		name = BasicAdapterName
	}

	a := m.NewAdapter(name, dir)
	if a == nil {
		tracerx.Printf("Defaulting to basic transfer adapter since %q did not exist", name)
		a = m.NewAdapter(BasicAdapterName, dir)
	}
	return a
}
996499
func NewPocketBeagleAdaptor() *PocketBeagleAdaptor {
	a := NewAdaptor()
	a.SetName(gobot.DefaultName("PocketBeagle"))
	a.pinMap = pocketBeaglePinMap
	a.pwmPinMap = pocketBeaglePwmPinMap
	a.analogPinMap = pocketBeagleAnalogPinMap

	return &PocketBeagleAdaptor{
		Adaptor: a,
	}
}
268466
func New(robot *hal.Robot) (hal.Adapter, error) {
	c := &config{}
	env.MustProcess(c)

	a := &adapter{
		user:     c.User,
		nick:     c.Nick,
		password: c.Password,
		server:   c.Server,
		port:     c.Port,
		channels: func() []string { return strings.Split(c.Channels, ",") }(),
		useTLS:   c.UseTLS,
	}
	// Set the robot name to the IRC nick so respond commands will work
	a.SetRobot(robot)
	a.Robot.SetName(a.nick)
	return a, nil
}
37645
func (s *InternalLBService) CreateInternalLoadBalancerElement(p *CreateInternalLoadBalancerElementParams) (*CreateInternalLoadBalancerElementResponse, error) {
	resp, err := s.cs.newRequest("createInternalLoadBalancerElement", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r CreateInternalLoadBalancerElementResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		b, err = getRawValue(b)
		if err != nil {
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
870472
func NewAdaptor() *Adaptor {
	return &Adaptor{
		name: gobot.DefaultName("Digispark"),
		connect: func(d *Adaptor) (err error) {
			d.littleWire = littleWireConnect()
			if d.littleWire.(*littleWire).lwHandle == nil {
				return ErrConnection
			}
			return
		},
	}
}
1061227
func CreateNewMobileGateway(values *CreateMobileGatewayValue, setting *MobileGatewaySetting) (*MobileGateway, error) {

	lb := &MobileGateway{
		Appliance: &Appliance{
			Class:           "mobilegateway",
			propName:        propName{Name: values.Name},
			propDescription: propDescription{Description: values.Description},
			propTags:        propTags{Tags: values.Tags},
			propPlanID:      propPlanID{Plan: &Resource{ID: int64(MobileGatewayPlanStandard)}},
			propIcon: propIcon{
				&Icon{
					Resource: NewResource(values.IconID),
				},
			},
		},
		Remark: &MobileGatewayRemark{
			ApplianceRemarkBase: &ApplianceRemarkBase{
				Switch: &ApplianceRemarkSwitch{
					propScope: propScope{
						Scope: "shared",
					},
				},
				Servers: []interface{}{
					nil,
				},
			},
		},
		Settings: &MobileGatewaySettings{
			MobileGateway: setting,
		},
	}

	return lb, nil
}
611630
func NewAdapter(gossip gossip, pkiid common.PKIidType, channel common.ChainID,
	metrics *metrics.ElectionMetrics) LeaderElectionAdapter {
	return &adapterImpl{
		gossip:    gossip,
		selfPKIid: pkiid,

		incTime: uint64(time.Now().UnixNano()),
		seqNum:  uint64(0),

		channel: channel,

		logger: util.GetLogger(util.ElectionLogger, ""),

		doneCh:   make(chan struct{}),
		stopOnce: &sync.Once{},
		metrics:  metrics,
	}
}
405010
func (m *Manifest) GetAdapterNames(dir Direction) []string {
	switch dir {
	case Upload:
		return m.GetUploadAdapterNames()
	case Download:
		return m.GetDownloadAdapterNames()
	}
	return nil
}
859414
func NewAdaptor(port string) *Adaptor {
	return &Adaptor{
		name: gobot.DefaultName("Sphero"),
		port: port,
		connect: func(port string) (io.ReadWriteCloser, error) {
			return serial.Open(port, &serial.Mode{BaudRate: 115200})
		},
	}
}
964257
func (a *adapter) New(data ...interface{}) goa.LogAdapter {
	return &adapter{Entry: a.Entry.WithFields(data2rus(data))}
}
1094000
func AddAdapter(name string, adapter AdapterPod) {
	lock.Lock()
	adapters[name] = adapter
	lock.Unlock()
}
1230264
func NewStorageAdapter(bufferSize int) (*adapter, error) {
	if bufferSize <= 0 {
		return nil, fmt.Errorf("Invalid ringBuffer size: %d", bufferSize)
	}
	return &adapter{bufferSize: bufferSize, ringBuffers: make(map[string]*ringBuffer)}, nil
}
571441
func GetAdaptor(name string, conf Config) (Adaptor, error) {
	creator, ok := adaptors[name]
	if ok {
		a := creator()
		err := conf.Construct(a)
		return a, err
	}
	return nil, ErrNotFound{name}
}
113147
func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{}, store Store, resyncPeriod time.Duration) *Reflector {
	r := &Reflector{
		name:          name,
		listerWatcher: lw,
		store:         store,
		expectedType:  reflect.TypeOf(expectedType),
		period:        time.Second,
		resyncPeriod:  resyncPeriod,
		clock:         &clock.RealClock{},
	}
	return r
}
1063271
func (o *Link) CreateDemarcationService(child *DemarcationService) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
950361
func NewAdaptor() *Adaptor {
	return &Adaptor{
		name: gobot.DefaultName("Joule"),
		connect: func(e *Adaptor) (err error) {
			return
		},
		mutex: &sync.Mutex{},
	}
}
956502
func NewClientAdaptor(address string) *ClientAdaptor {
	return &ClientAdaptor{
		name:             gobot.DefaultName("BLEClient"),
		address:          address,
		DeviceName:       "default",
		connected:        false,
		withoutResponses: false,
	}
}