Android Open Source - android.bigredsnapshot Snapshot Request






From Project

Back to project page android.bigredsnapshot.

License

The source code is released under:

MIT License

If you think the Android project android.bigredsnapshot 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 io.evercam.bigredsnapshot;
//w  w  w  . j  ava2 s  .  c  o  m
import io.evercam.Camera;
import io.evercam.EvercamException;
import io.evercam.Snapshot;

import java.io.InputStream;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;

public class SnapshotRequest
{
  public static final String TAG = "bigredsnapshot-SnapshotRequest";

  public static Bitmap getExternalSnapshotBit(Camera camera)
  {
    Bitmap bitmap = null;
    try
    {
      InputStream inputStream = Camera.getStreamFromUrl(camera.getExternalJpgUrl(),
          camera.getUsername(), camera.getPassword());
      bitmap = BitmapFactory.decodeStream(inputStream);
    }
    catch (Exception e)
    {
      Log.e(TAG, e.toString());
    }
    return bitmap;
  }

  public static Bitmap getInternalSnapshotBit(Camera camera)
  {
    Bitmap bitmap = null;
    try
    {
      InputStream inputStream = Camera.getStreamFromUrl(camera.getInternalJpgUrl(),
          camera.getUsername(), camera.getPassword());
      bitmap = BitmapFactory.decodeStream(inputStream);
    }
    catch (Exception e)
    {
      Log.e(TAG, e.toString());
    }
    return bitmap;
  }

  public static Bitmap getSnapshotBitFromEvercam(Camera camera)
  {
    Bitmap bitmap = null;
    try
    {
      InputStream inputStream = camera.getSnapshotFromEvercam();
      bitmap = BitmapFactory.decodeStream(inputStream);
    }
    catch (Exception e)
    {
      Log.e(TAG, e.toString());
    }
    return bitmap;
  }

  public static Bitmap getLatestSnapshot(Camera camera) throws EvercamException, Exception
  {
    Snapshot latestSnapshot = Camera.getLatestArchivedSnapshot(camera.getId(), true);
    byte[] snapshotByte = latestSnapshot.getData();
    Bitmap bitmap = BitmapFactory.decodeByteArray(snapshotByte, 0, snapshotByte.length);
    return bitmap;
  }

}




Java Source Code List

io.evercam.bigredsnapshot.BigButtonActivity.java
io.evercam.bigredsnapshot.BigRedSnapshot.java
io.evercam.bigredsnapshot.ChooseCameraActivity.java
io.evercam.bigredsnapshot.LoginActivity.java
io.evercam.bigredsnapshot.SignUpActivity.java
io.evercam.bigredsnapshot.SlideActivity.java
io.evercam.bigredsnapshot.SnapshotRequest.java
io.evercam.bigredsnapshot.UrlStatus.java
io.evercam.bigredsnapshot.account.AccountUtils.java
io.evercam.bigredsnapshot.account.ProfileQuery.java
io.evercam.bigredsnapshot.account.UserProfile.java
io.evercam.bigredsnapshot.helper.CustomedDialog.java
io.evercam.bigredsnapshot.helper.PrefsManager.java
io.evercam.bigredsnapshot.helper.PropertyReader.java
io.evercam.bigredsnapshot.tasks.CaptureSnapshotTask.java
io.evercam.bigredsnapshot.tasks.CheckInternetTask.java