Electronic device for recognizing cover device and operation method thereof
An electronic device includes: a magnetic sensor; a communication module; at least one processor operatively connected with the magnetic sensor and the communication module. The at least one processor is configured to: identify that a magnetic signal is detected through the magnetic sensor; identify, based on a magnitude of the detected magnetic signal, whether the magnetic signal is generated by coupling the electronic device with a cover device; and based on identifying that the magnetic signal is generated by coupling the electronic device with the cover device, correct sensor data of the magnetic sensor.
1 . An electronic device comprising:
a magnetic sensor;
communication circuitry;
at least one processor operatively connected with the magnetic sensor and the communication circuitry; and
memory storing instructions that, when executed by the at least one processor individually or collectively, cause the electronic device to:
identify that a magnetic signal is detected through the magnetic sensor;
identify, based on a magnitude of the detected magnetic signal, whether the magnetic signal is generated by coupling the electronic device with a cover device; and
in response to the magnitude of the detected magnetic signal being indicated as the magnetic signal generated by coupling the electronic device with the cover device, correct sensor data of the magnetic sensor using correction data corresponding to the magnitude of the detected magnetic signal,
wherein the memory further stores correction data for each of a plurality of magnetic signal ranges, and
wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to correct the sensor data of the magnetic sensor by:
identifying a magnetic signal range corresponding to the magnitude of the detected magnetic signal among the plurality of magnetic signal ranges, and
correcting the sensor data of the magnetic sensor based on correction data corresponding to the identified magnetic signal range.
2 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to perform an operation based on the corrected sensor data.
3 . The electronic device of claim 2 , wherein the operation based on the corrected sensor data comprises execution of an application based on a position and a posture of the electronic device.
4 . The electronic device of claim 1 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to identify whether the electronic device is coupled with the cover device, based on the magnitude of the detected magnetic signal being greater than or equal to a threshold value.
5 . The electronic device of claim 4 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to:
receive identification information of the cover device through the communication circuitry;
authenticate the cover device, based on the identification information of the cover device received through the communication circuitry; and
based on the authentication of the cover device, correct the sensor data of the magnetic sensor by using the correction data corresponding to the identified magnetic signal range.
6 . The electronic device of claim 1 , further comprising a display,
wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to, based on identifying that the magnetic signal is generated by coupling the electronic device with the cover device, display a screen theme based on identification information of the cover device on the display.
7 . The electronic device of claim 5 , wherein the instructions, when executed by the at least one processor individually or collectively, cause the electronic device to:
identify whether the coupling of the electronic device with the cover device is released, through the communication circuitry, based on the magnitude of the magnetic signal less than the threshold value being detected in a state of being coupled with the cover device; and
based on identifying that the coupling with the cover device is released, correct the sensor data of the magnetic sensor by using correction data prior to the coupling with the cover device.
8 . The electronic device of claim 1 , wherein the magnetic sensor is mounted at a position spaced a predetermined distance apart from a position corresponding to a magnet mounted on the cover device.
9 . A method for recognizing a cover device by an electronic device, the method comprising:
identifying that a magnetic signal is detected by a magnetic sensor of the electronic device;
identifying, based on a magnitude of the detected magnetic signal, whether the detected magnetic signal is generated by coupling the electronic device with the cover device; and
in response to the magnitude of the detected magnetic signal being indicated as the magnetic signal generated by coupling the electronic device with the cover device, correcting sensor data of the magnetic sensor using correction data corresponding to the magnitude of the detected magnetic signal,
wherein the correcting the sensor data of the magnetic sensor comprises:
identifying a magnetic signal range corresponding to the magnitude of the detected magnetic signal among a plurality of magnetic signal ranges; and
correcting the sensor data of the magnetic sensor based on correction data corresponding to the identified magnetic signal range.
10 . The method of claim 9 , further comprising performing an operation based on the corrected sensor data,
wherein the operation comprises execution of an application based on a position and a posture of the electronic device.
11 . The method of claim 9 , further comprising identifying whether the electronic device is coupled with the cover device, based on the magnitude of the detected magnetic signal being greater than or equal to a threshold value,
wherein the identifying whether the electronic device is coupled with the cover device comprises:
receiving identification information of the cover device through communication circuitry of the electronic device; and
authenticating the cover device, based on the received identification information of the cover device.
12 . The method of claim 11 , wherein the correcting the sensor data of the magnetic sensor comprises, based on the authentication of the cover device, correcting the sensor data of the magnetic sensor based on the correction data corresponding to the identified magnetic signal range.
13 . The method of claim 11 , further comprising:
identifying that the coupling of the electronic device with the cover device is released, through the communication circuitry, based on the magnetic signal less than the threshold value being detected in a state of being coupled with the cover device; and
based on identifying that the coupling with the cover device is released, correcting the sensor data of the magnetic sensor by using correction data prior to the coupling with the cover device.