Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SDL_AppContest_HIROSHIMA_OEC

oec
October 19, 2019

 SDL_AppContest_HIROSHIMA_OEC

oec

October 19, 2019
Tweet

More Decks by oec

Other Decks in Programming

Transcript

  1. େ͖͘4ͭͷαϯϓϧΛ༻ҙ͠·ͨ͠  ΫϧϚͷٖࣅσʔλΛ࢖ͬͨΞϓϦ͕։ൃ͍ͨ͠  4%-ͷ6*ϨΠΞ΢τΛར༻ͯ͠։ൃ͍ͨ͠ .BOUJDPSF αϯϓϧͷछྨ ։ൃ؀ڥ  ࣗ༝ͳϨΠΞ΢τͰը໘Λ։ൃ͍ͨ͠

    4%-։ൃΩοτ 4%-։ൃΩοτ ιʔεೖखઌ IUUQTHJUIVCDPNPJD 4%-%JTQMBZ IUUQTHJUIVCDPNPJD 4%-7FIJDMF IUUQTHJUIVCDPNUBOBLB 4%-%JTQMBZ4BNQMF1SPKFDUJPO ΫϧϚͷٖࣅσʔλΛΫϥ΢υʹ஝ੵ͍ͨ͠ .BOUJDPSF  IUUQTHJUIVCDPNPJD 4%-$MPVE wιʔεͷμ΢ϯϩʔυˍ"OESPJE4UVEJPͰ։͖ɺϏϧυ·Ͱͯ͠௖͚ΔͱɺϋοΫλΠϜͷઅ໿ʹ ͳΓ·͢ wׂͱɺHSBEMFͷμ΢ϯϩʔυͱ͔ɺϏϧυ͢Δͷʹ͔͔࣌ؒΓ·͢
  2. Android StudioͰμ΢ϯϩʔυͨ͠αϯϓϧΛ։͘ /%,ϩέʔγϣϯͷ֬ೝ MPDBMQSPQFUJFTϑΝΠϧͷOELEJS͕ ࣗ෼ͷύιίϯͷύεʹมߋ͞Ε͍ͯ Ε͹׬ྃͰ͢ αϯϓϧΛऔΓࠐΉ ϝχϡʔόʔͷ<'JMF><0QFO>ΛΫ ϦοΫ͠·͢ /%,͕ೖͬͯͳ͍৔߹

    /%,ΛηοτΞοϓ͠·͢ɻ <'JMF><1SPKFDU4USVDUVSF><4%, -PDBUJPO>ͷ"OESPJE/%,MPDBUJPO ͷԼʹ͋Δz%PXOMBE"OESPJE/%,z ͔ΒΠϯετʔϧ͍ͯͩ͘͠͞ w/%,ͷϩέʔγϣϯ·Ͱઃఆ͕׬ྃ͢Ε͹ɺϓϩδΣΫτͷϏϧυ͕࢝·Γ·͢ ͬͬ .BD049 8JOEPXT 4%,-PDBUJPO /%,Πϯετʔϧ MPDBMQSPQFUJFTϑΝΠϧ
  3. ςϯϓϨʔτͷσβΠϯͬͯͲΜͳͷ͕͋Δͷʁ MEDIA MEDIA (WITH A PROGRESS BAR) NON-MEDIA GRAPHIC WITH

    TEXT TEXT WITH GRAPHIC TILES ONLY GRAPHIC WITH TILES TILES WITH GRAPHIC GRAPHIC WITH TEXT AND SOFT BUTTONS TEXT AND SOFT BUTTONS WITH GRAPHIC WITH TEXT BUTTONS GRAPHIC DOUBLE GRAPHIC WITH SOFT BUTTONS GRAPHIC WITH TILES TEXT BUTTONS ONLY LARGE GRAPHIC WITH SOFT BUTTONS LARGE GRAPHIC ONLY wશ෦Ͱ̎̌छྨͷςϯϓϨʔτ͔ΒબͿ͜ͱ͕Ͱ͖·͢ɻ
  4. ςϯϓϨʔτΛઃఆͯ͠ΈΔ private void setDisplayGraphicWithTextButtons(){ SetDisplayLayout setDisplayLayoutRequest = new SetDisplayLayout(); //GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS

    setDisplayLayoutRequest.setDisplayLayout(PredefinedLayout.GRAPHIC_WITH_TEXTBUTTONS.toString()); setDisplayLayoutRequest.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { if(((SetDisplayLayoutResponse) response).getSuccess()){ Log.i("SdlService", "Display layout set successfully."); w4%-୺຤ʹΑͬͯɺ࢖͑ͳ͍ςϯϓϨʔτ͕͋Γ·͢ɻ࣍ʹͦͷௐ΂ํʹ͍͓ͭͯ఻͑͠·͢ SdlService.javaͷ213ߦ໨ ςϯϓϨʔτ໊Λॻ͘ͷΈ setOnRPCResponseListenerͰ ςϯϓϨʔτΛઃఆ
  5. SDL୺຤Ͱར༻Ͱ͖ΔςϯϓϨʔτ໊Λ೺Ѳ͢Δ private void checkTemplateType(){ Object result = sdlManager.getSystemCapabilityManager().getCapability(SystemCapabilityType.DISPLAY); if( result

    instanceof DisplayCapabilities){ List<String> templates = ((DisplayCapabilities) result).getTemplatesAvailable(); Log.i("Templete", templates.toString()); } } SdlService.javaͷ198ߦ໨ wΫϥ΢υγϛϡϨʔλͷ.BOUJDPSF΍4%-୺຤Αͬͯҧ͍͕͋ΔͷͰɺαϯϓϧΛίϐʔͯ͠Ξϓ ϦΛ࡞Δ৔߹ɺ͜ͷϩδοΫ͸ফͣ͞ʹ࢒͓͖ͯ͠·͠ΐ͏ɻ getTemplatesAvailableͰར༻ՄೳͳςϯϓϨʔτ໊͕ϦετͰฦ٫ ͞Ε·͢
  6. wSFTESBXCMFʹQOHը૾Λίϐϖͯ͠ɺ4EM"SUXPSLͷϑΝΠϧ໊Λॻ͖׵͑Ε͹޷͖ͳը૾ʹมߋ Ͱ͖·͢ GRAPHIC WITH TEXTBUTTONSʹը૾Λઃఆ͢Δ ͜ͷ෦෼ͷը૾ sdlManager.getScreenManager().beginTransaction(); //ςΩετΛొ࿥͢Δ৔߹ //sdlManager.getScreenManager().setTextField1("Hello, this

    is MainField1."); //ը૾Λొ࿥͢Δ SdlArtwork artwork = new SdlArtwork("clap.png", FileType.GRAPHIC_PNG, R.drawable.clap, true); sdlManager.getScreenManager().setPrimaryGraphic(artwork); sdlManager.getScreenManager().commit(new CompletionListener() { @Override public void onComplete(boolean success) { if (success) { Log.i(TAG, "welcome show successful"); } } }); SdlService.javaͷ223ߦ໨ ϑΝΠϧ໊Λઃఆ ͜͜Ͱ͸clap.pngɺR.drawble.clap res/drawableʹදࣔ͠ ͨը૾ΛೖΕ·͢
  7. wϘλϯͷઃఆͱɺPO1SFTTͰ4%-։ൃΩοτͷը໘͕λοϓ͞Εͨ৔߹ͷڍಈΛఆٛͰ͖·͢ɻ GRAPHIC WITH TEXTBUTTONSʹϘλϯΛઃఆ͢Δ ͜ͷ෦෼ SoftButtonState softButton02State1 = new SoftButtonState("button02_state1",

    "button02_state1", null); SoftButtonObject softButtonObject2 = new SoftButtonObject("softButtonObject02", Collections.singletonList(softButton02State1), softButton02State1.getName(), null); softButtonObject2.setOnEventListener(new SoftButtonObject.OnEventListener() { @Override public void onPress(SoftButtonObject softButtonObject, OnButtonPress onButtonPress) { sdlManager.getScreenManager().beginTransaction(); //ը૾Λొ࿥͢Δ SdlArtwork artwork = new SdlArtwork("oldman.png", FileType.GRAPHIC_PNG, R.drawable.oldman, true); sdlManager.getScreenManager().setPrimaryGraphic(artwork); sdlManager.getScreenManager().commit(new CompletionListener() { @Override public void onComplete(boolean success) { if (success) { Log.i(TAG, "welcome show successful"); } } }); } @Override public void onEvent(SoftButtonObject softButtonObject, OnButtonEvent onButtonEvent) { } }); List<SoftButtonObject> buttons = Arrays.asList(softButtonObject1, softButtonObject2); //ϘλϯΛొ࿥͢Δ sdlManager.getScreenManager().setSoftButtonObjects(buttons); SdlService.javaͷ263ߦ໨ ը໘ͷλοϓΠϕϯτΛݕग़Ͱ͖Δ αϯϓϧ͸λοϓ͞ΕͨΒը૾Λมߋ͢Δ λοϓͯ͠มߋ͢Δը૾
  8. ManticoreͷσʔλΛͲ͏ΞϓϦͰऔಘ͍ͯ͠Δʁ //͜ΕΛ͢Δͱఆظతʹσʔλ͕औಘՄೳ sdlManager.addOnRPCNotificationListener(FunctionID.ON_VEHICLE_DATA, new OnRPCNotificationListener() { @Override public void onNotified(RPCNotification

    notification) { OnVehicleData onVehicleDataNotification = (OnVehicleData) notification; sdlManager.getScreenManager().beginTransaction(); SdlArtwork artwork = null; //ճస਺͕3000Ҏ্͔ɺҎԼͰը૾Λ੾Γସ͑Δ Integer rpm = onVehicleDataNotification.getRpm(); ͜ͷ෦෼ͷΤϯδϯճస਺Λ औಘ͢Δ SdlService.javaͷ172ߦ໨ wTEM.BOBHFSBEE0O31$/PUJpDBUJPO-JTUFOFSʹΑΓఆظతʹΫϧϚͷσʔλ͕औಘՄೳ wPO7FIJDMF%BUB/PUJpDBUJPO͔ΒɺΫϧϚͷσʔλΛऔΓग़͢͜ͱ͕Ͱ͖Δ ͜͜Ͱճస਺Λऔಘ͍ͯ͠Δ
  9. ఆظతʹऔಘ͢Δσʔλ͸ඞͣઃఆ͢Δඞཁ͋Γ //͜ΕΛ͢Δͱఆظతʹσʔλ͕औಘՄೳ SubscribeVehicleData subscribeRequest = new SubscribeVehicleData(); subscribeRequest.setRpm(true); //Τϯδϯճస਺ subscribeRequest.setPrndl(true);

    //γϑτϨʔόͷঢ়ଶ subscribeRequest.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { if (response.getSuccess()) { Log.i("SdlService", "Successfully subscribed to vehicle data."); } else { Log.i("SdlService", "Request to subscribe to vehicle data was rejected."); } } }); sdlManager.sendRPC(subscribeRequest); ͜ͷ෦෼ͷΤϯδϯճస਺Λ औಘ͢Δ SdlService.javaͷ366ߦ໨ w͜ͷઃఆΛ͍ͯ͠ͳ͍ͱΫϧϚͷσʔλΛఆظऔಘͰ͖ͳ͍ͷͰ͝஫ҙ͍ͩ͘͞ɻ w߲໨Λ૿΍͢ͷ͸ɺTVCTDSJCF3FRVFTUTFUऔΓ͍߲ͨ໨໊ USVF Ͱ0,Ͱ͢ɻ ߲໨͝ͱʹTrueΛઃఆ
  10. ं྆σʔλ ϝιου ܕ આ໌ GPS getGps GPSData Ң౓ɺܦ౓ɺ଎౓ͳͲͷGPSσʔλ ଎౓ getSpeed

    Double ं଎(KPH) RPM getRpm Integer Τϯδϯͷຖ෼ճస਺ ೩ྉϨϕϧ getFuelLevel Double λϯΫ಺ͷ೩ྉϨϕϧʢύʔηϯτʣ ೩ྉϨϕϧঢ়ଶ getFuelLevel_State ComponentVolumeStatus ೩ྉϨϕϧͷঢ়ଶ ೩ྉൣғ getFuelRange List< FuelRange > ೩ྉϨϕϧͱফඅྔʹج͍ͮͯं͕྆૸ߦͰ͖Δkmͷ ਪఆൣғ Πϯελϯτ೩අ getInstantFuelConsumption Double ϚΠΫϩϦοτϧͰͷॠؒతͳ೩ྉফඅྔ ֎ؾԹ getExternalTemperature Double ઁࢯԹ౓Ͱͷ֎෦Թ౓ VIN getVin String ं྆ࣝผ൪߸ PRNDL getPrndl PRNDL બ୒͞ΕͨΪΞ λΠϠۭؾѹ getTirePressure TireStatus ं྆ͷ֤ϗΠʔϧͷλΠϠঢ়ଶ Φυϝʔλʔ getOdometer Integer ૸ߦڑ཭ܭ(Km) ϕϧτঢ়ଶ getBeltStatus BeltStatus ֤γʔτϕϧτͷঢ়ଶ ϘσΟ৘ใ getBodyInformation BodyInformation ֤ंମͷঢ়ଶʢυΞ΍ɺ఺ՐεςʔλεͳͲʣ ं྆σʔλ ϝιου ܕ આ໌ σόΠεεςʔλε getDeviceStatus DeviceStatus εϚʔτϑΥϯσόΠεʹؔ͢Δ৘ใ ӡసऀϒϨʔΩ getDriverBraking VehicleDataEventSt atus ϒϨʔΩϖμϧͷঢ়ଶ ϫΠύʔঢ়ଶ getWiperStatus WiperStatus ϫΠύʔͷঢ়ଶ ϔουϥϯϓͷঢ়ଶ getHeadLampStatus HeadLampStatus ϔουϥϯϓͷঢ়ଶ ΤϯδϯτϧΫ getEngineTorque Double σΟʔθϧҎ֎ͷΤϯδϯͷτϧΫ஋ ʢNmʣ ΤϯδϯΦΠϧͷण ໋ getEngineOilLife Float Τϯδϯͷ࢒ଘΦΠϧण໋ͷਪఆׂ߹ ΞΫηϧϖμϧҐஔ getAccPedalPosition Double ΞΫηϧϖμϧͷҐஔʢύʔηϯτʣ ϋϯυϧ֯ getSteeringWheelAng le Double εςΞϦϯάϗΠʔϧͷݱࡏͷ֯౓ ʢ౓ʣ Eίʔϧ৘ใ getECallInfo ECallInfo ۓٸ௨ใͷঢ়گʹؔ͢Δ৘ใ ΤΞόοάͷঢ়ଶ getAirbagStatus AirbagStatus ं྆಺ͷ֤ΤΞόοάͷঢ়ଶ ۓٸΠϕϯτ getEmergencyEvent EmergencyEvent ۓٸͷঢ়گ ΫϥελϞʔυͷঢ় ଶ getClusterModeStatus ClusterModeStatus ిྗϞʔυ͕ΞΫςΟϒ͔Ͳ͏͔ My Key getMyKey MyKey ۓٸ911ͳͲͷ৘ใ ΢ΠϯΧʔ getTurnSignal TurnSignal ํ޲ࢦࣔثͷঢ়ଶ ిࢠύʔΩϯάϒϨ ʔΩͷঢ়ଶ getElectronicParkBrak eStatus ElectronicParkBrak eStatus ύʔΫϒϨʔΩͷεςʔλε wϝιουͷྻʹHFUͱॻ͍ͯ·͕͢ɺఆظతʹऔಘ͍ͨ͠σʔλ͸HFUΛTFUʹಡΈସ͑ͯ5SVFઃఆ ͍ͯͩ͘͠͞ ΫϧϚ(Manticore)͔ΒऔಘͰ͖ΔΫϧϚͷσʔλ
  11. Ͳ͏΍ͬͯผͷαʔϏεʹσʔλΛૹ͍ͬͯΔ͔ʁ public void doPost(String url,String engineRPM) throws IOException { final

    FormBody.Builder formBodyBuilder = new FormBody.Builder(); //POST͢Δσʔλ formBodyBuilder.add("engine", engineRPM); final Request request = new Request.Builder() .url(url) .header("User-Agent", "SDL client") .post(formBodyBuilder.build()) .build(); OkHttpClient client = new OkHttpClient.Builder() .build(); //ಉظݺͼग़͠ Response response = client.newCall(request).execute(); } w0L)UUQͷϥΠϒϥϦΛ׆༻ͯ͠ɺࢦఆͷ63-ʹ1045͍ͯ͠·͢ɻ //͜ΕΛ͢Δͱఆظతʹσʔλ͕औಘՄೳ sdlManager.addOnRPCNotificationListener(FunctionID.ON_VEHICLE_DATA, new OnRPCNotificationListener() { @Override public void onNotified(RPCNotification notification) { OnVehicleData onVehicleDataNotification = (OnVehicleData) notification; sdlManager.getScreenManager().beginTransaction(); //Τϯδϯճస਺ΛࢦఆURLʹHTTP POST͢Δ try { //FIXME POST͢ΔURLΛॻ͍ͯͶ doPost("https://υϝΠϯ",onVehicleDataNotification.getRpm().toString()); } catch (IOException e) { //FIXME ͪΌΜͱΤϥʔॲཧͯ͠Ͷ e.printStackTrace(); } SdlService.javaͷ225ߦ໨ ͜͜ͰURLͱσʔλΛηοτ͍ͯ͠Δ SdlService.javaͷ95ߦ໨ POSTσʔλͱͯ͠ηοτ
  12. ΫϧϚͷऔಘ߲໨Λ૿΍͢ͷ͸ɺ3ষͱಉ͡ //͜ΕΛ͢Δͱఆظతʹσʔλ͕औಘՄೳ SubscribeVehicleData subscribeRequest = new SubscribeVehicleData(); subscribeRequest.setRpm(true); //Τϯδϯճస਺ subscribeRequest.setPrndl(true);

    //γϑτϨʔόͷঢ়ଶ subscribeRequest.setOnRPCResponseListener(new OnRPCResponseListener() { @Override public void onResponse(int correlationId, RPCResponse response) { if (response.getSuccess()) { Log.i("SdlService", "Successfully subscribed to vehicle data."); } else { Log.i("SdlService", "Request to subscribe to vehicle data was rejected."); } } }); sdlManager.sendRPC(subscribeRequest); ͜ͷ෦෼ͷΤϯδϯճస਺Λ औಘ͢Δ SdlService.javaͷ429ߦ໨ w߲໨Λ૿΍͢ͷ͸ɺTVCTDSJCF3FRVFTUTFUऔΓ͍߲ͨ໨໊ USVF Ͱ0,Ͱ͢ɻ ߲໨͝ͱʹTrueΛઃఆ
  13. શମ౼ٞ(Q&A͡Όͳ͍w) ❖ ͜Μͳ࣭໰Λ͍ͯͩ͘͠͞ ❖ ͜ΜͳΞΠσΟΞΛ࡞ͬͯΈ͍͚ͨͲɺͲͷαϯϓϧ࢖͏/ͲΜͳٕज़࢖͏ͱਐΊ΍͍͔͢ʁ ❖ ΫϧϚ/όΠΫͷϝʔΧʔ͞Μ͕ࢥ͏ɺʮΫϧϚͱεϚϗ͕஥ྑ͘͢Δʯͱ͸ʁ ❖ Ұ୴ɺࢲ͕࣭໰Λड͚·͕͢ɺ͜ΜͳΜ࢖͑͹͍͍Μ͡Όͳ͍͔తͳ։ൃͷΞΠσΟΞ͕͋Δ ਓ͸ɺੋඇखΛڍ͛ͯ౴͑ͯΈ͍ͯͩ͘͞ɻ

    ❖ ͠ʔΜɺͱͯͨ͠Βࢲ͕͠Ό΂Γ·͢ʢ΋͘͠͸ɺاۀ͞Μ/ӡӦαΠυʹ౤͛·͢) ❖ ࢲ΋ߟ͔͑ͭͳ͔ͬͨΒɺݩ໦͞Μ͕གྷΓ·͢ʢແ஡ৼΓʣ ڞײ͢ΔਓΛࠓޙͷνʔϜϏϧσΟϯάʹऒ͖͚ͭΔʹ͸ɺ͜͜Ͱࣗ෼ͷΞΠ σΟΞΛগ͠ग़͢ͷ΋खͰ͢ ʢ͜͜ͰωλΛग़ͯ͠΋ɺ͜ͷ೔ͰωλΛຏ࣌ؒ͘͸ͨͬ΀Γ͋Γ·͢ʣ