motion


motion는 3.0.0 버전 이상 부터 제공되며 해당 라이브러리를 추가하여 사용해야 된다.

getCurrent

현재 단말의 동작 정보를 얻는다. 

successCallback

필드필드설명
result Motion 상세 정보
x단말의 x 값 
y단말의 y 값
z단말의 z 값
timestamp이벤트 발생 시간
   

errorCallback

필드설명
code에러코드
message에러메세지
  

Example

hone.channel.execute('motion', 'getCurrent', [],
   function (result) {
        alert(JSON.stringify(result));
    }, function (e) {
        alert(JSON.stringify(e));
    }
);

Result

{
"timestamp": 1491281499376,
"x": -1.7764976,
"y": 8.027759,
"z": 5.357026
}

watch

현재 단말 동작 정보를 주기적으로 얻는다.

options

필드설명비고M/O
motionId이벤트 아이디임의의 문자열M
delay화면 갱신 시간 설정

0 : FASTEST (18 ~ 20ms)

1 : GAME (37 ~ 39ms)

2 : UI (85 ~ 87ms)

3 : NORMAL (215 ~ 230ms)

M
    

successCallback

필드필드설명
result Motion 상세 정보
x단말의 x 값 
y단말의 y 값
z단말의 z 값
timestamp이벤트 발생 시간
   

errorCallback

필드설명
code에러코드
message에러메세지
  

Example

var motionId = "1000"
var delay    = 3;

hone.channel.execute('motion', 'watch', [motionId, delay],
   function (result) {
        console.log(JSON.stringify(result));
    }, function (e) {
        alert(JSON.stringify(e));
    }
);

Result

{
"timestamp": 1491281499376,
"x": -1.7764976,
"y": 8.027759,
"z": 5.357026
}

clearWatch

동작중인 watch를 종료한다.

options

필드설명비고M/O
motionId동작중인 motionIdwatch 에서 생성한 motionId 사용M
    

successCallback

필드설명
없음없음
  

errorCallback

필드설명
code에러코드
message에러메세지
  

Example

hone.channel.execute('motion', 'clearWatch', [motionId],
   function (result) {
        alert(JSON.stringify(result));
    }, function (e) {
        alert(JSON.stringify(e));
    }
);

Error Code

CodeCauseComment
E12300파라메터 값이 잘못되어 있을 경우 
E12301전달된 액션 값이 알 수 없는 액션일 경우 
E12302motion 아이디 값이 null 이거나 빈 값인 경우 
E12303화면 갱신 시간 정보가 0 ~ 3 정수값이 아닌 경우 
E12350실행 중 오류가 발생 되었을 경우 
E12351watch 요청 시 watch 아이디 값이 존재하는 경우 
E12352clearWatch 요청 시 watch 아이디 값을 찾을 수 없는 경우 
E12353Motion 정보를 얻기위한 서비스가 지원하지 않는 경우 
E12399알 수없는 오류가 발생 되었을 경우