Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of contents

...

Table of Contents
minLevel1
maxLevel4

...

{
"preferenceVersion" :{"major":"1", "minor":"1"},

"preference": [ {"prefName" :"Pref0",
"prefType" :"Boolean",
"appApiAccess" :"ReadWrite",
"webApiAccess" :"ReadWrite",
"defaultValue" :"TRUE" },


{"prefName" :"Pref1",
"prefType" :"Integer",
"appApiAccess" :"Read",
"webApiAccess" :"None",
"defaultValue" :"0"} ,


{"prefName" :"Pref2",
"prefType" :"String",
"defaultValue" :"This is a ¥"String¥"."} ,


{"prefName" :"Pref3",
"prefType" :"Enumeration",
"enumerationList" : ["Item0", "Item1", "Item2"],
"defaultValue" :"Item0"} ,


{"prefName" :"Pref4",
"prefType" :"Binary",
"defaultValue" :" YWJjZGVmZWZn"}
]
}

...

Explain parameter definition file.

...

パラメータ定義ファイルのサイズ制約

...

アプリパラメータ定義ファイル(PrefDefFile:appPrefs.json)は最大64KB
※インストール時に定義ファイルのサイズが64KBを超える場合にはエラーとなる。

アプリパラメータ値内部管理ファイル(PrefValFile:appPrefs.json)は最大128KB
※パラメータ保存時に内部管理ファイルのサイズが128KBを超える場合にはエラーとなる。

・設定時にパラメータ値保存ファイルの最大サイズを128KB以下に抑えることで保存時のサイズエラーをなくすことが可能
・各パラメータの設定値を最大サイズ以下で扱う場合は、最大サイズが128KBを超えるように設定することも可能
・パラメータ保存ファイルのサイズは下記の計算式で計算することが出来る(単位:Byte)

...

Size Limitation of Parameter Files

...

Maximum Parameter Definition File(PrefDefFile:appPrefs.json) size is 64KB.
※the file size is checked when Application Package is installed. (it returns preference error if the definition file size exceeds 64KB)

Maximum Parameter Saved File(PrefValFile:appPrefs.json) size is 128KB.
※the file size is checked when parameter file is saved. (it returns preference error if the definition file size exceeds 128KB)

・If maximum size of saved parameter file is 128 KB or less, preference error is not returned.

・You can set 128KB or more as the maximum size when preference value of each parameter is the maximum size or less.

・you can calculate the size of saved parameter file by following calculation formula(Byte)

Boolean type:size of prefName + 154 + size of value(true(4)/false(5))+ defaultValueのサイズ( size of defaultValue(true(4)/false(5))+ webApiAccessのサイズsize of webApiAccess(ReadWrite(9)/Read(4)/None(4)) + appApiAccessのサイズsize of appApiAccess(ReadWrite(9)/Read(4))

Integer型:prefNameのサイズInteger type:size of prefName + 154 + valueのサイズ+defaultValueのサイズ+ webApiAccessのサイズsize of value + size of defaultValue+ size of webApiAccess(ReadWrite(9)/Read(4)/None(4)) + appApiAccessのサイズsize of appApiAccess(ReadWrite(9)/Read(4))String型:prefNameのサイズ

String type:size of prefName + 153 + valueのサイズ+defaultValueのサイズ+ webApiAccessのサイズsize of value + size of defaultValue+ size of webApiAccess(ReadWrite(9)/Read(4)/None(4)) + appApiAccessのサイズsize of appApiAccess(ReadWrite(9)/Read(4))

Enumeration型: prefNameのサイズ+ size of prefName + 193 + 154+valueのサイズ+defaultValueのサイズ+ (Enumeration Listの要素のサイズsize of value + size of defaultValue+ (size of named Value + 17) * Enumeration Listの要素数+ webApiAccessのサイズNumber of Enumeration List+ size of webApiAccess(ReadWrite(9)/Read(4)/None(4)) + appApiAccessのサイズsize of appApiAccess(ReadWrite(9)/Read(4))

Binary型:prefNameのサイズBinary type:size of prefNam + 153 + valueのサイズ+defaultValueのサイズ+ webApiAccessのサイズsize of value + size of defaultValue+ size of webApiAccess(ReadWrite(9)/Read(4)/None(4)) + appApiAccessのサイズsize of appApiAccess(ReadWrite(9)/Read(4))

パラメータ値保存ファイル:各パラメータ保存サイズの合計Size of Parameter Saved File: each parameter size + 109 + majorVersionのサイズ+minorVersionのサイズ +各パラメータのprefNameとvalueとenumerationLisの中にあるエスケープ文字の数

アプリアップデート時の設定値の対応

インストール済みアプリ(A)のpreferenceVersionとアップデートパッケージ(B)中のpreferenceVersionを比較し、次の動作を行う

1.Majorバージョンが違う場合
アップデートパッケージのアプリパラメータ定義ファイルに置き換え → インストール済みアプリの値は一切利用しない

2.Minorバージョンが違う場合
(A)と(B)の両方に存在するパラメータ : (A)のvalueを設定
・ただし、 その他の属性値は変更される(defaultValueや、appApiAccessなども値を変更される)
・同じパラメータ名で、型が変わる場合は、defaultValueを設定
・EnumerationListの要素にvalueがなければ、defaultValueを設定
(A)のみに存在するパラメータ : そのパラメータを削除
(B)のみに存在するパラメータ : そのパラメータを追加

3.MajorバージョンもMinorバージョンも同じ場合
(A)と(B)のvalue以外の属性値(defaultValue, webApiAccess, appApiAccess, EnumerationList)が一つでも異なっていればエラー
(A)と(B)の全ての属性値が同じ場合 (A)のvalueを設定

アップデート完了後、preferenceVersionは、アップデートパッケージのものに設定される

設定値Restore時の対応

インストール済みアプリ(A)のpreferenceVersionと、リストアファイル(B)のpreferenceVersionを比較し、次の動作を行う

1.Majorバージョンが違う場合
エラー

2.Minorバージョンが違う場合
(A)と(B)の両方に存在するパラメータ : (B)の値を設定
・ただし、 valueのみが変更され、その他の属性値は変更されない
(defaultValueや、appApiAccessなどは変更されない)
・同じパラメータ名で型が違う場合は、何もしない
・EnumerationListの要素に、(B)の値が無ければ、何もしない
(A)のみに存在するパラメータ : 何もしない
(B)のみに存在するパラメータ : 何もしない

3.MajorバージョンもMinorバージョンも同じ場合
(A)と(B)のvalue以外の属性値(defaultValue, webApiAccess, appApiAccess, EnumerationList)が一つでも異なっていればエラー
(A)と(B)の全ての属性値が同じ場合 (B)のvalueを設定

リストア完了後、preferenceVersionは変更されない

API仕様

...

size of majorVersion + size of minorVersion+ number of escape characters

How to Update Application Parameters

...

Compare preferenceVersion of Installed Application(A) and that of update package(B)

Case: Major version is different
Replace parameter file(A) by parameter file(B).The parameter
of previously Installed Application is not used.

Case: Minor version is different
The parameters found both (A) and (B) :
Set the value of parameter (A). Other attributions are replaced by (B) (defaultValue,
webApiAccess and appApiAccess is changed)
Same parameter name but prefType is different :
Set defaultValue by (B)
EnumerationList have no value :
Set defaultValue by (B)
The parameters found only in(A) :
The parameter is deleted
The parameters found only in(B) :
The parameter is added

Case: Both Major version and Minor version are the same
Attributions other than value (defaultValue, webApiAccess, appApiAccess, EnumerationList) are different :
Preference error is returned
Attributions other than value are the same :
Set the value of parameter (A)

preferenceVersion is replaced by (B) when updated.

How to Restore Parameters

...

Making a comparison between The preferenceVersion of Installed Application(A) and the preferenceVersion of restore file(B)

Case: Major version is different
Preference error is returned

Case: Minor version is different
The parameters which is existed in both (A) and (B) :
Set the value of parameter (B) without changing other
attributions such as defaultValue, webApiAccess andappApiAccess
Same parameter name but prefType is different :
Do nothing
EnumerationList have no value :
Do nothing
The parameters found only in (A) :
Do nothing
The parameters found only in (B) :
Do nothing

Case: Both Major version and Minor are the same
Attributions other than value (defaultValue, webApiAccess,
appApiAccess, EnumerationList) are different :
Preference error is returned
Attributions other than value are the same :
Set the value of parameter (B)

preferenceVersion does not change after the restoration

API Specification

...

For the WebAPI specification, please refer to AdamWebAPI(AdamWebAPI_Specification_Vx_xx.pdf)を参照してください。アプリ向け仕様については、AdamAppAPI仕様書.

For the AppAPI specification, please refer to AdamAppAPI(AdamAppAPI_Specification_Vx_xx.pdf)を参照してください。

アプリ向けAPI仕様一覧

パラメータ取得API.

API List for AdamApp

...

Parameter Getting API

E_ADAM_ERR ADAM_AppPref_GetBoolean(const char* pPrefName, bool* pValue);
E_ADAM_ERR ADAM_AppPref_GetInteger(const char* pPrefName, int64_t* pValue);
E_ADAM_ERR ADAM_AppPref_GetString(const char* pPrefName, char* pValue, unsigned int size);
E_ADAM_ERR ADAM_AppPref_GetEnumeration(const char* pPrefName, unsigned int* pValue);
E_ADAM_ERR ADAM_AppPref_GetBinary(const char* pPrefName, unsigned char* pValue,
unsigned int size);

パラメータ設定APIParameter setting API

E_ADAM_ERR ADAM_AppPref_Lock();
E_ADAM_ERR ADAM_AppPref_Unlock();

E_ADAM_ERR ADAM_AppPref_BeginTransaction();
E_ADAM_ERR ADAM_AppPref_CancelTransaction();
E_ADAM_ERR ADAM_AppPref_SaveTransaction();

E_ADAM_ERR ADAM_AppPref_SetBoolean(const char* pPrefName, bool value);
E_ADAM_ERR ADAM_AppPref_SetInteger(const char* pPrefName, int64_t value);
E_ADAM_ERR ADAM_AppPref_SetString(const char* pPrefName, const char* pValue);
E_ADAM_ERR ADAM_AppPref_SetEnumeration(const char* pPrefName, unsigned int value);
E_ADAM_ERR ADAM_AppPref _SetBinary(const char* pPrefName, unsigned char* pValue,
unsigned int size)
E_ADAM_ERR ADAM_AppPref_Reset();

パラメータ更新通知用APIUpdate Notification API

typedef void (T_ADAM_NOTIFY_APP_PREF_UPDATE_HANDLER)(char const pPrefName[], const
unsigned int prefSize);
typedef struct ST_ADAM_SYSTEM_HANDLERS {
T_ADAM_STOP_HANDLER m_stopHandler;
T_ADAM_NOTIFY_APP_PREF_UPDATE_HANDLER m_notifyAppPrefUpdateHandler;
T_ADAM_SERVER_REQUEST_RECEIVE_HANDLER m_serverRequestReceiveHandler;
} ST_ADAM_SYSTEM_HANDLERS;

パラメータファイルフォーマット

...

Parameter File Format

...

Parameter Definition File(PrefDefFile : appPrefs.json)

{
"preferenceVersion": {"major":"1", "minor":"1"},
"preference":[{"prefName" :"Pref0",
"prefType" :"Boolean",
"appApiAccess" :"ReadWrite",
"webApiAccess" :"ReadWrite",
"defaultValue" :"TRUE" },

{"prefName" :"Pref1",
"prefType" :"Integer",
"appApiAccess" :"Read",
"webApiAccess" :"None",
"defaultValue" :"0"} ,

{"prefName" :"Pref2",
"prefType" :"String",
"appApiAccess" :"Read",
"webApiAccess" :"Read",
"defaultValue" :"ABC"} ,

{"prefName" :"Pref3",
"prefType" :"Enumeration",
"enumerationList" :
["Item0", "Item1", "Item2"]
"defaultValue" :"Item0"} ,
}

アプリパラメータ内部管理ファイルParameter Saved File(PrefValFile : appPrefs.json)

...