export type CompassErrorCode =
	601 |
	602 |
	603 |
	604 |
	701 |
	702 |
	703 |
	704 |
	801 |
	802 |
	803 |
	804 |
	501 |
	502 |
	503 |
	504 |
	901

export interface ICompassError extends IUniError {
	errCode : CompassErrorCode
}

export type CompassSuccess = {
	errMsg ?: string | null
}

export type CompassAccuracy = number | string | null

export type CompassFail = ICompassError
export type CompassSuccessCallback = (res : CompassSuccess) => void
export type CompassFailCallback = (res : CompassFail) => void
export type CompassComplete = CompassSuccess | CompassFail
export type CompassCompleteCallback = (res : CompassComplete) => void

export type StartCompassOptions = {
	success ?: CompassSuccessCallback | null
	fail ?: CompassFailCallback | null
	complete ?: CompassCompleteCallback | null
}

export type StopCompassOptions = {
	success ?: CompassSuccessCallback | null
	fail ?: CompassFailCallback | null
	complete ?: CompassCompleteCallback | null
}

export type OnCompassChangeSuccess = {
	direction : number
	accuracy ?: CompassAccuracy
	errMsg ?: string | null
}

export type OnCompassChange = (result : OnCompassChangeSuccess) => void

export interface Uni {
	/**
	 * 监听罗盘数据变化事件。频率：5 次/秒，接口调用后会自动开始监听
	 * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/compass.html#oncompasschange
   * @tutorial_uni_app https://uniapp.dcloud.net.cn/api/system/compass.html#oncompasschange
   * @tutorial_uni_app_x https://doc.dcloud.net.cn/uni-app-x/api/compass.html#oncompasschange
   *
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "5.08",
   * 			"unixVer": "5.08"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "5.08",
   * 			"unixVer": "5.08"
   * 		},
   *    "harmony": {
   *      "osVer": "5.0.0",
   *      "uniVer": "5.08",
   *      "unixVer": "5.08",
   *      "unixvVer": "5.08"
   *    }
   * 	},
   *   "web": {
   *     "uniVer": "√",
   *     "unixVer": "4.0"
   *   },
   *  "mp":{
   *    "weixin": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "4.41"
   *    },
   *    "alipay": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "baidu": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "toutiao": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "lark": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "qq": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "kuaishou": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "jd": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    }
   *  }
   * }
	 */
	onCompassChange(callback : OnCompassChange) : void;
	/**
	 * 取消监听罗盘数据
	 * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/compass.html#offcompasschange
   * @tutorial_uni_app https://uniapp.dcloud.net.cn/api/system/compass.html#offcompasschange
   * @tutorial_uni_app_x https://doc.dcloud.net.cn/uni-app-x/api/compass.html#offcompasschange
   *
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "5.08",
   * 			"unixVer": "5.08"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "5.08",
   * 			"unixVer": "5.08"
   * 		},
   *    "harmony": {
   *      "osVer": "5.0.0",
   *      "uniVer": "5.08",
   *      "unixVer": "5.08",
   *      "unixvVer": "5.08"
   *    }
   * 	},
   *   "web": {
   *     "uniVer": "√",
   *     "unixVer": "4.0"
   *   },
   *  "mp":{
   *    "weixin": {
   *      "hostVer": "2.9.3",
   *      "uniVer": "√",
   *      "unixVer": "4.41"
   *    },
   *    "alipay": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "baidu": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "toutiao": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "lark": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "qq": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "kuaishou": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "jd": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    }
   *  }
   * }
	 */
	offCompassChange(callback : OnCompassChange) : void;
	/**
	 * 开始监听罗盘数据
	 * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/compass.html#startcompass
   * @tutorial_uni_app https://uniapp.dcloud.net.cn/api/system/compass.html#startcompass
   * @tutorial_uni_app_x https://doc.dcloud.net.cn/uni-app-x/api/compass.html#startcompass
   *
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "5.08",
   * 			"unixVer": "5.08"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "5.08",
   * 			"unixVer": "5.08"
   * 		},
   *    "harmony": {
   *      "osVer": "5.0.0",
   *      "uniVer": "5.08",
   *      "unixVer": "5.08",
   *      "unixvVer": "5.08"
   *    }
   * 	},
   *   "web": {
   *     "uniVer": "√",
   *     "unixVer": "4.0"
   *   },
   *  "mp":{
   *    "weixin": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "4.41"
   *    },
   *    "alipay": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "baidu": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "toutiao": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "lark": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "qq": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "kuaishou": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "jd": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    }
   *  }
   * }
	 */
	startCompass(options ?: StartCompassOptions | null) : void;
	/**
	 * 停止监听罗盘数据
	 * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/compass.html#stopcompass
   * @tutorial_uni_app https://uniapp.dcloud.net.cn/api/system/compass.html#stopcompass
   * @tutorial_uni_app_x https://doc.dcloud.net.cn/uni-app-x/api/compass.html#stopcompass
   *
   * @uniPlatform {
   * 	"app": {
   * 		"android": {
   * 			"osVer": "5.0",
   * 			"uniVer": "5.08",
   * 			"unixVer": "5.08"
   * 		},
   * 		"ios": {
   * 			"osVer": "12.0",
   * 			"uniVer": "5.08",
   * 			"unixVer": "5.08"
   * 		},
   *    "harmony": {
   *      "osVer": "5.0.0",
   *      "uniVer": "5.08",
   *      "unixVer": "5.08",
   *      "unixvVer": "5.08"
   *    }
   * 	},
   *   "web": {
   *     "uniVer": "√",
   *     "unixVer": "4.0"
   *   },
   *  "mp":{
   *    "weixin": {
   *      "hostVer": "√",
   *      "uniVer": "√",
   *      "unixVer": "4.41"
   *    },
   *    "alipay": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "baidu": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "toutiao": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "lark": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "qq": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "kuaishou": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    },
   *    "jd": {
   *      "hostVer": "x",
   *      "uniVer": "x",
   *      "unixVer": "x"
   *    }
   *  }
   * }
	 */
	stopCompass(options ?: StopCompassOptions | null) : void;
}
