diff --git a/src/main/java/org/prebid/server/bidder/aceex/AceexBidder.java b/src/main/java/org/prebid/server/bidder/aceex/AceexBidder.java new file mode 100644 index 00000000000..9d35c0e54a4 --- /dev/null +++ b/src/main/java/org/prebid/server/bidder/aceex/AceexBidder.java @@ -0,0 +1,124 @@ +package org.prebid.server.bidder.aceex; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.iab.openrtb.request.BidRequest; +import com.iab.openrtb.request.Device; +import com.iab.openrtb.request.Imp; +import com.iab.openrtb.response.BidResponse; +import com.iab.openrtb.response.SeatBid; +import io.vertx.core.MultiMap; +import io.vertx.core.http.HttpMethod; +import org.apache.commons.collections4.CollectionUtils; +import org.prebid.server.bidder.Bidder; +import org.prebid.server.bidder.model.BidderBid; +import org.prebid.server.bidder.model.BidderError; +import org.prebid.server.bidder.model.HttpCall; +import org.prebid.server.bidder.model.HttpRequest; +import org.prebid.server.bidder.model.Result; +import org.prebid.server.exception.PreBidException; +import org.prebid.server.json.DecodeException; +import org.prebid.server.json.JacksonMapper; +import org.prebid.server.proto.openrtb.ext.ExtPrebid; +import org.prebid.server.proto.openrtb.ext.request.aceex.ExtImpAceex; +import org.prebid.server.proto.openrtb.ext.response.BidType; +import org.prebid.server.util.HttpUtil; +import org.prebid.server.util.ObjectUtil; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +public class AceexBidder implements Bidder { + + private static final TypeReference> ACEEX_EXT_TYPE_REFERENCE = + new TypeReference>() { + }; + private static final String ACCOUNT_ID_MACRO = "{{AccountId}}"; + private static final String X_OPENRTB_VERSION = "2.5"; + + private final String endpointUrl; + private final JacksonMapper mapper; + + public AceexBidder(String endpointUrl, JacksonMapper mapper) { + this.endpointUrl = HttpUtil.validateUrl(Objects.requireNonNull(endpointUrl)); + this.mapper = Objects.requireNonNull(mapper); + } + + @Override + public Result>> makeHttpRequests(BidRequest request) { + final Imp firstImp = request.getImp().get(0); + final ExtImpAceex extImpAceex; + + try { + extImpAceex = mapper.mapper().convertValue(firstImp.getExt(), ACEEX_EXT_TYPE_REFERENCE).getBidder(); + } catch (IllegalArgumentException e) { + return Result.withError(BidderError.badInput("Ext.bidder not provided")); + } + + return Result.withValue(HttpRequest.builder() + .method(HttpMethod.POST) + .uri(resolveEndpoint(extImpAceex.getAccountId())) + .headers(constructHeaders(request)) + .body(mapper.encode(request)) + .payload(request) + .build()); + } + + private String resolveEndpoint(String accountId) { + return endpointUrl.replace(ACCOUNT_ID_MACRO, HttpUtil.encodeUrl(accountId)); + } + + private static MultiMap constructHeaders(BidRequest bidRequest) { + final Device device = bidRequest.getDevice(); + MultiMap headers = HttpUtil.headers(); + + headers.set(HttpUtil.X_OPENRTB_VERSION_HEADER, X_OPENRTB_VERSION); + HttpUtil.addHeaderIfValueIsNotEmpty(headers, HttpUtil.USER_AGENT_HEADER, + ObjectUtil.getIfNotNull(device, Device::getUa)); + HttpUtil.addHeaderIfValueIsNotEmpty(headers, HttpUtil.X_FORWARDED_FOR_HEADER, + ObjectUtil.getIfNotNull(device, Device::getIpv6)); + HttpUtil.addHeaderIfValueIsNotEmpty(headers, HttpUtil.X_FORWARDED_FOR_HEADER, + ObjectUtil.getIfNotNull(device, Device::getIp)); + + return headers; + } + + @Override + public final Result> makeBids(HttpCall httpCall, BidRequest bidRequest) { + try { + final BidResponse bidResponse = mapper.decodeValue(httpCall.getResponse().getBody(), BidResponse.class); + return Result.withValues(extractBids(httpCall.getRequest().getPayload(), bidResponse)); + } catch (DecodeException e) { + return Result.withError(BidderError.badServerResponse("Bad Server Response")); + } catch (PreBidException e) { + return Result.withError(BidderError.badServerResponse(e.getMessage())); + } + } + + private static List extractBids(BidRequest bidRequest, BidResponse bidResponse) { + final List seatBids = ObjectUtil.getIfNotNull(bidResponse, BidResponse::getSeatbid); + final SeatBid firstSeatBid = CollectionUtils.isNotEmpty(seatBids) ? seatBids.get(0) : null; + if (firstSeatBid == null) { + throw new PreBidException("Empty SeatBid array"); + } + + return CollectionUtils.emptyIfNull(firstSeatBid.getBid()).stream() + .filter(Objects::nonNull) + .map(bid -> BidderBid.of(bid, getBidMediaType(bid.getImpid(), bidRequest.getImp()), + bidResponse.getCur())) + .collect(Collectors.toList()); + } + + private static BidType getBidMediaType(String impId, List imps) { + for (Imp imp : imps) { + if (imp.getId().equals(impId)) { + if (imp.getVideo() != null) { + return BidType.video; + } else if (imp.getXNative() != null) { + return BidType.xNative; + } + } + } + return BidType.banner; + } +} diff --git a/src/main/java/org/prebid/server/proto/openrtb/ext/request/aceex/ExtImpAceex.java b/src/main/java/org/prebid/server/proto/openrtb/ext/request/aceex/ExtImpAceex.java new file mode 100644 index 00000000000..fb26ec0a898 --- /dev/null +++ b/src/main/java/org/prebid/server/proto/openrtb/ext/request/aceex/ExtImpAceex.java @@ -0,0 +1,13 @@ +package org.prebid.server.proto.openrtb.ext.request.aceex; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.Value; + +@Value +@AllArgsConstructor(staticName = "of") +public class ExtImpAceex { + + @JsonProperty("accountid") + String accountId; +} diff --git a/src/main/java/org/prebid/server/spring/config/bidder/AceexConfiguration.java b/src/main/java/org/prebid/server/spring/config/bidder/AceexConfiguration.java new file mode 100644 index 00000000000..3314d6dbe7b --- /dev/null +++ b/src/main/java/org/prebid/server/spring/config/bidder/AceexConfiguration.java @@ -0,0 +1,51 @@ +package org.prebid.server.spring.config.bidder; + +import org.prebid.server.bidder.BidderDeps; +import org.prebid.server.bidder.aceex.AceexBidder; +import org.prebid.server.json.JacksonMapper; +import org.prebid.server.spring.config.bidder.model.BidderConfigurationProperties; +import org.prebid.server.spring.config.bidder.util.BidderDepsAssembler; +import org.prebid.server.spring.config.bidder.util.UsersyncerCreator; +import org.prebid.server.spring.env.YamlPropertySourceFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; + +import javax.validation.constraints.NotBlank; + +@Configuration +@PropertySource(value = "classpath:/bidder-config/aceex.yaml", factory = YamlPropertySourceFactory.class) +public class AceexConfiguration { + + private static final String BIDDER_NAME = "aceex"; + + @Value("${external-url}") + @NotBlank + private String externalUrl; + + @Autowired + private JacksonMapper mapper; + + @Autowired + @Qualifier("aceexConfigurationProperties") + private BidderConfigurationProperties configProperties; + + @Bean("aceexConfigurationProperties") + @ConfigurationProperties("adapters.aceex") + BidderConfigurationProperties configurationProperties() { + return new BidderConfigurationProperties(); + } + + @Bean + BidderDeps aceexBidderDeps() { + return BidderDepsAssembler.forBidder(BIDDER_NAME) + .withConfig(configProperties) + .usersyncerCreator(UsersyncerCreator.create(externalUrl)) + .bidderCreator(config -> new AceexBidder(config.getEndpoint(), mapper)) + .assemble(); + } +} diff --git a/src/main/resources/bidder-config/aceex.yaml b/src/main/resources/bidder-config/aceex.yaml new file mode 100644 index 00000000000..d16691ed283 --- /dev/null +++ b/src/main/resources/bidder-config/aceex.yaml @@ -0,0 +1,21 @@ +adapters: + aceex: + endpoint: http://bl-us.aceex.io/?uqhash={{AccountId}} + meta-info: + maintainer-email: tech@aceex.io + app-media-types: + - banner + - video + - native + site-media-types: + - banner + - video + - native + supported-vendors: + vendor-id: 0 + usersync: + url: + redirect-url: + cookie-family-name: aceex + type: redirect + support-cors: false diff --git a/src/main/resources/static/bidder-params/aceex.json b/src/main/resources/static/bidder-params/aceex.json new file mode 100644 index 00000000000..9fb97d41136 --- /dev/null +++ b/src/main/resources/static/bidder-params/aceex.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Aceex Adapter Params", + "description": "A schema which validates params accepted by the Aceex adapter", + "type": "object", + "properties": { + "accountid": { + "type": "string", + "description": "Account id", + "minLength": 1 + } + }, + "required": ["accountid"] +} diff --git a/src/test/java/org/prebid/server/bidder/aceex/AceexBidderTest.java b/src/test/java/org/prebid/server/bidder/aceex/AceexBidderTest.java new file mode 100644 index 00000000000..072e91876e3 --- /dev/null +++ b/src/test/java/org/prebid/server/bidder/aceex/AceexBidderTest.java @@ -0,0 +1,226 @@ +package org.prebid.server.bidder.aceex; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.iab.openrtb.request.BidRequest; +import com.iab.openrtb.request.Device; +import com.iab.openrtb.request.Imp; +import com.iab.openrtb.request.Native; +import com.iab.openrtb.request.Video; +import com.iab.openrtb.response.Bid; +import com.iab.openrtb.response.BidResponse; +import com.iab.openrtb.response.SeatBid; +import io.netty.handler.codec.http.HttpHeaderValues; +import io.vertx.core.MultiMap; +import org.junit.Before; +import org.junit.Test; +import org.prebid.server.VertxTest; +import org.prebid.server.bidder.model.BidderBid; +import org.prebid.server.bidder.model.BidderError; +import org.prebid.server.bidder.model.HttpCall; +import org.prebid.server.bidder.model.HttpRequest; +import org.prebid.server.bidder.model.HttpResponse; +import org.prebid.server.bidder.model.Result; +import org.prebid.server.proto.openrtb.ext.ExtPrebid; +import org.prebid.server.proto.openrtb.ext.request.aceex.ExtImpAceex; +import org.prebid.server.util.HttpUtil; + +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; +import static java.util.function.Function.identity; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.assertj.core.api.Assertions.tuple; +import static org.prebid.server.proto.openrtb.ext.response.BidType.banner; +import static org.prebid.server.proto.openrtb.ext.response.BidType.video; +import static org.prebid.server.proto.openrtb.ext.response.BidType.xNative; + +public class AceexBidderTest extends VertxTest { + + private static final String ENDPOINT_URL = "https://test-url.com/?param={{AccountId}}"; + + private AceexBidder aceexBidder; + + @Before + public void setUp() { + aceexBidder = new AceexBidder(ENDPOINT_URL, jacksonMapper); + } + + @Test + public void creationShouldFailOnInvalidEndpointUrl() { + assertThatIllegalArgumentException().isThrownBy(() -> new AceexBidder("invalid_url", jacksonMapper)); + } + + @Test + public void makeHttpRequestsShouldReturnErrorsOfNotValidImps() { + // given + final BidRequest bidRequest = givenBidRequest( + impBuilder -> impBuilder + .ext(mapper.valueToTree(ExtPrebid.of(null, mapper.createArrayNode())))); + // when + final Result>> result = aceexBidder.makeHttpRequests(bidRequest); + + // then + assertThat(result.getErrors()) + .containsExactly(BidderError.badInput("Ext.bidder not provided")); + } + + @Test + public void makeHttpRequestsShouldCreateCorrectURL() { + // given + final BidRequest bidRequest = givenBidRequest(identity()); + + // when + final Result>> result = aceexBidder.makeHttpRequests(bidRequest); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()) + .extracting(HttpRequest::getUri) + .containsExactly("https://test-url.com/?param=accountId"); + } + + @Test + public void makeHttpRequestsShouldCorrectlyAddHeaders() { + // given + final BidRequest bidRequest = givenBidRequest(identity()); + + // when + final Result>> result = aceexBidder.makeHttpRequests(bidRequest); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()) + .extracting(HttpRequest::getHeaders) + .flatExtracting(MultiMap::entries) + .extracting(Map.Entry::getKey, Map.Entry::getValue) + .containsExactlyInAnyOrder( + tuple(HttpUtil.CONTENT_TYPE_HEADER.toString(), HttpUtil.APPLICATION_JSON_CONTENT_TYPE), + tuple(HttpUtil.ACCEPT_HEADER.toString(), HttpHeaderValues.APPLICATION_JSON.toString()), + tuple(HttpUtil.USER_AGENT_HEADER.toString(), "ua"), + tuple(HttpUtil.X_FORWARDED_FOR_HEADER.toString(), "ip"), + tuple(HttpUtil.X_FORWARDED_FOR_HEADER.toString(), "ipv6"), + tuple(HttpUtil.X_OPENRTB_VERSION_HEADER.toString(), "2.5")); + } + + @Test + public void makeBidsShouldReturnErrorIfResponseBodyCouldNotBeParsed() { + // given + final HttpCall httpCall = givenHttpCall(null, "invalid"); + + // when + final Result> result = aceexBidder.makeBids(httpCall, null); + + // then + assertThat(result.getValue()).isEmpty(); + assertThat(result.getErrors()) + .containsExactly(BidderError.badServerResponse("Bad Server Response")); + } + + @Test + public void makeBidsShouldThrowErrorIfBidResponseSeatBidIsNull() throws JsonProcessingException { + // given + final HttpCall httpCall = givenHttpCall(null, + mapper.writeValueAsString(BidResponse.builder().build())); + + // when + final Result> result = aceexBidder.makeBids(httpCall, null); + + // then + assertThat(result.getValue()).isEmpty(); + assertThat(result.getErrors()) + .containsExactly(BidderError.badServerResponse("Empty SeatBid array")); + } + + @Test + public void makeBidsShouldReturnNativeBidIfNativeIsPresentInRequestImp() throws JsonProcessingException { + // given + final HttpCall httpCall = givenHttpCall( + givenBidRequest(impBuilder -> impBuilder.xNative(Native.builder().build())), + mapper.writeValueAsString(givenBidResponse(bidBuilder -> bidBuilder.impid("123")))); + + // when + final Result> result = aceexBidder.makeBids(httpCall, null); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()) + .containsExactly(BidderBid.of(Bid.builder().impid("123").build(), xNative, null)); + } + + @Test + public void makeBidsShouldReturnVideoBidIfVideoIsPresentAndNativeIsAbsentInRequestImp() + throws JsonProcessingException { + // given + final HttpCall httpCall = givenHttpCall( + givenBidRequest(impBuilder -> impBuilder.video(Video.builder().build())), + mapper.writeValueAsString(givenBidResponse(bidBuilder -> bidBuilder.impid("123")))); + + // when + final Result> result = aceexBidder.makeBids(httpCall, null); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()) + .containsExactly(BidderBid.of(Bid.builder().impid("123").build(), video, null)); + } + + @Test + public void makeBidsShouldReturnBannerBidIfNativeAndVideoAreAbsentInRequestImp() + throws JsonProcessingException { + // given + final HttpCall httpCall = givenHttpCall( + givenBidRequest(impBuilder -> impBuilder.xNative(null).video(null)), + mapper.writeValueAsString(givenBidResponse(bidBuilder -> bidBuilder.impid("123")))); + + // when + final Result> result = aceexBidder.makeBids(httpCall, null); + + // then + assertThat(result.getErrors()).isEmpty(); + assertThat(result.getValue()) + .containsExactly(BidderBid.of(Bid.builder().impid("123").build(), banner, null)); + } + + private static BidRequest givenBidRequest( + Function bidRequestCustomizer, + List> impCustomizers) { + + return bidRequestCustomizer.apply(BidRequest.builder() + .device(Device.builder().ua("ua").ip("ip").ipv6("ipv6").build()) + .imp(impCustomizers.stream() + .map(AceexBidderTest::givenImp) + .collect(Collectors.toList()))) + .build(); + } + + private static BidRequest givenBidRequest(Function... impCustomizers) { + return givenBidRequest(identity(), asList(impCustomizers)); + } + + private static Imp givenImp(Function impCustomizer) { + return impCustomizer.apply(Imp.builder() + .id("123") + .ext(mapper.valueToTree(ExtPrebid.of(null, + ExtImpAceex.of("accountId"))))) + .build(); + } + + private static BidResponse givenBidResponse(Function bidCustomizer) { + return BidResponse.builder() + .seatbid(singletonList(SeatBid.builder().bid(singletonList(bidCustomizer.apply(Bid.builder()).build())) + .build())) + .build(); + } + + private static HttpCall givenHttpCall(BidRequest bidRequest, String body) { + return HttpCall.success( + HttpRequest.builder().payload(bidRequest).build(), + HttpResponse.of(200, null, body), + null); + } +} diff --git a/src/test/java/org/prebid/server/it/AceexTest.java b/src/test/java/org/prebid/server/it/AceexTest.java new file mode 100644 index 00000000000..67cc8573b9d --- /dev/null +++ b/src/test/java/org/prebid/server/it/AceexTest.java @@ -0,0 +1,35 @@ +package org.prebid.server.it; + +import io.restassured.response.Response; +import org.json.JSONException; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.prebid.server.model.Endpoint; +import org.springframework.test.context.junit4.SpringRunner; + +import java.io.IOException; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static java.util.Collections.singletonList; + +@RunWith(SpringRunner.class) +public class AceexTest extends IntegrationTest { + + @Test + public void openrtb2AuctionShouldRespondWithBidsFromAceex() throws IOException, JSONException { + // given + WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/aceex-exchange")) + .withRequestBody(equalToJson(jsonFrom("openrtb2/aceex/test-aceex-bid-request.json"))) + .willReturn(aResponse().withBody(jsonFrom("openrtb2/aceex/test-aceex-bid-response.json")))); + + // when + final Response response = responseFor("openrtb2/aceex/test-auction-aceex-request.json", + Endpoint.openrtb2_auction); + + // then + assertJsonEquals("openrtb2/aceex/test-auction-aceex-response.json", response, singletonList("aceex")); + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/aceex/test-aceex-bid-request.json b/src/test/resources/org/prebid/server/it/openrtb2/aceex/test-aceex-bid-request.json new file mode 100644 index 00000000000..e6654826b68 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/aceex/test-aceex-bid-request.json @@ -0,0 +1,41 @@ +{ + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 320, + "h": 250 + }, + "ext": { + "bidder": { + "accountid": "accountid" + } + } + } + ], + "site": { + "domain": "www.example.com", + "page": "http://www.example.com", + "publisher": { + "domain": "example.com" + }, + "ext": { + "amp": 0 + } + }, + "device": { + "ua": "userAgent", + "ip": "193.168.244.1" + }, + "at": 1, + "tmax": 5000, + "cur": [ + "USD" + ], + "regs": { + "ext": { + "gdpr": 0 + } + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/aceex/test-aceex-bid-response.json b/src/test/resources/org/prebid/server/it/openrtb2/aceex/test-aceex-bid-response.json new file mode 100644 index 00000000000..da5c7fc51cd --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/aceex/test-aceex-bid-response.json @@ -0,0 +1,18 @@ +{ + "id": "tid", + "seatbid": [ + { + "bid": [ + { + "crid": "24080", + "adid": "2068416", + "price": 0.01, + "id": "bid_id", + "impid": "imp_id", + "cid": "8048" + } + ], + "type": "banner" + } + ] +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/aceex/test-auction-aceex-request.json b/src/test/resources/org/prebid/server/it/openrtb2/aceex/test-auction-aceex-request.json new file mode 100644 index 00000000000..3ee06d504e8 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/aceex/test-auction-aceex-request.json @@ -0,0 +1,23 @@ +{ + "id": "request_id", + "imp": [ + { + "id": "imp_id", + "banner": { + "w": 320, + "h": 250 + }, + "ext": { + "aceex": { + "accountid": "accountid" + } + } + } + ], + "tmax": 5000, + "regs": { + "ext": { + "gdpr": 0 + } + } +} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/aceex/test-auction-aceex-response.json b/src/test/resources/org/prebid/server/it/openrtb2/aceex/test-auction-aceex-response.json new file mode 100644 index 00000000000..f80400fe5d1 --- /dev/null +++ b/src/test/resources/org/prebid/server/it/openrtb2/aceex/test-auction-aceex-response.json @@ -0,0 +1,35 @@ +{ + "id": "request_id", + "seatbid": [ + { + "bid": [ + { + "id": "bid_id", + "impid": "imp_id", + "price": 0.01, + "adid": "2068416", + "cid": "8048", + "crid": "24080", + "ext": { + "prebid": { + "type": "banner" + }, + "origbidcpm": 0.01 + } + } + ], + "seat": "aceex", + "group": 0 + } + ], + "cur": "USD", + "ext": { + "responsetimemillis": { + "aceex": "{{ aceex.response_time_ms }}" + }, + "prebid": { + "auctiontimestamp": 0 + }, + "tmaxrequest": 5000 + } +} diff --git a/src/test/resources/org/prebid/server/it/test-application.properties b/src/test/resources/org/prebid/server/it/test-application.properties index 1a8a1370cbc..133e2d9658c 100644 --- a/src/test/resources/org/prebid/server/it/test-application.properties +++ b/src/test/resources/org/prebid/server/it/test-application.properties @@ -1,9 +1,11 @@ adapters.generic.enabled=true adapters.generic.endpoint=http://localhost:8090/generic-exchange -adapters.adagio.enabled=true -adapters.adagio.endpoint=http://localhost:8090/adagio-exchange +adapters.aceex.enabled=true +adapters.aceex.endpoint=http://localhost:8090/aceex-exchange adapters.acuityads.enabled=true adapters.acuityads.endpoint=http://localhost:8090/acuityads-exchange +adapters.adagio.enabled=true +adapters.adagio.endpoint=http://localhost:8090/adagio-exchange adapters.adf.enabled=true adapters.adf.endpoint=http://localhost:8090/adf-exchange adapters.adform.enabled=true