| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package ble
- import (
- "ai-status-light/internal/logger"
- )
- const (
- DefaultDeviceName = "AI-Light"
- )
- var modePriority = map[string]int{
- "error": 6,
- "alarm": 5,
- "thinking": 4,
- "busy": 3,
- "ai": 2,
- "traffic": 1,
- "success": 1,
- "off": 0,
- }
- func MapCodeToMode(code string) string {
- switch code {
- case "error":
- return "error"
- case "permission":
- return "alarm"
- case "reasoning":
- return "thinking"
- case "busy", "running", "using_tool", "retry", "pending":
- return "busy"
- case "idle":
- return "traffic"
- case "session_completed", "success":
- return "success"
- default:
- return "ai"
- }
- }
- func modePriorityValue(mode string) int {
- if p, ok := modePriority[mode]; ok {
- return p
- }
- return 0
- }
- func shouldUpdate(currentMode, newMode string) bool {
- return modePriorityValue(newMode) >= modePriorityValue(currentMode) || currentMode == ""
- }
- func logInfo(format string, args ...interface{}) {
- logger.Info(format, args...)
- }
- func logDebug(format string, args ...interface{}) {
- logger.Debug(format, args...)
- }
- func logError(format string, args ...interface{}) {
- logger.Error(format, args...)
- }
- func logWarn(format string, args ...interface{}) {
- logger.Warn(format, args...)
- }
|