Options
All
  • Public
  • Public/Protected
  • All
Menu

HTTP client for FlashAir. Command, Config, Thumbnail properties are corresponding to each CGI API on FlashAir. On the creation of this object, some APIs are automatically called to obtain the host version and status. It starts polling automatically soon after the initialization. Polling interval can be specified in constructor's option parameter. Host ( FlashAir network address ) can be provided in the constructor or you can change the host address any time later by calling setHostAddress.

How to start

Instantiating FlashAirClient object is the simplest start.

var fa = new FlashAir.FlashAirClient();

Available options are defined in FlashAirClientConfig.

Events

This class supports DOM like event system. Changes of host SD card status and some more can be monitored by handling those events. Event attach/detach methos are just same as jQuery's on/off/once

var fa = new FlashAir.FlashAirClient();
fa.on('fa.hostready', function(){
    // custom initialization
});

fa.updated

is triggered when /command.cgi?op=121 host timestamp returns updated number. You can take any action like getting a updated file list.

fa.hostchanged

is triggered when the host name or IP address is changing to another. During the initial connection, this event doesn't fire.

fa.hostready

After the initial connection or fireing fa.hostchanged, this class tries to obtain some host status by some API calls. This event is triggered when those initial calls are all done.

fa.hostfailure

After calling setHostAddress, if connection failed, this event is triggered.

fa.polling

reports polling status every n milliseconds interval which is configured with options for constructor. The polling status has a status value:

fa.on('fa.polling', function( status ){
    // check the status
});

status value can be:

  • connecting Trying to connect to the host SD card.
  • connected Connection to the host SD card has been confirmed.
  • disconnected Connection to the host SD card has been lost.

fa.photosharemode

is triggered when the host SD card is currently in PHOTOSHARE mode.

Hierarchy

Index

Constructors

constructor

Properties

Command

Command: Command

represents command.cgi. command.cgi のオブジェクト表現

Config

Config: Config

represents config.cgi config.cgi のオブジェクト表現

Thumbnail

Thumbnail: Thumbnail

represents thumbnail.cgi thumbnail.cgi のオブジェクト表現

Upload

Upload: Upload

represents upload.cgi upload.cgi のオブジェクト表現

Private _pausePolling

_pausePolling: boolean

baseUrl

baseUrl: string

URL for FlashAir host device like "http://flashair/". url always ends with /.

isAdministrator

isAdministrator: boolean

This is set when the connecting client has a right mastercode.

lang

lang: string

holds current language. This value comes from user's browser's language setting, otherwise is obtained by command.cgi accept language.

mastercode

mastercode: string

photoShareMode

photoShareMode: boolean

Private pollingInterval

pollingInterval: number

Private timer

timer: any

Private timestamp

timestamp: any

Methods

GetFile

  • GetFile(path: string | FileInfo): void
  • Not implemented.

    Parameters

    Returns void

GetFileUrl

  • Parameters

    Returns string

addEventListener

  • addEventListener(event: any, fn: any): void

Private browserLanguage

  • browserLanguage(): JQueryPromise<string>
  • Returns JQueryPromise<string>

Protected initWithHost

  • initWithHost(): void
  • Returns void

off

on

Protected onHostChanged

  • onHostChanged(): void
  • Returns void

Protected onHostFailure

  • onHostFailure(): void
  • Returns void

Protected onHostReady

  • onHostReady(): void
  • Returns void

once

pausePolling

  • pausePolling(): void
  • Returns void

Private poll

  • poll(): void
  • Returns void

removeAllListeners

  • removeAllListeners(event: any, fn: any): void

removeEventListener

  • removeEventListener(event: any, fn: any): void

removeListener

  • removeListener(event: any, fn: any): void

resumePolling

  • resumePolling(): void
  • Returns void

setHostAddress

  • setHostAddress(newUrl: string, verify?: boolean): JQueryPromise<any>
  • Parameters

    • newUrl: string

      new host URL of FlashAir, which may be like "http://flashair/" or "http://192.168.0.100/"

    • Default value verify: boolean = true

      If true, this method tries to verify the existence of the host address by calling command.cgi

    Returns JQueryPromise<any>

    jQuery promise object.

startPolling

  • startPolling(): void
  • Returns void

stopPolling

  • stopPolling(): void
  • Returns void

trigger

Generated using TypeDoc