function addRow(str1, str2) {
	var table = document.getElementById("table1");
	var rowlen = table.rows.length;
	var row = table.insertRow(rowlen-1);
	row.insertCell(0).innerHTML = str1;
	row.insertCell(1).innerHTML = str2;
}

function onSuccessCallbackPower(power) {
	addRow("power Level : ", power.level*100);
	addRow("Power isCharging : " , power.isCharging);
    console.log("Power Level : " + power.level);
    console.log("Power isCharging : " + power.isCharging);
}



function onSuccessCallbackCpu(cpu) {
	addRow("Cpu : " , cpu.load + "GHz");
    console.log("Cpu : " + cpu.load);
}



function onSuccessCallbackStorage(storage) {
	addRow("Storage : " + storage.units);
    console.log("Storage : " + storage.units);
}



function onSuccessCallbackDisplay(display) {
	addRow("resolutionWidth : " , display.resolutionWidth);
	addRow("resolutionHeight : " , display.resolutionHeight);
	addRow("dotsPerInchWidth : " , display.dotsPerInchWidth);
	addRow("dotsPerInchHeight : " , display.dotsPerInchHeight);
	addRow("physicalWidth : " , display.physicalWidth);
	addRow("physicalHeight : " , display.physicalHeight);
	addRow("brightness : " , display.brightness);

	console.log("resolutionWidth : " + display.resolutionWidth);
    console.log("resolutionHeight : " + display.resolutionHeight);
    console.log("dotsPerInchWidth : " + display.dotsPerInchWidth);
    console.log("dotsPerInchHeight : " + display.dotsPerInchHeight);
    console.log("physicalWidth : " + display.physicalWidth);
    console.log("physicalHeight : " + display.physicalHeight);
    console.log("brightness : " + display.brightness);
}

function onSuccessCallbackDevice(device) {
	addRow("imei : " , device.imei);
    addRow("model : " , device.model);
    addRow("version : " , device.version);
    addRow("vendor : " , device.vendor);
	
    console.log("imei : " + device.imei);
    console.log("model : " + device.model);
    console.log("version : " + device.version);
    console.log("vendor : " + device.vendor);
}


function onSuccessCallbackWifiNetwork(wifi) {
	addRow("status : " , wifi.status);
    addRow("ssid : " , wifi.ssid);
    addRow("ipAddress : " , wifi.ipAddress);
    addRow("signalStrength : " , wifi.signalStrength);

    console.log("status : " + wifi.status);
    console.log("ssid : " + wifi.ssid);
    console.log("ipAddress : " + wifi.ipAddress);
    console.log("signalStrength : " + wifi.signalStrength);
}

function onSuccessCallbackCellularNetwork(cell) {
	addRow("status : " , cell.status);
	addRow("apn : " , cell.apn);
	addRow("ip : " , cell.ipAddress);
	addRow("mcc : " , cell.mcc);
	addRow("mnc : " , cell.mnc);
	addRow("cell id : " , cell.cellId);
	addRow("lac : " , cell.lac);
	addRow("roaming : " , cell.isRoaming);

	console.log("status : " + cell.status);
    console.log("apn : " + cell.apn);
    console.log("ip : " + cell.ipAddress);
    console.log("mcc : " + cell.mcc);
    console.log("mnc : " + cell.mnc);
    console.log("cell id : " + cell.cellId);
    console.log("lac : " + cell.lac);
    console.log("roaming : " + cell.isRoaming);
}

function onErrorCallback(error) {
	console.log("An error occurred " + error.message);
}

webapis.systeminfo.getPropertyValue("Power", onSuccessCallbackPower, onErrorCallback);
webapis.systeminfo.getPropertyValue("Cpu", onSuccessCallbackCpu, onErrorCallback);
webapis.systeminfo.getPropertyValue("Storage", onSuccessCallbackStorage, onErrorCallback);
webapis.systeminfo.getPropertyValue("Display", onSuccessCallbackDisplay, onErrorCallback);
webapis.systeminfo.getPropertyValue("Device", onSuccessCallbackDevice, onErrorCallback);
webapis.systeminfo.getPropertyValue("WifiNetwork", onSuccessCallbackWifiNetwork, onErrorCallback);
webapis.systeminfo.getPropertyValue("CellularNetwork", onSuccessCallbackCellularNetwork, onErrorCallback);

'Tip & Tech > Samsung Web API' 카테고리의 다른 글

Samsung Web API 사용하기 - 1. 소개 및 설치  (0) 2013.02.08
posted by 알 수 없는 사용자

Samsung Web API는 Samsung에서 제작한 스마트 디바이스들에서 실행되는 하이브리드 앱을 만들기 위한 API입니다.

홈페이지를 보면 현재 지원가능한 디바이스는 갤럭시S3, 갤럭시 노트 2, 2012년 이후에 생상된 스마트TV입니다.

시간이 지나면 지원되는 기기가 많아질꺼라고 되있네요. 현재는 배타버전이라 지원하는 기기가 적네요.

아래는 홈페이지에 써있는 지원기기 목록입니다.

The Samsung Web API supports GALAXY S3 and GALAXY Note II devices. The list of supported devices will continue to grow.
The Samsung Web API will support Smart TVs manufactured since 2012. (and will be supported by a Smart Hub update in 2013)


먼저 Samsung Web API로 개발하려면 Web App SDK를 다운로드 받아야 합니다.

http://developer.samsung.com/SamsungWebAPI 하단에서 SDK를 다운로드 받을 수 있고 압축을 풀고 설치를 하면 됩니다.

설치를 하면 Eclipse 기반의 Samsung Web App SDK가 포함된 IDE, 크롬 기반의 Android Web Simulator Application, 웹 어플리케이션을 디자인 할 수 있는 Web App Designer 가 설치됩니다

IDE는 ADT(Android Development Tool) Bundle과 유사한 형태입니다. IDE를 실행하면 Eclipse가 실행됩니다.

프로젝트를 만들고 해당 프로젝트를 Run(Ctrl + F11)하면 Android Web Simulator Application과 Web App Designer를 실행시킬 수 있습니다.

Android Web Simulator Application는 말그대로 웹 어플리케이션을 시뮬레이트할 수 있는 툴이고

Web App Designer는 편하게 UI를 만들 수 있는 툴인데 이 툴에서 작업을 하면 HTML파일과 CSS파일에 자동으로 등록이 되서 예전에 쓰던 나모웹에디터나 드림위버에서 UI를 편하게 배치할 수 있던것과 비슷하네요. 상당히 깔끔하게 잘 만들어 졌습니다.

어떤것 때문에 설치버전이 필요한지 모르겠지만 ADT Bundle처럼 SDK와 Eclipse가 포함된 무설치 버전으로 배포되었으면 좋겠네요.

또한 이클립스 플러그인으로 제공되었으면 좋겠습니다. 아마도 정식버전이 출시되면 같이 나오지 않을까 생각됩니다.

'Tip & Tech > Samsung Web API' 카테고리의 다른 글

Samsung Web API - 3. System Information  (0) 2013.03.13
posted by 알 수 없는 사용자