Skip to content

Commit

Permalink
#538 Add a new CommissionerRemoteUiFlowUrl filed into Model schema
Browse files Browse the repository at this point in the history
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Signed-off-by: Abdulbois <abdulbois123@gmail.com>
  • Loading branch information
Abdulbois committed Mar 20, 2024
1 parent 1076221 commit 8de3dc3
Show file tree
Hide file tree
Showing 13 changed files with 593 additions and 139 deletions.
211 changes: 211 additions & 0 deletions docs/static/openapi.yml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ Not all fields can be edited (see `EDIT_MODEL`).
- commissioningModeInitialStepsInstruction: `optional(string)` - commissioningModeInitialStepsInstruction SHALL contain text which relates to specific values of CommissioningModeInitialStepsHint. Certain values of CommissioningModeInitialStepsHint, as defined in the Pairing Hint Table, indicate a Pairing Instruction (PI) dependency, and for these values the commissioningModeInitialStepsInstruction SHALL be set
- commissioningModeSecondaryStepsHint: `optional(uint32)` - commissioningModeSecondaryStepsHint SHALL identify a hint for steps that can be used to put into commissioning mode a device that has already been commissioned. This field is a bitmap with values defined in the Pairing Hint Table. For example, a value of 4 (bit 2 is set) indicates that a device that has already been commissioned will require the user to visit a current CHIP Administrator to put the device into commissioning mode.
- commissioningModeSecondaryStepInstruction: `optional(string)` - commissioningModeSecondaryStepInstruction SHALL contain text which relates to specific values of commissioningModeSecondaryStepsHint. Certain values of commissioningModeSecondaryStepsHint, as defined in the Pairing Hint Table, indicate a Pairing Instruction (PI) dependency, and for these values the commissioningModeSecondaryStepInstruction SHALL be set
- commissionerRemoteUiFlowURL `optional(string)` - commissionerRemoteUiFlowURL SHALL identify URL to show a custom flow UI for the commissioner
- userManualURL: `optional(string)` - URL that contains product specific web page that contains user manual for the device model.
- supportURL: `optional(string)` - URL that contains product specific web page that contains support details for the device model.
- productURL: `optional(string)` - URL that contains product specific web page that contains details for the device model.
Expand Down Expand Up @@ -253,6 +254,7 @@ All non-edited fields remain the same.
- commissioningCustomFlowURL: `optional(string)` - commissioningCustomFlowURL SHALL identify a vendor specific commissioning URL for the device model when the commissioningCustomFlow field is set to '2'
- commissioningModeInitialStepsInstruction: `optional(string)` - commissioningModeInitialStepsInstruction SHALL contain text which relates to specific values of CommissioningModeInitialStepsHint. Certain values of CommissioningModeInitialStepsHint, as defined in the Pairing Hint Table, indicate a Pairing Instruction (PI) dependency, and for these values the commissioningModeInitialStepsInstruction SHALL be set
- commissioningModeSecondaryStepInstruction: `optional(string)` - commissioningModeSecondaryStepInstruction SHALL contain text which relates to specific values of commissioningModeSecondaryStepsHint. Certain values of commissioningModeSecondaryStepsHint, as defined in the Pairing Hint Table, indicate a Pairing Instruction (PI) dependency, and for these values the commissioningModeSecondaryStepInstruction SHALL be set
- commissionerRemoteUiFlowURL `optional(string)` - commissionerRemoteUiFlowURL SHALL identify URL to show a custom flow UI for the commissioner
- userManualURL: `optional(string)` - URL that contains product specific web page that contains user manual for the device model.
- supportURL: `optional(string)` - URL that contains product specific web page that contains support details for the device model.
- productURL: `optional(string)` - URL that contains product specific web page that contains details for the device model.
Expand Down
1 change: 1 addition & 0 deletions proto/model/model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ message Model {
int32 lsfRevision = 17;
string creator = 18 [(cosmos_proto.scalar) = "cosmos.AddressString"];
uint32 schemaVersion = 19;
string commissionerRemoteUiFlowUrl = 20;
}

2 changes: 2 additions & 0 deletions proto/model/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ message MsgCreateModel {
string productUrl = 16 [(gogoproto.moretags) = "validate:\"omitempty,url,startsnotwith=http:,max=256\""];
string lsfUrl = 17 [(gogoproto.moretags) = "validate:\"omitempty,url,startsnotwith=http:,max=256\""];
uint32 schemaVersion = 18;
string commissionerRemoteUiFlowUrl = 19 [(gogoproto.moretags) = "validate:\"omitempty,url,startsnotwith=http:,max=256\""];
}
message MsgCreateModelResponse {}

Expand All @@ -61,6 +62,7 @@ message MsgUpdateModel {
string lsfUrl = 13 [(gogoproto.moretags) = "validate:\"omitempty,url,startsnotwith=http:,max=256\""];
int32 lsfRevision = 14 [(gogoproto.moretags) = "validate:\"gte=0,lte=65535\""];
uint32 schemaVersion = 15;
string commissionerRemoteUiFlowUrl = 16 [(gogoproto.moretags) = "validate:\"omitempty,url,startsnotwith=http:,max=256\""];
}
message MsgUpdateModelResponse {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export interface ModelModel {

/** @format int64 */
schemaVersion?: number;
commissionerRemoteUiFlowUrl?: string;
}

export interface ModelModelVersion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface Model {
lsfRevision: number
creator: string
schemaVersion: number
commissionerRemoteUiFlowUrl: string
}

const baseModel: object = {
Expand All @@ -44,7 +45,8 @@ const baseModel: object = {
lsfUrl: '',
lsfRevision: 0,
creator: '',
schemaVersion: 0
schemaVersion: 0,
commissionerRemoteUiFlowUrl: ''
}

export const Model = {
Expand Down Expand Up @@ -106,6 +108,9 @@ export const Model = {
if (message.schemaVersion !== 0) {
writer.uint32(152).uint32(message.schemaVersion)
}
if (message.commissionerRemoteUiFlowUrl !== '') {
writer.uint32(162).string(message.commissionerRemoteUiFlowUrl)
}
return writer
},

Expand Down Expand Up @@ -173,6 +178,9 @@ export const Model = {
case 19:
message.schemaVersion = reader.uint32()
break
case 20:
message.commissionerRemoteUiFlowUrl = reader.string()
break
default:
reader.skipType(tag & 7)
break
Expand Down Expand Up @@ -278,6 +286,11 @@ export const Model = {
} else {
message.schemaVersion = 0
}
if (object.commissionerRemoteUiFlowUrl !== undefined && object.commissionerRemoteUiFlowUrl !== null) {
message.commissionerRemoteUiFlowUrl = String(object.commissionerRemoteUiFlowUrl)
} else {
message.commissionerRemoteUiFlowUrl = ''
}
return message
},

Expand All @@ -304,6 +317,7 @@ export const Model = {
message.lsfRevision !== undefined && (obj.lsfRevision = message.lsfRevision)
message.creator !== undefined && (obj.creator = message.creator)
message.schemaVersion !== undefined && (obj.schemaVersion = message.schemaVersion)
message.commissionerRemoteUiFlowUrl !== undefined && (obj.commissionerRemoteUiFlowUrl = message.commissionerRemoteUiFlowUrl)
return obj
},

Expand Down Expand Up @@ -404,6 +418,11 @@ export const Model = {
} else {
message.schemaVersion = 0
}
if (object.commissionerRemoteUiFlowUrl !== undefined && object.commissionerRemoteUiFlowUrl !== null) {
message.commissionerRemoteUiFlowUrl = object.commissionerRemoteUiFlowUrl
} else {
message.commissionerRemoteUiFlowUrl = ''
}
return message
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface MsgCreateModel {
productUrl: string
lsfUrl: string
schemaVersion: number
commissionerRemoteUiFlowUrl: string
}

export interface MsgCreateModelResponse {}
Expand All @@ -43,6 +44,7 @@ export interface MsgUpdateModel {
lsfUrl: string
lsfRevision: number
schemaVersion: number
commissionerRemoteUiFlowUrl: string
}

export interface MsgUpdateModelResponse {}
Expand Down Expand Up @@ -120,7 +122,8 @@ const baseMsgCreateModel: object = {
supportUrl: '',
productUrl: '',
lsfUrl: '',
schemaVersion: 0
schemaVersion: 0,
commissionerRemoteUiFlowUrl: ''
}

export const MsgCreateModel = {
Expand Down Expand Up @@ -179,6 +182,9 @@ export const MsgCreateModel = {
if (message.schemaVersion !== 0) {
writer.uint32(144).uint32(message.schemaVersion)
}
if (message.commissionerRemoteUiFlowUrl !== '') {
writer.uint32(154).string(message.commissionerRemoteUiFlowUrl)
}
return writer
},

Expand Down Expand Up @@ -243,6 +249,9 @@ export const MsgCreateModel = {
case 18:
message.schemaVersion = reader.uint32()
break
case 19:
message.commissionerRemoteUiFlowUrl = reader.string()
break
default:
reader.skipType(tag & 7)
break
Expand Down Expand Up @@ -343,6 +352,11 @@ export const MsgCreateModel = {
} else {
message.schemaVersion = 0
}
if (object.commissionerRemoteUiFlowUrl !== undefined && object.commissionerRemoteUiFlowUrl !== null) {
message.commissionerRemoteUiFlowUrl = String(object.commissionerRemoteUiFlowUrl)
} else {
message.commissionerRemoteUiFlowUrl = ''
}
return message
},

Expand All @@ -368,6 +382,7 @@ export const MsgCreateModel = {
message.productUrl !== undefined && (obj.productUrl = message.productUrl)
message.lsfUrl !== undefined && (obj.lsfUrl = message.lsfUrl)
message.schemaVersion !== undefined && (obj.schemaVersion = message.schemaVersion)
message.commissionerRemoteUiFlowUrl !== undefined && (obj.commissionerRemoteUiFlowUrl = message.commissionerRemoteUiFlowUrl)
return obj
},

Expand Down Expand Up @@ -463,6 +478,11 @@ export const MsgCreateModel = {
} else {
message.schemaVersion = 0
}
if (object.commissionerRemoteUiFlowUrl !== undefined && object.commissionerRemoteUiFlowUrl !== null) {
message.commissionerRemoteUiFlowUrl = object.commissionerRemoteUiFlowUrl
} else {
message.commissionerRemoteUiFlowUrl = ''
}
return message
}
}
Expand Down Expand Up @@ -520,7 +540,8 @@ const baseMsgUpdateModel: object = {
productUrl: '',
lsfUrl: '',
lsfRevision: 0,
schemaVersion: 0
schemaVersion: 0,
commissionerRemoteUiFlowUrl: ''
}

export const MsgUpdateModel = {
Expand Down Expand Up @@ -570,6 +591,9 @@ export const MsgUpdateModel = {
if (message.schemaVersion !== 0) {
writer.uint32(120).uint32(message.schemaVersion)
}
if (message.commissionerRemoteUiFlowUrl !== '') {
writer.uint32(130).string(message.commissionerRemoteUiFlowUrl)
}
return writer
},

Expand Down Expand Up @@ -625,6 +649,9 @@ export const MsgUpdateModel = {
case 15:
message.schemaVersion = reader.uint32()
break
case 16:
message.commissionerRemoteUiFlowUrl = reader.string()
break
default:
reader.skipType(tag & 7)
break
Expand Down Expand Up @@ -710,6 +737,11 @@ export const MsgUpdateModel = {
} else {
message.schemaVersion = 0
}
if (object.commissionerRemoteUiFlowUrl !== undefined && object.commissionerRemoteUiFlowUrl !== null) {
message.commissionerRemoteUiFlowUrl = String(object.commissionerRemoteUiFlowUrl)
} else {
message.commissionerRemoteUiFlowUrl = ''
}
return message
},

Expand All @@ -732,6 +764,7 @@ export const MsgUpdateModel = {
message.lsfUrl !== undefined && (obj.lsfUrl = message.lsfUrl)
message.lsfRevision !== undefined && (obj.lsfRevision = message.lsfRevision)
message.schemaVersion !== undefined && (obj.schemaVersion = message.schemaVersion)
message.commissionerRemoteUiFlowUrl !== undefined && (obj.commissionerRemoteUiFlowUrl = message.commissionerRemoteUiFlowUrl)
return obj
},

Expand Down Expand Up @@ -812,6 +845,11 @@ export const MsgUpdateModel = {
} else {
message.schemaVersion = 0
}
if (object.commissionerRemoteUiFlowUrl !== undefined && object.commissionerRemoteUiFlowUrl !== null) {
message.commissionerRemoteUiFlowUrl = object.commissionerRemoteUiFlowUrl
} else {
message.commissionerRemoteUiFlowUrl = ''
}
return message
}
}
Expand Down
1 change: 1 addition & 0 deletions x/model/client/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const (
FlagCommissioningModeInitialStepsInstruction = "commissioningModeInitialStepsInstruction"
FlagCommissioningModeSecondaryStepsHint = "commissioningModeSecondaryStepsHint"
FlagCommissioningModeSecondaryStepsInstruction = "commissioningModeSecondaryStepsInstruction"
FlagCommissionerRemoteUiFlowURL = "commissionerRemoteUiFlowURL"

Check warning on line 19 in x/model/client/cli/flags.go

View workflow job for this annotation

GitHub Actions / Check linter issues with golangci-lint tool

var-naming: const FlagCommissionerRemoteUiFlowURL should be FlagCommissionerRemoteUIFlowURL (revive)
FlagUserManualURL = "userManualURL"
FlagSupportURL = "supportURL"
FlagProductURL = "productURL"
Expand Down
8 changes: 8 additions & 0 deletions x/model/client/cli/tx_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func CmdCreateModel() *cobra.Command {
commissioningModeInitialStepsInstruction string
commissioningModeSecondaryStepsHint uint32
commissioningModeSecondaryStepsInstruction string
commissionerRemoteUiFlowURL string

Check warning on line 28 in x/model/client/cli/tx_model.go

View workflow job for this annotation

GitHub Actions / Check linter issues with golangci-lint tool

var-naming: var commissionerRemoteUiFlowURL should be commissionerRemoteUIFlowURL (revive)
userManualURL string
supportURL string
productURL string
Expand Down Expand Up @@ -61,6 +62,7 @@ func CmdCreateModel() *cobra.Command {
commissioningModeInitialStepsInstruction,
commissioningModeSecondaryStepsHint,
commissioningModeSecondaryStepsInstruction,
commissionerRemoteUiFlowURL,
userManualURL,
supportURL,
productURL,
Expand Down Expand Up @@ -120,6 +122,8 @@ current CHIP Administrator to put the device into commissioning mode.`)
of commissioningModeSecondaryStepsHint. Certain values of commissioningModeSecondaryStepsHint,
as defined in the Pairing Hint Table, indicate a Pairing Instruction (PI) dependency,
and for these values the commissioningModeSecondaryStepInstruction SHALL be set`)
cmd.Flags().StringVar(&commissionerRemoteUiFlowURL, FlagCommissionerRemoteUiFlowURL, "",
`commissionerRemoteUiFlowURL SHALL identify URL to show a custom flow UI for the commissioner`)
cmd.Flags().StringVar(&userManualURL, FlagUserManualURL, "",
"URL that contains product specific web page that contains user manual for the device model.")
cmd.Flags().StringVar(&supportURL, FlagSupportURL, "",
Expand Down Expand Up @@ -149,6 +153,7 @@ func CmdUpdateModel() *cobra.Command {
commissioningCustomFlowURL string
commissioningModeInitialStepsInstruction string
commissioningModeSecondaryStepsInstruction string
commissionerRemoteUiFlowURL string

Check warning on line 156 in x/model/client/cli/tx_model.go

View workflow job for this annotation

GitHub Actions / Check linter issues with golangci-lint tool

var-naming: var commissionerRemoteUiFlowURL should be commissionerRemoteUIFlowURL (revive)
userManualURL string
supportURL string
productURL string
Expand Down Expand Up @@ -182,6 +187,7 @@ func CmdUpdateModel() *cobra.Command {
commissioningCustomFlowURL,
commissioningModeInitialStepsInstruction,
commissioningModeSecondaryStepsInstruction,
commissionerRemoteUiFlowURL,
userManualURL,
supportURL,
productURL,
Expand Down Expand Up @@ -223,6 +229,8 @@ values the commissioningModeInitialStepsInstruction SHALL be set`)
of commissioningModeSecondaryStepsHint. Certain values of commissioningModeSecondaryStepsHint,
as defined in the Pairing Hint Table, indicate a Pairing Instruction (PI) dependency,
and for these values the commissioningModeSecondaryStepInstruction SHALL be set`)
cmd.Flags().StringVar(&commissionerRemoteUiFlowURL, FlagCommissionerRemoteUiFlowURL, "",
`commissionerRemoteUiFlowURL SHALL identify URL to show a custom flow UI for the commissioner`)
cmd.Flags().StringVar(&userManualURL, FlagUserManualURL, "",
"URL that contains product specific web page that contains user manual for the device model.")
cmd.Flags().StringVar(&supportURL, FlagSupportURL, "",
Expand Down
15 changes: 10 additions & 5 deletions x/model/keeper/msg_server_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ func (k msgServer) CreateModel(goCtx context.Context, msg *types.MsgCreateModel)
CommissioningModeInitialStepsInstruction: msg.CommissioningModeInitialStepsInstruction,
CommissioningModeSecondaryStepsHint: msg.CommissioningModeSecondaryStepsHint,
CommissioningModeSecondaryStepsInstruction: msg.CommissioningModeSecondaryStepsInstruction,
UserManualUrl: msg.UserManualUrl,
SupportUrl: msg.SupportUrl,
ProductUrl: msg.ProductUrl,
LsfUrl: msg.LsfUrl,
SchemaVersion: msg.SchemaVersion,
CommissionerRemoteUiFlowUrl: msg.CommissionerRemoteUiFlowUrl,
UserManualUrl: msg.UserManualUrl,
SupportUrl: msg.SupportUrl,
ProductUrl: msg.ProductUrl,
LsfUrl: msg.LsfUrl,
SchemaVersion: msg.SchemaVersion,
}

// if LsfUrl is not empty, we set lsfRevision to default value of 1
Expand Down Expand Up @@ -120,6 +121,10 @@ func (k msgServer) UpdateModel(goCtx context.Context, msg *types.MsgUpdateModel)
model.CommissioningModeSecondaryStepsInstruction = msg.CommissioningModeSecondaryStepsInstruction
}

if msg.CommissionerRemoteUiFlowUrl != "" {
model.CommissionerRemoteUiFlowUrl = msg.CommissionerRemoteUiFlowUrl
}

if msg.UserManualUrl != "" {
model.UserManualUrl = msg.UserManualUrl
}
Expand Down
26 changes: 15 additions & 11 deletions x/model/types/messages_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func NewMsgCreateModel(
commissioningModeInitialStepsInstruction string,
commissioningModeSecondaryStepsHint uint32,
commissioningModeSecondaryStepsInstruction string,
commissionerRemoteUiFlowURL string,

Check warning on line 31 in x/model/types/messages_model.go

View workflow job for this annotation

GitHub Actions / Check linter issues with golangci-lint tool

var-naming: func parameter commissionerRemoteUiFlowURL should be commissionerRemoteUIFlowURL (revive)
userManualURL string,
supportURL string,
productURL string,
Expand All @@ -48,11 +49,12 @@ func NewMsgCreateModel(
CommissioningModeInitialStepsInstruction: commissioningModeInitialStepsInstruction,
CommissioningModeSecondaryStepsHint: commissioningModeSecondaryStepsHint,
CommissioningModeSecondaryStepsInstruction: commissioningModeSecondaryStepsInstruction,
UserManualUrl: userManualURL,
SupportUrl: supportURL,
ProductUrl: productURL,
LsfUrl: lsfURL,
SchemaVersion: schemaVersion,
CommissionerRemoteUiFlowUrl: commissionerRemoteUiFlowURL,
UserManualUrl: userManualURL,
SupportUrl: supportURL,
ProductUrl: productURL,
LsfUrl: lsfURL,
SchemaVersion: schemaVersion,
}
}

Expand Down Expand Up @@ -105,6 +107,7 @@ func NewMsgUpdateModel(
commissioningCustomFlowURL string,
commissioningModeInitialStepsInstruction string,
commissioningModeSecondaryStepsInstruction string,
commissionerRemoteUiFlowURL string,

Check warning on line 110 in x/model/types/messages_model.go

View workflow job for this annotation

GitHub Actions / Check linter issues with golangci-lint tool

var-naming: func parameter commissionerRemoteUiFlowURL should be commissionerRemoteUIFlowURL (revive)
userManualURL string,
supportURL string,
productURL string,
Expand All @@ -122,12 +125,13 @@ func NewMsgUpdateModel(
CommissioningCustomFlowUrl: commissioningCustomFlowURL,
CommissioningModeInitialStepsInstruction: commissioningModeInitialStepsInstruction,
CommissioningModeSecondaryStepsInstruction: commissioningModeSecondaryStepsInstruction,
UserManualUrl: userManualURL,
SupportUrl: supportURL,
ProductUrl: productURL,
LsfUrl: lsfURL,
LsfRevision: lsfRevision,
SchemaVersion: schemaVersion,
CommissionerRemoteUiFlowUrl: commissionerRemoteUiFlowURL,
UserManualUrl: userManualURL,
SupportUrl: supportURL,
ProductUrl: productURL,
LsfUrl: lsfURL,
LsfRevision: lsfRevision,
SchemaVersion: schemaVersion,
}
}

Expand Down
Loading

0 comments on commit 8de3dc3

Please sign in to comment.