コード例 #1
0
func (info *ClearBlade) initialize() {
	info.UserClient = clearblade.NewUserClient(SYSTEM_KEY, SYSTEM_SECRET, USERNAME, PASSWORD)
	clearblade.CB_ADDR = PLATFORM_URL

	initErr := info.UserClient.Authenticate()

	checkError(initErr)
	if initErr != nil {
		fmt.Println("Error initializing ClearBlade: %v\n", initErr)
	}
}
コード例 #2
0
func (demo *ClearBladeInfo) authenticateUser() {

	demo.UserClient = gosdk.NewUserClient(SYSTEM_KEY, SYSTEM_SECRET, USERNAME, PASSWORD)

	gosdk.CB_ADDR = "platform_address"
	gosdk.CB_MSG_ADDR = "messaging_address"

	authErr := demo.UserClient.Authenticate()

	checkError(authErr)
	if authErr != nil {
		fmt.Printf("Error Authenticating: %v\n", authErr)
	}

	if !demo.connectToMQTT() {
		os.Exit(1)
	}

	demo.publishMessage()
}
コード例 #3
0
func (demo *ClearBladeInfo) authenticateUser(msg string) {

	demo.UserClient = gosdk.NewUserClient(SYSTEM_KEY, SYSTEM_SECRET, USERNAME, PASSWORD)

	gosdk.CB_ADDR = PLATFORM_URL
	gosdk.CB_MSG_ADDR = MESSAGING_URL

	authErr := demo.UserClient.Authenticate()

	checkError(authErr)
	if authErr != nil {
		fmt.Printf("Error Authenticating: %v\n", authErr)
	}

	if !demo.connectToMQTT() {
		os.Exit(1)
	}

	demo.publishMessage(msg)
}