Android Open Source - sony-camera-remote-java Event Entity






From Project

Back to project page sony-camera-remote-java.

License

The source code is released under:

Apache License

If you think the Android project sony-camera-remote-java listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.praetoriandroid.cameraremote.rpc;
/*from w  w  w.java 2s.  c o m*/
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

@SuppressWarnings("UnusedDeclaration")
public abstract class EventEntity {

    enum Type {
        availableApiList(AvailableApiList.class),
        cameraStatus(CameraStatus.class),
        zoomInformation(ZoomInformation.class),
        liveviewStatus(LiveViewStatus.class),
        // items 4-18 are skipped
        postviewImageSize(PostviewImageSize.class),
        selfTimer(SelfTimer.class),
        shootMode(ShootMode.class);

        private final Class<? extends EventEntity> entityClass;

        private Type(Class<? extends EventEntity> entityClass) {
            this.entityClass = entityClass;
        }

        public Class<? extends EventEntity> getEntityClass() {
            return entityClass;
        }
    }

    private Type type;

    public Type getType() {
        return type;
    }

    public static class AvailableApiList extends EventEntity {

        private String[] names;

        public String[] getApiList() {
            return names;
        }

        @Override
        public String toString() {
            return getType() + ": " + Arrays.toString(names);
        }
    }

    public static class CameraStatus extends EventEntity {

        public enum Status {
            Error,
            NotReady,
            IDLE,
            StillCapturing,
            StillSaving,
            MovieWaitRecStart,
            MovieRecording,
            MovieWaitRecStop,
            MovieSaving,
            AudioWaitRecStart,
            AudioRecording,
            AudioWaitRecStop,
            AudioSaving
        }

        private Status cameraStatus;

        public Status getStatus() {
            return cameraStatus;
        }

        @Override
        public String toString() {
            return getType() + ": " + cameraStatus;
        }
    }

    public static class ZoomInformation extends EventEntity {

        public static int ZOOM_INVALID = -1;

        private int zoomPosition;

        private int zoomNumberBox;

        private int zoomIndexCurrentBox;

        private int zoomPositionCurrentBox;

        public int getPosition() {
            return zoomPosition;
        }

        public int getNumberBox() {
            return zoomNumberBox;
        }

        public int getIndexCurrentBox() {
            return zoomIndexCurrentBox;
        }

        public int getPositionCurrentBox() {
            return zoomPositionCurrentBox;
        }

        @Override
        public String toString() {
            return getType() + ": position=" + zoomPosition
                    + ", numberBox=" + zoomNumberBox
                    + ", indexCurrentBox=" + zoomIndexCurrentBox
                    + ", positionCurrentBox=" + zoomPositionCurrentBox;
        }

    }

    public static class LiveViewStatus extends EventEntity {

        private boolean liveviewStatus;

        public boolean isReady() {
            return liveviewStatus;
        }

        @Override
        public String toString() {
            return getType() + ": " + liveviewStatus;
        }

    }

    public static class PostviewImageSize extends EventEntity {

        public enum Size {
            ORIGINAL,
            TWO_M,
            UNKNOWN
        }

        private static final String SIZE_ORIGINAL = "Original";
        private static final String SIZE_2M = "2M";

        private static final Map<String, Size> sizeMap = new HashMap<String, Size>();
        static {
            sizeMap.put(SIZE_ORIGINAL, Size.ORIGINAL);
            sizeMap.put(SIZE_2M, Size.TWO_M);
        }

        private String currentPostviewImageSize;

        private String[] postviewImageSizeCandidates;

        private Size getSize(String value) {
            Size size = sizeMap.get(value);
            if (size == null) {
                return Size.UNKNOWN;
            }
            return size;
        }

        public Size getCurrentSize() {
            return getSize(currentPostviewImageSize);
        }

        public Size[] getSizeCandidates() {
            Size[] candidates = new Size[postviewImageSizeCandidates.length];
            for (int i = 0; i < candidates.length; i++) {
                candidates[i] = getSize(postviewImageSizeCandidates[i]);
            }
            return candidates;
        }

        @Override
        public String toString() {
            return getType() + ": " + currentPostviewImageSize + ' ' + Arrays.toString(postviewImageSizeCandidates);
        }

    }

    public static class SelfTimer extends EventEntity {

        private int currentSelfTimer;

        private Integer[] selfTimerCandidates;

        public Integer getCurrentValue() {
            return currentSelfTimer;
        }

        public Integer[] getCandidates() {
            return selfTimerCandidates;
        }

        @Override
        public String toString() {
            return getType() + ": " + currentSelfTimer + ' ' + Arrays.toString(selfTimerCandidates);
        }
    }

    public static class ShootMode extends EventEntity {

        enum Mode {
            still,
            movie,
            audio
        }

        private Mode currentShootMode;

        private Mode[] shootModeCandidates;

        public Mode getCurrentValue() {
            return currentShootMode;
        }

        public Mode[] getCandidates() {
            return shootModeCandidates;
        }

        @Override
        public String toString() {
            return getType() + ": " + currentShootMode + ' ' + Arrays.toString(shootModeCandidates);
        }

    }

}




Java Source Code List

com.praetoriandroid.cameraremote.BadHttpStatusException.java
com.praetoriandroid.cameraremote.DeviceDescription.java
com.praetoriandroid.cameraremote.HttpClient.java
com.praetoriandroid.cameraremote.InvalidDataFormatException.java
com.praetoriandroid.cameraremote.LiveViewDisconnectedException.java
com.praetoriandroid.cameraremote.LiveViewFetcher.java
com.praetoriandroid.cameraremote.Logger.java
com.praetoriandroid.cameraremote.ParseException.java
com.praetoriandroid.cameraremote.RpcClient.java
com.praetoriandroid.cameraremote.RpcException.java
com.praetoriandroid.cameraremote.ServiceNotSupportedException.java
com.praetoriandroid.cameraremote.SsdpClient.java
com.praetoriandroid.cameraremote.SsdpException.java
com.praetoriandroid.cameraremote.app.LiveView.java
com.praetoriandroid.cameraremote.app.MainActivity.java
com.praetoriandroid.cameraremote.app.Rpc.java
com.praetoriandroid.cameraremote.app.SelfTimerSelector.java
com.praetoriandroid.cameraremote.app.ThisApp.java
com.praetoriandroid.cameraremote.rpc.ActTakePictureRequest.java
com.praetoriandroid.cameraremote.rpc.ActTakePictureResponse.java
com.praetoriandroid.cameraremote.rpc.AwaitTakePictureRequest.java
com.praetoriandroid.cameraremote.rpc.BaseRequest.java
com.praetoriandroid.cameraremote.rpc.BaseResponse.java
com.praetoriandroid.cameraremote.rpc.CustomizableEntity.java
com.praetoriandroid.cameraremote.rpc.EventEntity.java
com.praetoriandroid.cameraremote.rpc.GetApplicationInfoRequest.java
com.praetoriandroid.cameraremote.rpc.GetApplicationInfoResponse.java
com.praetoriandroid.cameraremote.rpc.GetAvailableApiListRequest.java
com.praetoriandroid.cameraremote.rpc.GetAvailableApiListResponse.java
com.praetoriandroid.cameraremote.rpc.GetAvailableSelfTimerRequest.java
com.praetoriandroid.cameraremote.rpc.GetAvailableSelfTimerResponse.java
com.praetoriandroid.cameraremote.rpc.GetEventRequest.java
com.praetoriandroid.cameraremote.rpc.GetEventResponse.java
com.praetoriandroid.cameraremote.rpc.GetExposureModeRequest.java
com.praetoriandroid.cameraremote.rpc.GetMethodTypesRequest.java
com.praetoriandroid.cameraremote.rpc.GetMethodTypesResponse.java
com.praetoriandroid.cameraremote.rpc.GetSelfTimerRequest.java
com.praetoriandroid.cameraremote.rpc.GetSupportedSelfTimerRequest.java
com.praetoriandroid.cameraremote.rpc.GetSupportedSelfTimerResponse.java
com.praetoriandroid.cameraremote.rpc.GetVersionsRequest.java
com.praetoriandroid.cameraremote.rpc.GetVersionsResponse.java
com.praetoriandroid.cameraremote.rpc.IllegalResultSizeException.java
com.praetoriandroid.cameraremote.rpc.MethodTypesEntity.java
com.praetoriandroid.cameraremote.rpc.RpcMethod.java
com.praetoriandroid.cameraremote.rpc.SetSelfTimerRequest.java
com.praetoriandroid.cameraremote.rpc.SimpleResponse.java
com.praetoriandroid.cameraremote.rpc.StartLiveViewRequest.java
com.praetoriandroid.cameraremote.rpc.StartLiveViewResponse.java
com.praetoriandroid.cameraremote.rpc.StartMovieRecRequest.java
com.praetoriandroid.cameraremote.rpc.StartRecModeRequest.java
com.praetoriandroid.cameraremote.rpc.StopLiveviewRequest.java
com.praetoriandroid.cameraremote.rpc.StopMovieRecRequest.java
com.praetoriandroid.cameraremote.rpc.StopMovieRecResponse.java
com.praetoriandroid.cameraremote.rpc.StopRecModeRequest.java
com.praetoriandroid.cameraremote.rpc.ValidationException.java
com.praetoriandroid.cameraremote.rpc._DummyResponse.java
com.praetoriandroid.cameraremote.tool.Cache.java
com.praetoriandroid.cameraremote.tool.RemoteControl.java
com.praetoriandroid.widget.ItemViewCreator.java
com.praetoriandroid.widget.RadialFreeSpace.java
com.praetoriandroid.widget.RadialSelector.java