Documentation ¶
Overview ¶
Copyright 2018 the original author or authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Copyright 2018 the original author or authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 the original author or authors ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 the original author or authors ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
const AccountAndVerify = "fff2"
AccountAndVerify WRITE
const DeviceName = "iBBQ"
DeviceName is the name we look for when we scan.
const HistoryData = "fff3"
HistoryData NOTIFY
const RealTimeData = "fff4"
RealTimeData NOTIFY
const SettingData = "fff5"
SettingData WRITE
const SettingResult = "fff1"
SettingResult NOTIFY
Variables ¶
var ( // Credentials stores our login credentials for the thermometer. Credentials = []byte{0x21, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0xb8, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00} )
var DefaultConfiguration = Configuration{ ConnectTimeout: 60 * time.Second, BatteryPollingInterval: 5 * time.Minute, }
DefaultConfiguration is a somewhat sane default.
Functions ¶
Types ¶
type BatteryLevelReceivedHandler ¶
type BatteryLevelReceivedHandler func(int)
BatteryLevelReceivedHandler is a callback for battery readings. All battery readings are returned as percentages.
type Configuration ¶
type Configuration struct { ConnectTimeout time.Duration `description:"Connection timeout"` BatteryPollingInterval time.Duration `description:"Battery level polling interval"` }
Configuration configures our ibbq session
func NewConfiguration ¶
func NewConfiguration(connectTimeout time.Duration, batteryPollingInterval time.Duration) (Configuration, error)
NewConfiguration creates a configuration
type DisconnectedHandler ¶
type DisconnectedHandler func()
DisconnectedHandler handles disconnection events
type Ibbq ¶
type Ibbq struct {
// contains filtered or unexported fields
}
Ibbq is an instance of the thermometer
func NewIbbq ¶
func NewIbbq(ctx context.Context, config Configuration, disconnectedHandler DisconnectedHandler, temperatureReceivedHandler TemperatureReceivedHandler, batteryLevelReceivedHandler BatteryLevelReceivedHandler, statusUpdatedHandler StatusUpdatedHandler) (ibbq Ibbq, err error)
NewIbbq creates a new Ibbq
func (*Ibbq) ConfigureTemperatureCelsius ¶
ConfigureTemperatureCelsius changes the device to display temperatures in Celsius on the screen. It does not change the units sent back over the wire, however, which are always in Celsius.
func (*Ibbq) ConfigureTemperatureFahrenheit ¶
ConfigureTemperatureFahrenheit changes the device to display temperatures in Fahrenheit on the screen. It does not change the units sent back over the wire, however, which are always in Celsius.
func (*Ibbq) Disconnect ¶
Disconnect disconnects from an ibbq
type Status ¶
type Status string
Status represents our connection status
const ( // Disconnected means we are not connected Disconnected Status = "Disconnected" //Connecting means we are establishing a connection/session Connecting Status = "Connecting" // Connected means we have established a connection/session Connected Status = "Connected" // Disconnecting means we have requested to disconnect and are awaiting acknowledgement Disconnecting Status = "Disconnecting" )
type StatusUpdatedHandler ¶
type StatusUpdatedHandler func(Status)
StatusUpdatedHandler is a callback for status updates.
type TemperatureReceivedHandler ¶
type TemperatureReceivedHandler func([]float64)
TemperatureReceivedHandler is a callback for temperature readings. All temperature readings are returned in celsius.