コード例 #1
0
ファイル: app.go プロジェクト: lindsaymarkward/app-twitter
// Start the app, set up Twitter API, create LED pane
func (a *TwitterApp) Start(m *TwitterAppModel) error {
	log.Infof("Starting Twitter app with config: %v", m)
	a.config = m

	// for clearing tweets (testing)
	//	a.config.TweetNames = nil
	//	a.config.Tweets = nil

	// initialise Twitter API and set Initialised state (don't try if account isn't set)
	if a.config.Account.Username != "" {
		// check
		go a.InitTwitterAPI(a.config.Account)
	} else {
		a.Initialised = false
	}

	a.Conn.MustExportService(&ConfigService{a}, "$app/"+a.Info.ID+"/configure", &model.ServiceAnnouncement{
		Schema: "/protocol/configuration",
	})

	log.Infof("Making new pane for Twitter...")
	pane := NewLEDPane(a)

	// Export our newly made pane
	a.led = remote.NewTCPMatrix(pane, fmt.Sprintf("%s:%d", host, port))

	return nil
}
コード例 #2
0
ファイル: main.go プロジェクト: ninjasphere/app-ac-pane
func (a *App) Start(cfg *Config) error {

	// Create our pane. Must implement (github.com/ninjasphere/go-ninja/remote).pane
	pane := NewACPane(a.Conn)

	// Export our pane over this interface
	a.led = remote.NewTCPMatrix(pane, fmt.Sprintf("%s:%d", host, port))

	return nil
}
コード例 #3
0
// Start the app (called by the system)
func (a *App) Start(cfg *RuntimeConfig) error {
	// save some text to display (to show we can access app data from LED pane)
	a.textData = "OK!"
	log.Infof("Making new pane...")
	// The pane must implement the remote.pane interface
	pane := NewDemoPane(a)

	// Export our pane over TCP
	a.led = remote.NewTCPMatrix(pane, fmt.Sprintf("%s:%d", host, port))

	// TODO: try a second NewMatrix - see if we can swipe between them

	return nil
}